Post

Replies

Boosts

Views

Activity

CloudKit What's the cost for using private database?
The document states that using private database counts towards the user's storage quota. However, I'm confused about the aspects "Data transfer" and "Requests per Second". Let's consider a few examples, a) Single Container An app only operates within a single container and use the private database only, either manually using cloudkit or managed by core data. b) Multiple Container An app use multiple containers, within each container only use private database. Does the "Data transfer" and "Requests Per Second" applicable to above cases? Many thanks,
0
0
379
Mar ’21
CloudKit What's the developer cost for shared database?
What's the price model for the shared database, i.e. the record user shared with others. Does the record user shared counting towards the app's public database quota? Or does it remain in user's private database quota for whom shared that record? In another word, would implement the sharing feature(without using the public database) lead to additional cost on the developer side?
0
0
359
Mar ’21
What is the practical maximum number of files within a UIDocument/FileWrapper?
I'm designing a document based app using UIDocument with a custom UT conforming to package that mainly contain a json file and a folder of images. I've read a couple of articles date from 2010s that the base implementation of UIDocument using FileWrapper to r/w a package has major performance issue when it contains a large number of files(i.e. images). Eventually those apps had to override the UIDocument by manually handle all the w/r and not using the FileWrapper. Considering the file coordination and conflict resolutions etc, could be hard and error proven. Do you have any recent experience on such issue? What's the practical maximum number of files/images a package can contain that without blowing the performance? TX!
0
0
423
Aug ’20
SwiftUI 2.0 using UIDocumentBrowser and UIDocument?
First and foremost, this question is intended to explore the feasibility, and possible workaround, of using SwiftUI 2.0 to build production ready document-based app. Motivation: The new document based app in SwiftUI 2.0 still lacking many features, for example, DocumentGroup: almost not customizable, i.e. template selection, tint color, nav bar items. FileDocument/ReferenceFileDocument: No conflict resolution whatsoever. And as far as my trails, the ReferenceFileDocument cannot trigger any write operation :(*. Solutions: Two obvious solutions, the SwiftUI 1.0 solution is using the traditional AppDelegate, SceneDelegate, etc, then hosting the DocumentEditorView which assuming it is the SwiftUI view. However, it makes develop cross iOS/macOS app harder. Also harder to use the new SwiftUI stuff like AppStorage, ScenceStorage, WindowGroup, Widgets etcs. (OR there are workarounds maybe?) the SwiftUI 2.0 solution, I have actually tried two paths. A not very successful one, using #if os check to use @UIApplicationDelegateAdaptor and @NSApplicationDelegateAdaptor. (let me know if you use this path). So far partially worked, creating a SwiftUI view to wrap the DocumentBrowserViewController. see the demo code below. My questions are: I) Has anyone successed in using like UIDocument directly in a DocumentGroup? II) Is DocumentGroup with "proper workaround" actually sufficient enough to replace the old framework? III)Do you know any drawbacks to wrap a UIDocumentBrowserViewController in a SwiftUI's Representable? And if the drawback is serious enough that we should give up the SwiftUI 2.0's new App structure, and use the AppDelegate approach. IV) Any related discussion is welcomed. struct DocumentBrowserView: View { 		 		/// The presentation of the view itself. 		@Binding var isPresented: Bool 		 		@StateObject var model = ViewModel() 		 		var body: some View { 				Group { 						#if os(iOS) 						RepresentedUIDocumentBrowser() 						.fullScreenCover(isPresented: .init(get: { 								model.state == .loadedAndPresentingDocument 						}, set: { _ in 								// handle state in onDismiss. 						}), onDismiss: { 								model.clearDocument() 						}, content: { 								if model.document != nil { 										EmptyView() 												.environmentObject(model.document!) 								} else { 										EmptyView() 								} 						}) 						 						#elseif os(macOS) 						Text("macOS NSDocumentController? Stub here.") 						#else 						fatalError("OS not supported.") 						#endif 				} 				.edgesIgnoringSafeArea(.all) 		} } // MARK: - SwiftUI Interface struct RepresentedUIDocumentBrowser { 		 		@Binding var isPresented: Bool 		@Binding var configuration: Configuration 		 		let supportedContentTypes: [UTType]? = nil 		 		func dismissView() { 				isPresented = false 		} } extension RepresentedUIDocumentBrowser { 		public struct Configuration { 				 				var allowsDocumentCreation = true 				var allowsPickingMultipleItems = false 				var shouldShowFileExtensions = false 				 				var viewTintColor: UIColor = .systemOrange 		} } // MARK: - UIViewControllerRepresentable extension RepresentedUIDocumentBrowser: UIViewControllerRepresentable { 		 		typealias UIViewControllerType = CustomUIDocumentBrowserViewController 		 		func makeCoordinator() -> Coordinator { 				Coordinator(parent: self) 		} 		 		func makeUIViewController(context: Context) -> CustomUIDocumentBrowserViewController { 				 				let vc = CustomUIDocumentBrowserViewController(forOpening: supportedContentTypes) 				 				vc.delegate = context.coordinator 				 				 				updateUIViewController(vc, context: context) 				 				return vc 		} 		 		func updateUIViewController(_ uiViewController: CustomUIDocumentBrowserViewController, context: Context) { 				let vc = uiViewController 				 				vc.allowsDocumentCreation = configuration.allowsDocumentCreation 				vc.allowsPickingMultipleItems = configuration.allowsPickingMultipleItems 				vc.shouldShowFileExtensions = configuration.shouldShowFileExtensions 				 				vc.view.tintColor = configuration.viewTintColor 				 		} 				 } // MARK: - UIDocumentBrowserViewController Subclass extension RepresentedUIDocumentBrowser { 		class CustomUIDocumentBrowserViewController: UIDocumentBrowserViewController { 				// Customizations 		} } // MARK: - UIDocumentBrowserViewControllerDelegate extension RepresentedUIDocumentBrowser { 		class Coordinator: NSObject, UIDocumentBrowserViewControllerDelegate { 				 				var parent: RepresentedUIDocumentBrowser 				 				init(parent: RepresentedUIDocumentBrowser) { 						self.parent = parent 				} 				 				// MARK: Create New 				func documentBrowser(_ controller: UIDocumentBrowserViewController, 														 didRequestDocumentCreationWithHandler importHandler: @escaping (URL?, UIDocumentBrowserViewController.ImportMode) -> Void) { 				} 				 				func documentBrowser(_ controller: UIDocumentBrowserViewController, 														 didImportDocumentAt sourceURL: URL, 														 toDestinationURL destinationURL: URL) { 				} 				 				func documentBrowser(_ controller: UIDocumentBrowserViewController, 														 failedToImportDocumentAt documentURL: URL, 														 error: Error?) { 				} 				 				// MARK: Select 				func documentBrowser(_ controller: UIDocumentBrowserViewController, 														 didPickDocumentsAt documentURLs: [URL]) { 						 				} 				 				// MARK: UIActivity 		} }
1
0
1.4k
Aug ’20
ReferenceFileDocument DOES NOT saving!
The reference file document does not trigger any save action upon objectWillChange, assuming this is what trigger the write mechanism. I've tested both using a simple String as the Snopshot type. As well as my production document model which is an ObservableObject. Is it a bug? Or can Apple engineer provide a working example using ReferenceFileDocument? version: XCode 12 beta 6
3
0
1.9k
Aug ’20
XCode 12 Beta 5 Document App using the default template in simulator NOTHING happens after click the create/add document button.
XCode 12 Beta 5 Document App Create project using the cross-platform document based app. Run for example iPhone Pro 14.0 simulator. The document UI is shown. Then click the add or create document. NOTHING happens after click the create/add document button. 2020-08-22 17:40:39.269578+0800 XCodeBeta5Doc[21402:486016] libMobileGestalt MobileGestaltCache.c:38: No persisted cache on this platform. 2020-08-22 17:40:40.406663+0800 XCodeBeta5Doc[21402:486010] [AXRuntimeCommon] Unknown client: XCodeBeta5Doc
3
0
1.1k
Aug ’20
How to use double/triple columns navigation style in SwiftUI document-based app?
How to use double/triple columns navigation style in SwiftUI document-based app? The problem is that the DocumentGroup() itself, seems already a NavigationView. In a non-document-based app, we can simply achieve this using three views within a navigation view. However, this is not the case for DocumentGroup. The views will be "VStack-ed". I've also tried setting the navigation view style as double column, which also failed. Any workaround? @main struct SomeApp: App {     var body: some Scene {         WindowGroup {             ContentView()         }     } } struct ContentView: View {     var body: some View {         NavigationView { LeftPanelView() MidPanelView() RightPanelView()         }     } }
3
0
1.8k
Aug ’20
Modifier is unavailable that setting a custom view as navigation title, deprecated or bug?
As shown in the documentation, this method is marked available for iOS 14+ [Beta]. Configures the view’s title for purposes of navigation, using a custom view. func navigationTitle<V>(_ title: () -> V) -> some View where V : View However, when use it in a view, the compiler warns it is not available. body: some View { Text("Hello, world!") .navigationTitle { SomeCustomView() // Or even Text("some title") } } Is it a bug or a removed api with outdated documentation?
5
0
929
Aug ’20