I tried to create a page-based Apple Watch app.
As far as I can see, you can create a fixed number of pages for your app in the storyboard.
So I just wonder if there is any way to dynamically programmatically create the pages for your app based on the loaded data?
I.e: a newspaper app in which users can swipe left and right to switch to different articles.
Thanks
The Dynamic watch face displays photos from your recent Memories, and it updates when you have new ones.
watchOS 9 is available as a free software update starting today for Apple Watch Series 4 or later paired with iPhone 8 or later and iPhone SE (2nd generation) or later, running iOS 16. For more information, visit apple.com/watchos/watchos-9/.
Now with watchOS 9, developers have access to a new API to implement a share sheet in their Apple Watch apps. The feature will work pretty much the same way in third-party apps, showing the user options to share content through apps like Messages and Mail.
You can present page based navigation from code. You can specify as many pages as you want, but those pages has to be designed in the Storyboard
func presentControllerWithNames(names: [AnyObject], contexts: [AnyObject]?) // modal presentation of paged controllers. contexts matched to
Example
Present Page
Interfaces for objects. This code show page for every object
let objects = ["1", "2", "3", "4", "5"]
let controllers = Array(count: objects.count, repeatedValue: "Page")
presentControllerWithNames(controllers, contexts: objects)
Present different Interface for different object object.
let objects = [1, 2, 3, 4, 5]
let controllers = objects.map { object in object % 2 == 0 ? "Even-Page" : "Odd-Page" }
presentControllerWithNames(controllers, contexts: objects)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With