Building this app for four platforms at once is interesting because code architecture choices I would make for one platform, I wouldn’t make for another. Toss in a dash of framework availability, and it can get complicated fast. I’m trying to strike a good balance between making forward progress and playing 4D chess with myself. 😄

Regardless, there’s definitely a big refactor in my future.

#SwiftUI #iOSDev #macOSDev #tvOSDev #iPadOSDev

@MrRooni May I ask what app you’re working on?

We wrote Kookin in SwiftUI and are using the same code base for all platforms too, so I know the struggle you’re going through 😅

@JagCesar It’s a fairly straightforward fitness app. Not too many views, and a constrained set of functionality. I could map out all the use cases across all the platforms and plan it all out ahead of time, but for a hobby project, where’s the fun in that? 😄

One of the things I have on my list is to lean more heavily into the composability of #SwiftUI views and break the large View structures down into their respective parts and reuse them in platform-specific layouts.

@MrRooni Cool! Looking forward to see some screenshots!

We decided to use #if os(…) to separate functionality between platforms. It’s nice to have a single `RecipeView`-file that works on all platforms, but our code has some #if os(…) that might make it a bit difficult to read.

@JagCesar Yeah, that’s a good call. For some of the frameworks that are available on more than one platform I’ve been using #if canImport(frameworkName)

@MrRooni yeah we use that one heavily too, with Core Spotlight for example. It’s unfortunate CoreSpotlight isn’t available on watchOS or tvOS.

Would make total sense to have app-content searchable system-wide on those platforms too. 🔍👀

Follow

@MrRooni @JagCesar Would love a Feedback or two about CoreSpotlight availability on watchOS. Details about how you’d use it would be super helpful!

@MrRooni @lorihc I’ll submit one tomorrow!

Having Spotlight available on my watch would frikkin awesome 🤩

@lorihc @MrRooni Here’s the feedback as promised FB11951323

Feel free to reach out if anything is unclear.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.