Hi there,
I'm trying to migrate my app to using the UIDocumentViewController so I can use the new launch experience. My app exports a custom file type and uses UIDocument + UIDocumentBrowserViewController.
I tried creating a UIDocumentViewController and making it the root view of my app but it doesn't recognise my custom document type.
class Document_VC: UIDocumentViewController {
var storyCardsDocument: PlotCardDocument? {
self.document as? PlotCardDocument
}
override func viewDidLoad() {
super.viewDidLoad()
configureViewForCurrentDocument()
}
override func documentDidOpen() {
configureViewForCurrentDocument()
}
func configureViewForCurrentDocument() {
guard let document = storyCardsDocument,
!document.documentState.contains(.closed)
&& isViewLoaded else { return }
print("Document opened: \(document.fileURL)")
}
}
The app opens but when I navigate to a document made in a previous version of the app it is greyed out. I also don't see a 'New' button in the launcher view.
To try and see what I was doing wrong, I tested the markdown app sample code. When I make the UIDocumentViewController the root and try to open or create a new markdown document I get the following error:
no document class found. Define the correct UIDocument subclass with the key UIDocumentClass in the info.plist's CFBundleDocumentTypes dictionary.
Post
Replies
Boosts
Views
Activity
Hello there,
Does the UNNavigationController have to be the rootViewController to get the automatic conversion to an NSToolBar? For example, I have a UITabBarController which contain several views, each with their own UINavigationController but they are not converting to NSToolBars. Is this a beta 2 limitation?
Also, the sample code linked for session wwdc2022-10076 won’t compile for macOS vis Catalyst. https://developer.apple.com/documentation/uikit/app_and_environment/supporting_desktop-class_features_in_your_ipad_app
Thanks,
Matt
Hi there,
I've setup scene-based state restoration for my iPhone/iPad app and it works perfectly.
In func sceneWillResignActive(_ scene: UIScene) I create an NSUserActivity object and assigned it to the scene.userActivity
I then return scene.userActivity from func stateRestorationActivity(for scene: UIScene) -> NSUserActivity?
The first issue I'm facing with Catalyst is func sceneWillResignActive(_ scene: UIScene) is being called after func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? so the restoration activity is never set.
I tried setting the scene.userActivity in the func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? function and it seemed to work insomuch as I can see there is an NSUserActivity created. Even so, session.stateRestorationActivity is nil when func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) is called.
I've disabled the "Close windows when quitting app" option in System Preference > General. I also noticed a post somewhere suggesting you wait for the app to disappear from Activity Monitor before relaunching. I've tried this to no avail.
Hi there,
I'm using override func buildMenu(with builder: UIMenuBuilder) to add some menu items (with keyboard shortcuts) to a Catalyst app.
I'm also using override func validate(_ command: UICommand) to enable/disable the menus selectively.
All is working wonderfully except for one situation.
My custom menu items are disabled when presenting a view controller as UIModalPresentationStyle.pageSheet
If I change to present as a fullscreen modal everything works again. The command also work when I build to iPad.
Any idea how to get UIKeyCommands to work when presenting a sheet style modal view controller on macOS?
Thanks in advanced.