-
Notifications
You must be signed in to change notification settings - Fork 138
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
Add Support for Swift Package Manager #85
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
s.source_files = '*.{h,m}' | ||
s.exclude_files = 'main.m', 'LetsMoveAppDelegate.{h,m}' | ||
s.public_header_files = 'PFMoveApplication.h' | ||
|
||
s.resources = '*.lproj' | ||
s.resources = 'Resources/*.lproj' |
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.
Update the Podfile to account for the relocated resources and to bump the version number.
@@ -7,4 +7,4 @@ | |||
// The contents of this file are dedicated to the public domain. | |||
|
|||
#import <Cocoa/Cocoa.h> | |||
#import <LetsMove/PFMoveApplication.h> | |||
#import "PFMoveApplication.h" |
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 had to make this a local #import to keep SPM happy.
#ifdef SWIFT_PACKAGE | ||
return SWIFTPM_MODULE_BUNDLE; | ||
#else |
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.
Ensure the resources can be located when building with SPM.
name: "LetMove", | ||
defaultLocalization: "en", | ||
platforms: [ | ||
.macOS(.v10_10), |
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.
This is the lowest macOS version that can be specified in Package.swift
.
.process("Resources") | ||
], | ||
publicHeadersPath: "include", | ||
cSettings: [.unsafeFlags(["-fno-objc-arc"])] |
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.
Disable ARC.
See inline comments for explanations of some of the less obvious changes.
I tried getting this to work without having to move the resources into their own folder, but the Package.swift
exclude
list doesn't seem to apply to resources and and I got SPM errors that I couldn't work out how to resolve any other way.SPM is also very particular about how the public headers are provided. I used an approach I've seen used in other Mac libraries which was to create a dedicated
includes
folder for SPM which contains symlinks to the relevant headers in their original locations.I also added instructions to the README (and while I was there I added instructions for CocoaPods and Carthage too.