-
Notifications
You must be signed in to change notification settings - Fork 378
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
support swift package manager #338
Conversation
…s with both example apps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not a required reviewer, but I'll approve nonetheless because the changes here align with the ones I made in prior passes at this task and I've pulled this branch into a real project and confirmed the package builds, gets linked, and runs with access to its resources (the close button "x").
Co-authored-by: Zev Eisenberg <[email protected]>
@Cam and/or @ZevEisenberg, no pressure, but i've love to merge this and #336, then release as v5.1... |
@@ -12,6 +12,9 @@ | |||
@implementation NSBundle (NYTPhotoViewer) | |||
|
|||
+ (instancetype)nyt_photoViewerResourceBundle { | |||
#if SWIFT_PACKAGE | |||
return SWIFTPM_MODULE_BUNDLE; | |||
#endif | |||
static NSBundle *resourceBundle = nil; | |||
static dispatch_once_t onceToken; | |||
dispatch_once(&onceToken, ^{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the name used below still accurate given the change from NYTPhotoView.bundle
to Media.xcasssets
in the podspec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, because the contents of Media.xcassets are copied into NYTPhotoViewer.bundle/Assets.car
tested with BP:
po [UIImage imageNamed:@"NYTPhotoViewerCloseButtonX" inBundle:resourceBundle compatibleWithTraitCollection:nil]
<UIImage:0x600002a24c60 named(org.cocoapods.NYTPhotoViewer: NYTPhotoViewerCloseButtonX) {15, 15}>
tested visually:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test with actool
:
(ha, i wish i could figure out how to get actool
to list or extract contents!)
but we can see the names in the file...
$ strings $B/Assets.car | grep -i closebutton
NYTPhotoViewerCloseButtonX
NYTPhotoViewerCloseButtonXLandscape
[email protected]
[email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but please update the "TK" in the readme before merging
@@ -23,6 +23,18 @@ Clone this locally, then in your local workspace of the `NYTPhotoViewer` repo, r | |||
|
|||
## Installation | |||
|
|||
### Swift Package Manager | |||
|
|||
NYTPhotoViewer may be installed via SPM, by pointing at this repo's URL and.. (more TK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"more TK"
Based on @mattpolzin's #333, but with the extra step of rearranging sources and resources to avoid needing symlinks.
Couldn't figure out how to add unit-test support, so left it out.
Addresses issue #332.