Post

Replies

Boosts

Views

Activity

NSSavePanel
I want to include a button that could export some data but I'm stuck: I want a NSSavePanel open up and when I choose the pass and click save the JSON file will appear but it didn't. code: Button {     let export = exportToJSON(toExported(data.data))     let openPanel = NSSavePanel()     openPanel.message = "Choose the exported path:"     openPanel.begin { response in         if response == .OK {             print("\(openPanel.url!)")             url = openPanel.url!             let fileManager = FileManager()             let success = fileManager.createFile(atPath: "\(url)", contents: export)             debugPrint(success)         }     } } label: {     Image(systemName: "square.and.arrow.down") }.padding().buttonStyle(.plain) console: file:///Users/xxx/Documents/Untitled false
1
0
380
May ’22
Strange bug
My SceneKit Game failed with a com.apple.scenekit.scnview-renderer (10): signal SIGABRT The error was marked on the line @main Here's the log navigator: 2022-05-25 15:24:18.829319+0800 MyWorldiOS[9022:293392] Metal API Validation Enabled validateRenderPassDescriptor:899: failed assertion `RenderPass Descriptor Validation MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action for the depth attachment is not supported by device PixelFormat MTLPixelFormatDepth32Float cannot be a MSAA resolve target ' dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/MyWorld-aayoxjgvyfzbxvgqnvylzgvlwkyr/Build/Products/Debug-iphonesimulator:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/MyWorld-aayoxjgvyfzbxvgqnvylzgvlwkyr/Build/Products/Debug-iphonesimulator validateRenderPassDescriptor:899: failed assertion `RenderPass Descriptor Validation MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action for the depth attachment is not supported by device PixelFormat MTLPixelFormatDepth32Float cannot be a MSAA resolve target ' CoreSimulator 802.6 - Device: MyPhone (EBB1ECDE-8AD7-4418-84AF-0B761E0A2EA7) - Runtime: iOS 15.4 (19E5234a) - DeviceType: iPhone 12 (lldb)  I'm not sure what else should I put in here
1
0
983
May ’22
Quick Look Preview Extension
I'm trying to add a quick look preview extension to my app. But I can't find any reference on this On a earlier thread (https://developer.apple.com/forums/thread/704155) everyone seems to misunderstand my question. I MEAN THE QUICK LOOK YOU CAN TOGGLE IN FINDER THAT WILL SHOW YOU A PREVIEW OF A DOCUEMNT I don't want to add the tag QuickLook because that's not I want to do.
1
0
702
Feb ’24
AVFoundation weird
2022-06-09 08:51:30.793789+0800 MyAppName[4651:447798] [aqme]        MEMixerChannel.cpp:1629  client <AudioQueueObject@0x7fc09a04f400; [0]; play> got error 2003332927 while sending format information I use .mp3
1
1
1.5k
Dec ’22
Really easy question
I know this is really easy I want to get the absolute path for the current app And I can achieve using String(reflecting: Bundle.main.bundleURL) But what outputs isn't like /User/xxx/..... but file:///User/xx/... so what can I do to get a absolute path in /xxx/xxx/xxx format? thanks
1
0
319
Jun ’22
Virtualization
I know how to use Virtualization now But I don't know how to write interface in AppKit So I should find a way to embed a NSView(the VM's UI) in a SwiftUI View However I couldn't find any reference on how except NSViewRepresentable which, of course, will not work I know there must be a easy way to do this But I'm just can't find it... any help is appreciated
1
0
843
Jun ’22
Why isn't my "Add button" not working?
I'm trying out Swift Charts and I'm pretty messed up After I deleted all of my items, I couldn't add items anymore import SwiftUI extension Array where Element == ChartsData {     mutating func delete(_ item: ChartsData) {         self.removeAll {             $0 == item         }     } } struct ContentView: View {     var ofType: ChartsType     @State var data: [ChartsData] = []     var body: some View {         List {             VStack {                 HStack {                     Spacer() // MARK - add button                     Button {                         data.append(ChartsData(item: "item"))                     } label: {                         Image(systemName: "plus").imageScale(.large)                     }.buttonStyle(.plain).padding()                 }                                  List {                     ForEach(data) { datum in                         TableRow(data: datum).swipeActions {                             Button(role: .destructive) {                                 data.delete(datum)                             } label: {                                 Label("Delete", systemImage: "trash")                             }                         }                     }                 }                 NavigationLink{                     ChartsView(ofType: .BarChart, data: data)                 } label: {                     Text("Generate").font(.largeTitle).foregroundStyle(.linearGradient(colors: [.orange, .yellow, .blue, .purple], startPoint: .topTrailing, endPoint: .bottomLeading))                 }.padding()             }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView(ofType: .BarChart, data: [             ChartsData(item: "testItem1", value: 10),             ChartsData(item: "testItem2", value: 20)         ])     } }
1
0
585
Jun ’22
Weird UI layout in SwiftUI .swipeActions
OK after I'm done with my last issue I came across some weird UI layout this is really a serious issue because afterward it looks like this😂 why? I've never met this kind of issue before in my same code before upgrading to Ventura code: List { ...                 Section {                     ForEach(data) { datum in                         TableRow(data: datum)                             .swipeActions {                             Button(role: .destructive) {                                 data.delete(datum)                             } label: {                                 Label("Delete", systemImage: "trash")                             }                         }                     }                 } ... }
1
0
585
Jun ’22
WeatherKit and SwiftUI
I'm trying out weather kit and I'm using swiftUI I have a view that accepts a CurrentWeather type value in initailizer I cannot find a way to initialize a CurrentWeather How can I preview It? This won't work: // forecaster and forecast is defined by me struct WeatherView_Previews: PreviewProvider {     static var previews: some View { // <- static WeatherView(weather: await forecaster.forcast(latitude: 0, longtitude: 0)) // <- concurrency     } }
1
0
1k
Jun ’22
@AppStorage
I have a structure TodoItem struct TodoItem: Codable, Hashable, Identifiable {     var id: UUID = UUID()     var item: String     var done: Bool = false } How can I use AppStorage on [TodoItem]?
1
0
1.3k
Jul ’22