Post

Replies

Boosts

Views

Activity

Reply to Crash when triggering sheet presentation from a task
I found a solution import PlaygroundSupport import SwiftUI struct SheetView: View { @Binding var content: String? init(_ content: Binding<String?>) { _content = content } var body: some View { Text(content!) } } struct ContentView: View { @State private var isPresented = false @State private var content: String? @State private var startTask = false var body: some View { Text("Tap me") .onTapGesture { startTask = true } .frame(width: 500.0, height: 500.0) .task(id: startTask) { guard startTask else { // startTask = false // <===== Crashes if removed content = "Some message" isPresented = true } .sheet(isPresented: $isPresented) { SheetView($content) } } } let view = ContentView() PlaygroundPage.current.setLiveView(view)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’23
Reply to Device UDID
That functionality was disabled a long time ago due to privacy concerns. You can get an identifier that remains the same as long as one of your apps is installed, but if they are deleted and installed again, a new one is assigned... https://developer.apple.com/documentation/uikit/uidevice identifierForVendor
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’23