Giving back with GitHub - Putting the Open Source back in iOS
My experience helping take an in house Swift library and making it into an Open Source framework available on GitHub and Package Management repositories like Cocoapods. Any questions or feedback appreciated @madhavajay
Frameworks Libraries and Examples • Wikis, Issues, Pull Requests, Gists • APIs, High Availability, The best VCS - Git • Massive Community • Even Apple! - github.com/apple/swift
You thought of a cool feature to add to your fav repo • You found a in someone’s code and want to rub it in fix it for them • You wrote that cool script to automate something and decided to make someone else’s life suck less! • Balance your $ git karma ☯ - every time you $ git pull, without $ git push • $ git commit public code makes you a better programmer
commit, push, pull request, merge • Dependency Management: Cocoapods, Carthage and SPM • Free CI Testing with Travis CI • Wiki and GitHub Pages • MarkDown for README • Cool Badges like shields.io • Integrations: JIRA, Travis, Slack, Gitter and More!
files that will be compiled • Tests, you know… has the tests you better write! • PM: Package.swift, Project.podspec • Config: .swiftlint.yml, .travis.yml, .gitignore • Resources / Fixtures, keep isolated • Remove all other crud and aim for 2 .plist files, watchOS currently requires editing .xcodeproj
can get a default NSColor from a property func testNSColorDefaultValue() { let redColor = PalauDefaults.ensuredNSColorValue.value let redColor2 = PalauDefaults.whenNilledNSColorValue.value assert(CGColorEqualToColor(redColor!.CGColor,NSColor.redColor().CGColor)) assert(redColor2 == NSColor.redColor()) } #else // test if we can get a default UIColor from a property func testUIColorDefaultValue() { let redColor = PalauDefaults.ensuredUIColorValue.value let redColor2 = PalauDefaults.whenNilledUIColorValue.value // UIColor sometimes returns different versions UIDeviceRGBColorSpace assert(CGColorEqualToColor(redColor!.CGColor,UIColor.redColor().CGColor)) assert(redColor2 == UIColor.redColor()) } #endif
• Create a Target for each Platform • iOS, macOS, tvOS, watchOS (no tests yet) • Write tests with Platforms in Mind #if arch(x86_64) || arch(arm64) func test64bitOnly () { let reallyBigInt = 9_223_372_036_854_775_807 checkValue(&PalauDefaults.intValue, value: reallyBigInt) • Add Platform tests to your .travis.yml file DESTINATION="OS=9.2,name=Apple TV 1080p"
.travis.yml for Xcode Testing • shields.io • Center your Logo with <p align=“center”><img></p> • - [x] Cool Checkbox Bullet Points • ```swift - highlights your swift code
Make sure your shell files are chmod +x - Name your targets correctly - Use swiftlint via install.sh script - Don’t output characters like ⡍⠜⠇⠑ or you might break xcpretty
'~/code/Pods/' - Don’t forget to bump your versions (1 .plist for all) - $ pod lib lint - $ git tag ‘1.0.3’; git push —tags - Wait for Travis CI tests - $ pod trunk push NAME.podspec