Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code is for iOS only #44

Merged
merged 1 commit into from
Dec 4, 2022
Merged

Code is for iOS only #44

merged 1 commit into from
Dec 4, 2022

Conversation

aehlke
Copy link
Contributor

@aehlke aehlke commented Jul 10, 2022

I thought this was a helpful fill-in for porting my macOS SwiftUI app to iOS, however I'm unable to include this SPM package in a project which builds for both macOS and iOS because of how SPM works. Specifying iOS in your Package.swift does not limit the build to to only iOS. Please let me know if you know a better way to accomplish this. Thanks

@aheze
Copy link
Owner

aheze commented Jul 10, 2022

Hmm this is slightly weird but there might not be any other way, I'll look around. Are you using a universal app template?

@aehlke
Copy link
Contributor Author

aehlke commented Jul 10, 2022

No, producing my own from scratch... but generally SwiftUI with macOS + iOS multi-target with SPM is definitely now the way forward, with how much SwiftUI has matured and how much Apple has lowered the bar for targeting macOS natively without Catalyst. Your lib is fantastic as a kind of polyfill for macOS popover, I'd love to see its other features ported to macOS paradigm equivalents someday

@aheze
Copy link
Owner

aheze commented Jul 10, 2022

Hmm ok. You might be able to enable Popovers for specifically the iOS target then — go to your project settings, then remove Popovers under the macOS target (in Frameworks, Libraries, and Embedded Content):

Popovers is under Frameworks, Libraries, and Embedded Content

@aehlke
Copy link
Contributor Author

aehlke commented Jul 10, 2022

I'm using Popovers from my own SPM package, which is the only one that appears in that list (with Popovers embedded inside it). I think Apple has changed the approach for excluding packages from targets

@aehlke
Copy link
Contributor Author

aehlke commented Dec 4, 2022

Please accept this PR, I can update it if you agree - this is definitely the current standard approach for libraries and without this, the library is unusable in cross-platform libs or apps

@aheze
Copy link
Owner

aheze commented Dec 4, 2022

@aehlke it just seems kind of weird to add if os in every file... I'll accept it for now and look into it more.

@aheze aheze merged commit c38c8fa into aheze:main Dec 4, 2022
@aehlke
Copy link
Contributor Author

aehlke commented Dec 4, 2022

Agree it's weird but since SPM and Xcode have no other provision for excluding source per platform, it's what every lib I've seen does (except for ones that can't be added outside iOS or macOS-exclusive projects). We must wait on Apple for a better solution. Thank you very much

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.

2 participants