Post

Replies

Boosts

Views

Activity

Reply to Core ML Model Deployment can not upload mlarchive file,InvalidArgumentError: Unable to unzip MLArchive
MLModelCollection.beginAccessing(identifier: "Collection Name") { result in           var modelURL: URL?           switch result {           case .success(let collection):             print(collection)             modelURL = collection.entries["io.aben.animegan2face.v1"]?.modelURL           case .failure(let error):             print(error)           }           print(modelURL as Any)         } Got failure error: MLModelCollection: namespace (animegan2face_paint_512_v2) registration failed. Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.triald.namespace-management was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.triald.namespace-management was invalidated: failed at lookup with error 159 - Sandbox restriction.} Error Domain=com.apple.CoreML Code=10 "Failed to begin access for model collection with identifier 'animegan2face_paint_512_v2': invalid identifier" UserInfo={NSLocalizedDescription=Failed to begin access for model collection with identifier 'animegan2face_paint_512_v2': invalid identifier} nil
Jan ’23
Reply to NSPersistentCloudKitContainer for Shares
WWDC20 did it! let containerIdentifier = persistentStoreDescriptions.cloudKitContainerOptions!.containerIdentifier persistentStoreDescriptions.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier) persistentStoreDescriptions.cloudKitContainerOptions?.databaseScope = .public       But, when could we really using it in apps?
Jul ’20
Reply to How to take a screenshot of List in a ScrollView of SwiftUI?
Lucky, I found a way to take screenshot in scrollview ... struct ColorGroupView: View {   var colors: [UIColor]   @State var coverImage: UIImage   var body: some View {     let content =       VStack {         ForEach(1...50, id: \.self) { i in           Text("Hello \(i)")             .frame(maxWidth: .infinity, minHeight: 60)         }     }           return GeometryReader { geometry in       VStack(spacing: 0) {         ScrollView {           content         }         ScrollView {           Image(uiImage: self.coverImage)             .frame(maxWidth: .infinity, minHeight: 60)         }         HStack{           Button("Button") {             let screenshot = content.takeScreenshot(origin: geometry.frame(in: .global).origin, size: geometry.size)             self.coverImage = screenshot           }         }         .padding()         .padding(.bottom, geometry.safeAreaInsets.bottom)         .frame(maxWidth: .infinity)         .background(VisualEffectBlur())       }       .edgesIgnoringSafeArea(.bottom)     }   } } extension View {   func takeScreenshot(origin: CGPoint, size: CGSize) -> UIImage {     let window = UIWindow(frame: CGRect(origin: origin, size: size))     let hosting = UIHostingController(rootView: self)           hosting.view.sizeToFit()           window.height = hosting.view.frame.size.height > 0 ? hosting.view.frame.size.height : window.height     window.width = hosting.view.frame.size.height > 0 ? hosting.view.frame.size.height : window.width           window.rootViewController = hosting     window.makeKeyAndVisible()     return window.snapshotImage()!   } } ... extension UIView { func height ... func width ... func snapshotImage ...
Jul ’20