Post

Replies

Boosts

Views

Activity

Swift Student Challenge requires Swift Playground (.swiftpm), minimum OS setting not available.
When making a new Swift Playground via Xcode > New > Project > iOS > App Playground, as a .swiftpm package, the settings are very limited, including setting the minimum OS version. This is incredibly irritating because I can't keep make @available blocks because that would double the size of my code, and I can't use SwiftData (for example) because my app needs to also support iOS 16. Is there a way to set the minimum OS or some other upload type accepted for Apple so that I can change this simple setting? Thank you
2
0
442
Oct ’24
Xcode Predictive Code Completion can't download
I got the Xcode 16 beta a few months and I downloaded the predictive code completion model, and it worked, but then recently I deleted Xcode and the Developer directories and then installed a newer beta, but I couldn't download the model because of this issue: "The operation couldn’t be completed. (ModelCatalog.CatalogErrors.AssetErrors error 1.)" AND "Failed - Failed to find asset: com.apple.gm.safety_deny.input.code_intelligence.base - no asset" Then expanding this window gave me this error: The operation couldn’t be completed. (ModelCatalog.CatalogErrors.AssetErrors error 1.) Domain: ModelCatalog.CatalogErrors.AssetErrors Code: 1 User Info: { DVTErrorCreationDateKey = "2024-08-22 13:00:57 +0000"; } -- Failed to find asset: com.apple.gm.safety_deny.input.code_intelligence.base - no asset Domain: ModelCatalog.CatalogErrors.AssetErrors Code: 1 -- System Information macOS Version 15.1 (Build 24B5024e) Xcode 16.1 (23047) (Build 16B5001e) Timestamp: 2024-08-22T21:00:57+08:00 I have uninstalled then reinstalled Xcode 16.1 beta and Xcode 16.0 beta, but none of them worked. Thank you!
9
0
1.3k
Aug ’24
Something wrong with SwiftData
I have made the following code to basically play around with haptics: LibraryView.swift import SwiftUI import SwiftData struct LibraryView: View { @Environment(\.modelContext) var modelContext @Query/*(sort: \CustomHaptic.dateMade)*/ var customHapticArray: [CustomHaptic] @Query/*(sort: \DefaultHaptic.dateMade)*/ var defaultHapticArray: [DefaultHaptic] @State private var showingAddCustomHaptic = false @State private var showingAddDefaultHaptic = false var body: some View { NavigationStack { VStack { List { ForEach(customHapticArray) { customHaptic in HStack { VStack { Text("\(customHaptic.sharpness)") Text("") Text("\(customHaptic.intensity)") } Spacer() VStack { Text("\(customHaptic.repeats)") } } } } } .sheet(isPresented: $showingAddCustomHaptic, content: { NewCustomHaptic() }) .toolbar { Button("New Custom Haptic", systemImage: "plus") { showingAddCustomHaptic = true } } .navigationTitle("Haptikiser") } } } And NewCustomHaptic.swift, which is a sheet to add a new class CustomHaptic: @Model class CustomHaptic: Identifiable { var id = UUID() var dateMade = Date.now var repeats: Int var sharpness: Float var intensity: Float init(repeats: Int, sharpness: Float, intensity: Float) { self.repeats = repeats self.sharpness = sharpness self.intensity = intensity } } and import SwiftUI import SwiftData struct NewCustomHaptic: View { @Environment(\.dismiss) var dismiss @Environment(\.modelContext) var modelContext @Query(sort: \CustomHaptic.dateMade) var customHapticArray: [CustomHaptic] @State var sharpness: Float = 1 @State var intensity: Float = 1 @State var repeats: Int = 3 let array0to1: [Float] = [0.2, 0.4, 0.6, 0.8, 1.0] var body: some View { VStack { Form { Section("Sharpness") { Picker(selection: $sharpness, label: Label("Sharpness", systemImage: "bolt.horizontal")) { ForEach(array0to1, id: \.self) { i in Text("\(Int(i * 10))") } } .pickerStyle(.segmented) } Section("Intensity") { Picker(selection: $intensity, label: Label("Intensity", systemImage: "42.circle")) { ForEach(array0to1, id: \.self) { i in Text("\(Int(i * 10))") } } .pickerStyle(.segmented) } Section("Repeats") { Stepper(value: $repeats, in: 1...10) { Label("\(repeats)", systemImage: "repeat") } } } Button("Done") { let newCustomHaptic = CustomHaptic(repeats: repeats, sharpness: sharpness, intensity: intensity) modelContext.insert(newCustomHaptic) dismiss() } .buttonStyle(.borderedProminent) .font(.title) Spacer() } } } every single time i run it, i get " Query encountered an error: Error Domain=NSCocoaErrorDomain Code=256 "The file “default.store” couldn’t be opened." " in the console. And when I press done on the sheet, i get the same error. Thank you for helping
0
1
475
Feb ’24