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
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:
Replies
Boosts
Views
Activity
Aug ’23
Reply to Sonoma failing builds Xcode 15 and iOS 15
It looks like Sonoma 14.1 is limited to iOS 15.2. I have an M2 mac mini and that was the oldest platform available to install. 15.0 was showing installed but failed to run.
Replies
Boosts
Views
Activity
Nov ’23
Reply to How to disable dimming on the screen, and print os_log on the content screen
Are you sure the setIdleTimerDisabled code is executing? It is my understanding that the call to UIApplicationMain() never returns.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to How to disable dimming on the screen, and print os_log on the content screen
And then I realize I was looking at the code you had to reenable the timer. You might want to consider moving the code into the app delegate. I've used the disable timer successfully in a media program to prevent the app locking while playing videos since the user wouldn't be interacting with the phone.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’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:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Massive mobile data usage
You might want to look through this page... https://support.apple.com/guide/iphone/view-or-change-cellular-data-settings-iph3dd5f213/ios
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to SwiftUI #Preview with Callback Closure
You need to return the view. #Preview { var callBack: (Date) -> Void = { _ in } return ContentView(callBack: callBack) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to There is a bug in iOS 16.6+ systems where UITextField is unresponsive.
You should file a bug report using the link below and reply back with the bug number.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to App works on iPad but not iPhone!
You should define what not working means. The display content is laid out wrong, you get errors, crashes. Show the code that isn't working.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Is there an opposite of @available?
You should be able to use #else
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Unable to install Vision Pro Simulator
It is my understanding vision os is still in beta. You would need to use a beta version of xcode 15
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Xcode - Unable to select device with older sim runtime
What do you have as your minimum deployment target? I believe it defaults to the most recent os version. You need to be sure to select 16.4 or earlier for iOS and of course be sure your app supports the selected version.
Replies
Boosts
Views
Activity
Nov ’23
Reply to iOS 17 devices not connecting to Xcode 15+! Please help!
There seem to be a lot if people having that issue with xcode 15. My work computer can't build to iOS 17 devices. We have put in a support request, with no update on it so far.
Replies
Boosts
Views
Activity
Nov ’23
Reply to How to make a unit test in a swift package with different current locales?
I would look to see if the formatted function has a version that includes the locale as a parameter and add tests for whatever locales you need to test.
Replies
Boosts
Views
Activity
Nov ’23
Reply to Iterate over an array and delete events that is older than present's day.
Modifying the number of elements in an array you are iterating over is problematic. I would suggest creating a copy of the array and iterate over that. You would want to delete items in the current array like you are now.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23