giving back with github - putting the open source back in ios
TRANSCRIPT
![Page 1: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/1.jpg)
Giving back with GitHub
Putting the Open Source back in iOS
@madhavajay
![Page 2: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/2.jpg)
The Why
• Elmar: Hey checkout this thing I made called PalauDefaults
• Me: WTF is this? 🤔 🙄 nope 😳
• Elmar: *Tries to explain*
• I hear: Blah blah blah Generics, blah blah Type Safety, blah blah, monad-flatMap?
• Elmar: Lets Open Source it! 🤔
• Me: 😎
![Page 3: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/3.jpg)
The What
• Why GitHub
• What makes a good iOS GitHub repo
• Multi Platform Support
• Testing with Travis CI
• Package Manager Support
• Finishing Touches
![Page 4: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/4.jpg)
GitHub is the center of the open source world!
• Frameworks Libraries and Examples
• Wikis, Issues, Pull Requests, Gists
• APIs, High Availability, The best VCS - Git
• Massive Community
• Even Apple! - github.com/apple/swift
![Page 5: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/5.jpg)
Reasons to $ git commit to the GitHub Community
• 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
![Page 6: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/6.jpg)
You want your profile to suck less!
![Page 7: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/7.jpg)
Developing on iOS with GitHub rocks!
• branch, code, test!, 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!
![Page 8: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/8.jpg)
If there’s a git tree in the GitHub forest, but no one clones it; is it
even on GitHub?
Ancient Chinese Proverb:
![Page 9: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/9.jpg)
How NOT to do your README.md
![Page 10: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/10.jpg)
How NOT to do your README.md
• No Usage or Install Instructions
• No Tests 😱
• No Versioning or Dependency Info
• No Code Syntax Highlighting
• No License and Credits
• = NO $ git clone
![Page 11: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/11.jpg)
These are not the Repos
you are looking for
![Page 12: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/12.jpg)
Imitation is the sincerest form of flattery
![Page 13: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/13.jpg)
Anatomy of an iOS Framework
![Page 14: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/14.jpg)
Anatomy of an iOS Framework
• Sources (with s) contains 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
![Page 15: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/15.jpg)
Swift Supporting Multiple Targets
#if os(OSX) // test if we 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
![Page 16: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/16.jpg)
Swift Supporting Multiple Targets
* It's not really that hard
• 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"
![Page 17: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/17.jpg)
Cool things I stole learn't from other GitHub repos
• .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
![Page 18: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/18.jpg)
Travis CI File .travis.ymllanguage: objective-c
install:
- ./Resources/install_swiftlint.sh
env:
global:
- IOS_FRAMEWORK_SCHEME="Palau iOS"
- WATCHOS_FRAMEWORK_SCHEME="Palau watchOS"
script:
- swiftlint
- xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c;
* Modified for slide
![Page 19: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/19.jpg)
Xcode Project Target Setup
* Modified for slide
![Page 20: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/20.jpg)
Travis CI File .travis.yml
- Run xcodebuild locally first
- 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
![Page 21: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/21.jpg)
build passing: Поехали!
![Page 22: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/22.jpg)
Carthage Share Schemes
![Page 23: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/23.jpg)
Carthage Product Name
![Page 24: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/24.jpg)
CocoaPods .podspec• Pod::Spec.new do |s|
• s.name = "Palau"
• s.version = "1.0.3"
• s.summary = "Palau: NSUserDefaults with Wings!"
• s.homepage = "https://github.com/symentis/Palau"
• s.screenshots = "palau-logo.png"
• s.license = "Apache License, Version 2.0"
• s.authors = { "[email protected]" }
• s.ios.deployment_target = "8.0"
• s.tvos.deployment_target = "9.0"
• s.watchos.deployment_target = "2.0"
• s.source_files = "Sources/*.swift"
* Modified for slide, not v1 compatible
![Page 25: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/25.jpg)
CocoaPods .podspec
- Test locally using:
pod 'Name', :path => '~/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
![Page 26: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/26.jpg)
CocoaPods Quality Index
* Modified for slide, not v1 compatible
< Sure… 😂
![Page 27: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/27.jpg)
SPM Swift Package Manager
![Page 28: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/28.jpg)
SPM Package.swift
import PackageDescription
let package = Package( name: "Palau" )
* This will change VERY soon!
![Page 29: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/29.jpg)
Cool Badges shields.io
* Modified for slide
https://travis-ci.org/symentis/Palau.svg?branch=master
https://img.shields.io/cocoapods/v/Palau.svg
https://img.shields.io/badge/Carthage-compatible-4BC51D.svg
https://img.shields.io/cocoapods/p/Palau.svg
https://img.shields.io/badge/pure-swift-ff3f26.svg
https://img.shields.io/badge/[email protected]
https://img.shields.io/badge/[email protected]
![Page 30: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/30.jpg)
Star if you Liked this
* This will change VERY soon!
![Page 31: Giving back with GitHub - Putting the Open Source back in iOS](https://reader031.vdocument.in/reader031/viewer/2022030401/58ee6f9e1a28ab1f658b45c1/html5/thumbnails/31.jpg)
Thanks Munich iOS Meetup
import Thanks
assert( user.getsPizza == user.starredRepo )
print("See you on GitHub 😎”)
* This will change VERY soon!
@madhavajay http://symentis.com/