Search results for

swiftui

16,584 results found

Post

Replies

Boosts

Views

Activity

SwiftUI macOS SignInWithAppleButton in
In SwiftUI I got error when I use SignInWithAppleButton in SplitReplacementHostingController I got crash Fatal error: Attempting to present ASAuthorizationController from a SwiftUI view not in a heirarchy. This should not be possible, please file feedback.: file _AuthenticationServices_SwiftUI/SignInWithAppleButton.swift, line 300 Fatal error: Attempting to present ASAuthorizationController from a SwiftUI view not in a heirarchy. This should not be possible, please file feedback.: file _AuthenticationServices_SwiftUI/SignInWithAppleButton.swift, line 300 When I place the same button to first screen in the app it works Mainly it is because I have Sidebar and NavigationView which is preferred for the macOS so when I have the two column placeholder there as the button it works but when I navigate via NavigationLink it stop working I used Xcode 12.2 beta 3 (12B5035g) Big Sur 20A5395g
9
0
2.9k
Oct ’20
How To Position Controls With SwiftUI
I am coming from C#, where Forms and Controls are placed similar to Swift Storyboards. I have been trying to learn Storyboards, but keep running across tutorials regarding SwiftUI, and Storyboard examples are few. So the question becomes, how do I position controls on a Form using SwiftUI? See the example below. I have run across many videos that use either horizontal or vertical positioning of controls, but these examples are usually very simple, with items occupying only the center portion of the screen. I get stuck on examples that are more complicated. The example below only shows the controls for the upper part of a Form, with some type of textbox (Viewform) below making up the rest of the Form. How does one make more complicated placement of controls with SwiftUI?
10
0
398
Sep ’25
VZVirtualMachineView in SwiftUI App
I have a working XIB App to run a Linux VM with graphics interface. I am trying to rewrite it in SwiftUI but fall into all sorts of problems when using a combination of a Representable of the VZVirtualMachineView, an associated Coordinator, and @StateObjects. a) The VM display is not updated when running but is displayed if I close the window and reopen it. As the underlying VZVirtualMachineView is created/dismantled many times, there are warnings about negative scanouts that end up crashing the App b) Keyboard focus is not really working. https://developer.apple.com/forums/thread/766014 reports that there is probably a solution making a NSViewControllerReporesentable rather than a VZVirtualMachineViewRepresentable. I think I am fighting against proper SwiftUI lifecycle and would love to have a hint at what shall be the right organization of model and SwiftUI constructs.
3
0
112
Nov ’25
Using menus in SwiftUI
From the Designing with iOS Menus - https://developer.apple.com/videos/play/wwdc2020/10205 and Building with iOS Menus - https://developer.apple.com/videos/play/wwdc2020/10052/, it was clear that we should replacing many of our action sheets with menus. I couldn't find how to do that with SwiftUI though. The only thing that I am seeing is still .contextMenu, which would appear after a long press. Am I missing something, or does SwiftUI lack support for this new approach?
8
0
4.1k
Jun ’20
ViewDidLoad in SwiftUI
Hello. I want to do a fetch when a view loads. In UIKit I would have used viewDidLoad to do this but in SwiftUI we only have onAppear and task. Is that by design, and if so, what is the recommended way to fetch data? I wrote a little blog post for a workaround describing the issue and the found solution, but I presume there is a better way. https://www.ludafux.com/post/viewdidload_doppelganger Best Regards, Luda
4
0
1.4k
Jul ’24
Apple TV and SwiftUI
Hi,I'm trying to slowly add SwiftUI ViewControllers to an existing UIKit app.With the iPhone and iPad and using a storyboard and hostingcontroller, I use the below code to go from a UIKit ViewController to a SwiftUI view:@IBSegueAction func SwiftUIAction(_ coder: NSCoder) -> UIViewController? { return UIHostingController(coder: coder, rootView: SecondController())The above code does NOT work with the AppleTV, and it doesn't give me an error (or I would put it here) What am I missing?Thanks,Dan Uff
0
0
627
Jan ’20
New to SwiftUI
I have been a web developer for about 10 years. My goal when I started was to be an apple developer. I am finally diving into that world. I’ve been learning SwiftUI with the understanding that I can use the same code to built for iOD and MacOS. I found a snippet that lets me check this at compile, but is that the right way to do this. Is there documentation on what the right way to do this is? As I would intend to have completely different views for the Mac and iOS
1
0
367
Jul ’24
SwiftUI analogue of UIIViewController.isModalInPresentation
As of iOS 13 with the new card style default presentation of modal view controllers users can dismiss these with a downward swipe gesture by default. If this behaviour is not desired isModalInPresentation can be set to true to disable it. In SwiftUI the sheet modifier does not seem to expose this option and will always be dismissed. An alternative is to use fullScreenCover — but this loses the card effect. Is there an option to prevent dismissing SwiftUI sheets using the gesture mentioned?
2
0
1.6k
Jun ’20