Post

Replies

Boosts

Views

Activity

Reply to Picker selection not changing
Yeah sadly you can't use an Optional value with a Picker in the same simple way you can normally do for Enum types. Instead, you need must tag each item casted as an Optional value. Here's an example from this SO answer to the question: Picker for optional data type in SwiftUI?: struct FruitView: View { @State private var fruit: Fruit? var body: some View { Picker(selection: $fruit, label: Text("Fruit")) { Text("No fruit").tag(nil as Fruit?) ForEach(Fruit.allCases) { fruit in Text(fruit.rawValue).tag(fruit as Fruit?) } } } }
Jan ’24
Reply to How to cancel Auto-renewable subscription bought in TestFlight?
Unfortunately while Apple does let you make a fake in-app purchase with a regular Apple ID in a TestFlight app, you'll then have no way of managing your subscription. To be able to have a full Sandbox experience where you can manage your subscription, you'll need to log out of your regular Apple ID on your device, and then log in with your Sandbox Apple ID. Then purchase the subscription in your app, and it should now use your Sandbox Apple ID, and after the purchase you'll now be able to manage your subscription.
May ’24
Reply to ActiveFormat tells my that my iPhone 12 Pro Max only supports 30 frames per second
For others encountering this issue, the more generic way to solve this problem is to choose the format that satisfies your desired conditions. For example, if you wanted to choose a format in 720p and compatible with 60 fps, you could do the following: let frameDuration = CMTimeMake(value: 1, timescale: 60) // Get format that is 720p resolution and is compatible with 60 fps. let format = device.formats.first { let dimensions = $0.formatDescription.dimensions let hasCompatibleFrameRateRange = $0.videoSupportedFrameRateRanges.contains { $0.minFrameRate <= 60 && 60 <= $0.maxFrameRate } return dimensions.width == 1280 && dimensions.height == 720 && hasCompatibleFrameRateRange } if let format = format { device.activeFormat = format device.activeVideoMinFrameDuration = frameDuration device.activeVideoMaxFrameDuration = frameDuration }
Jul ’24