Popovers icon indicating copy to clipboard operation
Popovers copied to clipboard

Code is for iOS only

Open aehlke opened this issue 1 year ago • 4 comments

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

aehlke avatar Jul 10 '22 02:07 aehlke

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

aheze avatar Jul 10 '22 03:07 aheze

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

aehlke avatar Jul 10 '22 16:07 aehlke

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

aheze avatar Jul 10 '22 22:07 aheze

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 avatar Jul 10 '22 22:07 aehlke

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

aehlke avatar Dec 04 '22 13:12 aehlke

@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 avatar Dec 04 '22 16:12 aheze

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

aehlke avatar Dec 04 '22 23:12 aehlke