Search results for

swiftui

16,584 results found

Post

Replies

Boosts

Views

Activity

Reply to Can't select other APFS volume when installing macOS beta 10.15
I've been able to launch the installer for beta 2 from a Mojave volume and select another APFS-formatted volume as the target (both an empty volume and one containing Mojave) - but the target volume was in a separate container. The installer has refused (on each of half a dozen tries) to reboot for completion of the installation process. An initial attempt to run the installer from a Mojave volume and target a separate volume containing beta 1 showed that volume in the targets list but refused to allow selecting it.I've given up on the beta 2 installer (especially given more than a few reports of stability problems with installations which were successful) - SwiftUI must wait until at least the next beta. System 7 with a collection of the most unstable Desk Accessories was more usable than this :-(
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
SwiftUI Modal View overlaps screen
I have a Modal view that seems to overlap the screen of my iPhoneX.This is DetailView.swift.import SwiftUI struct DetailView : View { @Binding var shouldDismiss : Bool var textData : String var image : UIImage? @Environment(.isPresented) private var isPresented var body: some View { VStack( alignment: .leading) { Button(action: { self.shouldDismiss.toggle() }) { Text(Close) }.font(.title) .foregroundColor(Color.secondary) .padding() Image(uiImage: image ?? UIImage()) .padding() Text(textData) .lineLimit(0) Spacer() } } }This is where the view is being pushed:ZStack { ... }.presentation(showDetails ? Modal(DetailView(shouldDismiss: $showDetails, textData: theTxtData, image: theImage), onDismiss:{ self.showDetails = false }) : nil)The DetailView overlaps on both sides of the screen. The text on the close Button is cut off (The C is not visible). Same goes for the image and the textData filed.
1
0
1.4k
Jun ’19
Reply to SwiftUI List with Toggle binding with model
Okay, I found the solution thanks to Jumhynover at StackOverflow https://stackoverflow.com/a/56616127This example compiles fine and works as expected.struct MyModel { var id: String var name: String var notify: Bool } import SwiftUI struct ContentView : View { @State var myModels: [MyModel] = [ MyModel(id: 1, name: First Model, notify: false), MyModel(id: 2, name: Second Model, notify: true) ] var body: some View { NavigationView { List($myModels.identified(by: .id.value)) { (myModel : Binding<MyModel>) in Toggle(isOn: myModel.notify) { Text(myModel.value.name) } } .navigationBarTitle(Text(My Models)) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Has anyone found a trivial way to display a sharing service picker?
I've stumbled through what documentation there is, and searched through the api's to the degree they are visible. It seems an 'obvious' add to be able to interact with sharing services in SwiftUI, without having to wrap an NSViewController to gain the ability to have a NSSharingServicePicker show itself. I'm hoping I'm overthinking this, and there's a simple solution.
0
0
702
Jun ’19
Should Button actions embedded in Forms fire independently in SwiftUI?
The following code has two Buttons embedded in a VStack embedded in a Form. The action event for both buttons proceed when either button is tapped. I would expect them to act independently. Anyone have any ideas?import SwiftUIstruct Test : View { var body: some View { Form { VStack { Button(action: { print(Here 1) }) { Text(Clear image) } Button(action: { print(Here 2) }) { Text(Clear image) } } } }}
0
0
412
Jun ’19
SwiftUI and UIKit
i saw the way of switch from a View with UIKit to SwiftUI in this video https://developer.apple.com/videos/play/wwdc2019/231but when running the App on my iPhone crashes, but in the simulator has no error.My Mac, xcode and iOS are with the beta 2On My StoryBoard have a View Controller with a button that goes to a Hosting Controller@IBSegueAction func showDetails(_ coder: NSCoder) -> UIViewController? { let rootView = SwiftUIView() return UIHostingController(coder: coder, rootView: rootView) }and my SwiftUIView is the basic, just the hello world.i get the error in the AppDelegatepointing to:class AppDelegate: UIResponder, UIApplicationDelegate {with error: Thread 1: EXC_BAD_ACCESS (code=2, address=0x1026c8180)am i doing something wrong?
1
0
935
Jun ’19
SwiftUI - Picker Binding not Working :-(
I am trying to bind a Picker, but it's not working. I create a BindableObject, an instance of Settings, add it to the environment using environmentObject() in SceneDelegate, and address it in the View using @EnvironmentObjectstruct ContentView : View { var favoriteFoods = [Tofu, Seitan, Nilla Wafers, Avocado Toast] @EnvironmentObject var settings : Settings // meanwhile, inside var body: some View ... Picker(selection: $settings.favoriteFoodChoice, label: Text(Favorite Food)){ ForEach(self.favoriteFoods.identified(by: .self)){ food in Text(food) } }Here's what my Settings looks like:class Settings : BindableObject { var didChange = PassthroughSubject<void,never>() var favoriteFoodChoice:Int { willSet { print(Favorite Food Choice will be (newValue)) didChange.send() print(Favorite Food Choice: (favoriteFoodChoice))// never changes when I select a different food. } didSet { print(Favorite Food Choice was (oldValue)) didChange.send() print(Favorite Food Choice: (favoriteFoodChoice))// never changes when I
7
0
11k
Jun ’19
Reply to Attempting to run Swift UI App on iPhone XR: Thread 1: EXC_BAD_ACCESS (code=2, address=0x100470190)
Line 23 error is 'Thread 1: EXC_BAD_ACCESS (code=1, address=0x8)'SwiftUI`SwiftUI.Text.resolve(into: inout SwiftUI.Text._Resolved, in: SwiftUI.EnvironmentValues) -> (): 0x22b8bc80 <+0>: sub sp, sp, #0xd0 ; =0xd0 0x22b8bc84 <+4>: stp x28, x27, [sp, #0x70] 0x22b8bc88 <+8>: stp x26, x25, [sp, #0x80] 0x22b8bc8c <+12>: stp x24, x23, [sp, #0x90] 0x22b8bc90 <+16>: stp x22, x21, [sp, #0xa0] 0x22b8bc94 <+20>: stp x20, x19, [sp, #0xb0] 0x22b8bc98 <+24>: stp x29, x30, [sp, #0xc0] 0x22b8bc9c <+28>: add x29, sp, #0xc0 ; =0xc0(line 10) 0x22b8bca0 <+32>: mov x22, x5 0x22b8bca4 <+36>: mov x28, x4 0x22b8bca8 <+40>: stp w2, w3, [sp, #0x18] 0x22b8bcac <+44>: str x1, [sp, #0x10] 0x22b8bcb0 <+48>: mov x24, x0 0x22b8bcb4 <+52>: ldr w0, [x0] 0x22b8bcb8 <+56>: ldp w27, w26, [x24, #0x4] 0x22b8bcbc <+60>: ldur d0, [x24, #0xc] 0x22b8bcc0 <+64>: str q0, [sp, #0x40] 0x22b8bcc4 <+68>: ldp w8, w25, [x24, #0x14] (line 20) 0
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Reply to SwiftUI - Picker Binding not Working :-(
I should be embarrassed to post from memory, since I am unable to test code (posting from my phone), but I think if you remove your event handler (didChange) for willSet, and use only didSet, you'll get your expected result. didChange, as I understand it, is the notification to swiftUI to update the environment...there may be something wonky in sending didChange before and after a data change, but I'm unsure, as it's hard to peek under the hood of some of the less documented stuff.edit:Here is your code... modified to function as I think you expect:struct ContentView: View { var favoriteFoods = [Tofu, Seitan, Nilla Wafers, Avocado Toast] @EnvironmentObject var settings: Settings var body: some View { HStack { Text(Picker: ) Picker(selection: $settings.favoriteFoodChoice, label: Text(Favorite Food)){ ForEach(0 ..< favoriteFoods.count) { Text(self.favoriteFoods[$0]).tag($0) } } } } } class Settings: BindableObject { var didChange = PassthroughSubject<void, never=>() var favoriteFoodChoice: Int
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Reply to SearchBar in Swift UI
I hope that as time moves forward some 'canned' standard views are produced. In some of my experimentation with SwiftUI I've often had to resort to manually launching non-swiftui views (file pickers, etc).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19