Search results for

swiftui

16,588 results found

Post

Replies

Boosts

Views

Activity

SwiftUI TextField initializer deprecated?
I've got this code:TextField($searchText, placeholder:Text(Search))It's generating this error:'init(_:placeholder:onEditingChanged:onCommit:)' is deprecatedAs near as I can tell, there's no alternative. I'm not really an expert on reading Swift code yet, but to me it looks like all the inits have been deprecated. Is this a deprecation that was introduced in error? If not, what's the alternative?
7
0
5.6k
Jul ’19
Reply to SwiftUI Preview on HDD
Will certainly file additional bug reports once the installer team returns from their remedial state machines course and produces a functioning installer. :-( Catalina DP 3 is, as was DP 2 before it, uninstallable for a significant number of users, this one included. Seems unlikely this will change until at least 14 days have elapsed.For the moment, it's worth noting SwiftUI Preview under DP 1 is the first userland scenario in a very long time I've seen capable of consistenly triggering kernel panics.
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’19
Xcode 11 beta3 SwiftUI PresentationLink triggers only once.
Issue is reproduceable in 'Working with UI Controls' tutorial's project https://developer.apple.com/tutorials/swiftui/working-with-ui-controlsPresentationLink in Home.swift file shows Profile view, but only once - after you close the view, any subsequent touches do nothing. Also, app crashes with access violation error if NavigationLink is replaced with PresentationLink within NavigationView's List.
2
0
1.5k
Jul ’19
Reply to SwiftUI TextField initializer deprecated?
It appears the API was updated but not the documentation, yet. If you command-click on TextField in Xcode it will take you to the SwiftUI file where the init()s are declared. The new init you want ispublic init(_ titleKey: LocalizedStringKey, text: Binding, onEditingChanged: @escaping (Bool) -> Void = { _ in }, onCommit: @escaping () -> Void = {})so for your example change the code toTextField(Search, text: $searchText)
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’19
Reply to SwiftUI TextField initializer deprecated?
Ah, I think I know what you're seeing. The implemenation of SceneDelegate appears to have changed between beta 2 and 3.Previously if you created a new SwiftUI project you'd see soemthing like this:func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = UIHostingController(rootView: ContentView()) self.window = window window.makeKeyAndVisible() }As of beta 3, you'll need to cast the scene parameter as a UIWindowScene. Creating a new SwiftUI application with the Single View template now gives you something like this:func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let windowScene = scene as? UIWindowScene { let window = UIWindow(windowScene: windowScene) window.rootViewController = UIHostingController(rootView: ContentView()) self.window = window window.makeKeyAndVisible()
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’19
NavigationView for WatchOS
Hi to all,ok, with the tutorials I can create a list and navigate through it, but if I want to create it for WatchOS I can't because NavigationView is not compatible with WatchOS.How I can create a navigation list on WatchOS with SwiftUI?Anybody can help me?Thanks!!!
2
0
1.4k
Jul ’19
Loading SVG smbol in swiftui image
In Swift UI it should be posssible to load a custom symbol from the asset catalog into an image, similar to Image(systemName:) with SF Symbol.However, with beta3 this does not seem to work for me, or I'm overlooking something…Image(foo) works fine with bitmaps from the asset catalog, but trying to use Image(bar) with an SVG – which was generated with the SF Symbols app, it delivers just an error log no image bar was found in main bundle: fileAny ideas how to make that work?ThanksKlaus
8
0
18k
Jul ’19
TabBar Color not working with SwiftUI yet?
Hi,I am just trying to change the color of tabBar in the project.It should be as simple as this and it works on an iOS13 project without SwiftUI.UITabBar.appearance().tintColor = .redWhen using SwiftUI I get the stock blue color.Is there something else I need to do?I have tried to add a color to theTabbedView(selection: $selection){block, but that doesn't work on of the brackets.Could someone confirm this - or is this a known issue?
0
0
878
Jul ’19
SwiftUI viewWithTag
Is it possible to find a particular view in SwiftUI based on its tag ?When a row on a List is tapped, I want the textField on a row in another List to be updated.But the problem is I dont know how to get hold of the active textField or the index of the row in the other list.Please refer this image for clarity https://imgur.com/a/Ovv8IBY
1
0
1.1k
Jul ’19
XCode 11 Beta 3 - Can't add file to Project. File Dialog Freezes XCode.
I am working through the SwiftUI Tutorials and I was using the XCode Beta 2 IDE. It was working fine. When I updated to Beta 3 I noticed when I tried to add new files XCode would freeze at the file dialog window. I've tried multiple times and tried waiting for the dialog window to unfreeze and it doesn't happen. I've tried restarting my computer. I am also running the latest MacOs Catalina Beta OS.Any fixes for this or do I just have to wait for the next update?
3
0
1.8k
Jul ’19
scrollview | SwiftUI
I put this code but the horizontal scrolling doesn't working.struct HStackScrollView: View { var body: some View { ScrollView { HStack(alignment: .top){ ForEach(0..<100) { number in Text(Print value Row(number)) .frame(width: 200, height: 100) .background(Color.blue) } } } }}Can help me?
2
0
1.9k
Jul ’19
attachmentAnchor for popover in Beta3
I am updating my app from beta2 to beta3. Looks like the old format for creating a popover has been replaced with a new mechanism.My goal is to create the 'ellipses' menu item for my app.My old SwiftUI code looked like:struct MenuButton : View { @State var showMenu: Bool = false var body: some View { Button(action: { self.showMenu = true }) { Image(systemName: ellipsis) } .presentation(showMenu ? Popover(content: MenuView(isMenuPresented: $showMenu), dismissHandler: { self.showMenu = false }) : nil) }}But the .presentation(...) code was marked as removed. So, I moved to a new format, that seems appropriate, .popOver(...)struct MenuButton : View { @State var showMenu: Bool = false var body: some View { Button(action: { self.menuButtonTapped() }) { Image(systemName: ellipsis) } .popover(isPresented: $showMenu) { MenuView(isMenuPresented: self.$showMenu) } // FIXME: Need to compute the attachmentAnchor point, but I'm not clear how to // do that in Beta3. } func menuButtonTapped() { self.showMenu = true
0
0
640
Jul ’19