Posts

Post not yet marked as solved
5 Replies
4.9k Views
Anyone seeing this as well? This simple content will display a blank screen in landscape mode.```struct ContentView : View { var body: some View { NavigationView { Text("Hello World") } }}```
Posted
by caram.
Last updated
.
Post marked as solved
3 Replies
13k Views
I've been trying to send email from a SwiftUI view (see code further below).However, I'm running into the following issues:Non-class type 'SettingsView' cannot conform to class protocol 'MFMailComposeViewControllerDelegate'But if make SettingsView a class, then I get a ton of errors.Has anyone found a good way to solve this issue?import SwiftUIimport MessageUIstruct SettingsView : View, MFMailComposeViewControllerDelegate { var body: some View { Button(action: emailSupport) { Text("Email support") } } func emailSupport() { if MFMailComposeViewController.canSendMail() { let mail = MFMailComposeViewController() mail.mailComposeDelegate = self mail.setSubject("Some subject") mail.setToRecipients(["someemail@example.com"]) mail.setMessageBody("Some body", isHTML:false) present(mail, animated: true) } else { // show failure alert } } func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { controller.dismiss(animated: true) }}
Posted
by caram.
Last updated
.
Post not yet marked as solved
2 Replies
621 Views
SegmentedControl has this weird behaviour in beta 4:The following does work and allows player A, B or C to be selected:var players = { [Player("A"), Player("B"), Player("C")]}SegmentedControl(selection: $game.master) { // BTW, why does beta 4 require players to have the extra ()? ForEach(0 ..< self.players().count) { Text(self.players()[$0].name).tag($0) }}The following does allow player A, B or C to be selected, or none:SegmentedControl(selection: $game.master) { ForEach(0 ..< self.players().count) { Text(self.players()[$0].name).tag($0) } Text("none").tag(self.players().count)}The following does allow player B or C to be selected, but when trying to select A, the selection switches to "none" (you have to set a breakpoint to see the flip between A and "none"):SegmentedControl(selection: $game.master) { Text("none").tag(0) ForEach(0 ..< self.players().count) { Text(self.players()[$0].name).tag($0+1) }}
Posted
by caram.
Last updated
.
Post marked as solved
2 Replies
722 Views
I have view A that displays data requiring some heavy computation.Instead of redoing the computation over and over again, the data is cached every time some piece of data is modified by view B. This worked fine in beta 3, because changes triggered by view B would cause the data to:catch the didSet messageupdate the cachesend the didChange messageview A (and B) was updated as a resultHow can I to this in beta 4, now that willSet is used instead and it's too early to update the cache?
Posted
by caram.
Last updated
.
Post not yet marked as solved
2 Replies
842 Views
Upgraded to beta 4 yesterday and perfectly working app in beta 3 now crashes in: main > UIApplicationMain > 0_ViewList_ID.JoinedViews.subscript.getterwith the following error: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)This happens on a complex view whenever the user is moving a slider, toggling a toggle or picking an element in a segmented controller.
Posted
by caram.
Last updated
.
Post marked as solved
4 Replies
2.6k Views
I get this when traversing a NavigationLink (ex. NavigationButton) in the iOS simulator: Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)Steps to reproduce:1. List { ForEach { NavigationLink { Text("detail") } } } }2. Run in simulator3. Press on any element4. The table view cell becomes grey and EXC_BAD_INSTRUCTION is generated
Posted
by caram.
Last updated
.