Post

Replies

Boosts

Views

Activity

SwiftUI External Events without SwiftUI Lifecycle
I am using the new "pure" SwiftUI App and Scene structs instead of an AppDelegate. Some of my views accept custom url schemes and user activities using onOpenURL(perform:). Everything works as expected. However, starting with Beta 6, Xcodes gives the following runtime warning: runtime: SwiftUI: Cannot use Scene methods for URL, NSUserActivity, and other External Events without using SwiftUI Lifecycle. Without SwiftUI Lifecycle, advertising and handling External Events wastes resources, and will have unpredictable results. What exactly am I doing wrong? What is *SwiftUI Lifecycle* referring to?
5
0
3.6k
Aug ’20
Get RGB from SwiftUI Color Picker
The new ColorPicker for SwiftUI initializes with a Binding<Color>. A Color, however, only gets resolved by SwiftUI "just before using it in a given environment" - https://developer.apple.com/documentation/swiftui/color. How do I get the RGB values (or a UIColor) from the SwiftUI color picker? The UIKit version UIColorPickerViewController has a [selectedColor](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontroller/3600466-selectedcolor) property that one could read. Is there any way to use the SwiftUI color picker and read the actually value selected by the user?
3
0
5.5k
Jun ’20