Skip to content

Conversation

@graemeasher
Copy link

Hi Stuart & Viktor - I have created an example of a MacOS implementation of the Simple Counter example (.examples/simple_counter/macOS). I chatted with Viktor on Zulip and he said to submit a PR. I see an existing issue related to this (Crux with macOS and SwiftUI #248) in case this Closes #248.

I followed your existing docs (latest_master) using the iOS - Swfit and SwifUI - using XcodeGen to build this macOS example. There are only two difference from the iOS instructions:

  1. Within the project.yml I changed the bundleIdPrefix slightly to avoid conflict with the iOS example. I also removed a handful of properties that do not pertain to macOS.
  2. Within the SimpleCounter.xcodeproj > General > Supported Destinations - I updated this to only use the Mac + macOS SDK as the destination.

I have tested using deploymentTargets of 15 (matches existing iOS example) as well as 26 and everything worked fine. One issue I did encounter was that I could not have both the iOS and macOS projects open at the same time in Xcode as they both reference the same shared binary and this would cause a build error for whichever of the two projects was opened second in Xcode. Quitting Xcode and reopening one project at a time resulted in clean builds.

Copy link
Collaborator

@charypar charypar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for doing this! When I'm back at my desk I'll try running it as well, but it looks like it will work.

@StuartHarris
Copy link
Member

Thank you for this! I'll also look shortly and we'll get this in.
I'm starting to go through and clean up all the examples, and moving the relevant build and codegen responsibilities to the shells. This means iOS and MacOS will each get their own Swift packages, so that clash will go.

@graemeasher
Copy link
Author

@StuartHarris - Sounds good. I saw the new codegen being used in the counter-next example but built this using the previous method as the rest of the simple-counter used that. I look forward to the docs on the updated approach as it looks like a nice evolution for Crux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crux with macOS and SwiftUI

3 participants