Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2 Tools An iOS Developer Needs To Know

2 Tools An iOS Developer Needs To Know

Feli Bernutz

November 24, 2018
Tweet

More Decks by Feli Bernutz

Other Decks in Programming

Transcript

  1. Watch the talk4 from JP Simard from Realm ON THE

    IDEAS BEHIND SWIFTLINT 4 https://academy.realm.io/posts/slug-jp-simard-swiftlint/
  2. #1

  3. INSTALLATION ▸ With HomeBrew (global level) brew install swiftlint ▸

    With CocoaPods (project level) pod 'SwiftLint' ▸ Install CocoaPods with sudo gem install cocoapods
  4. #2

  5. #3

  6. 1. STYLISTIC RULES attributes // before @IBAction func showSomething() {

    ... } // after @IBAction func showSomething() { ... }
  7. 4. CODE SMELLS ▸ force unwrap ▸ force cast ▸

    force try ▸ number of function parameters
  8. 4. CODE SMELLS force_unwrapping // before navigationController!.pushViewController(loginVC, animated: true) //

    after guard let navController = navigationController else { return } navController.pushViewController(loginVC, animated: true)
  9. Type of Rules 1. Stylistic Rules 2. Hygenic Rules 3.

    Convention Rules 4. Code Smells 5. Cyclomatic Complexity
  10. 5. CYCLOMATIC COMPLEXITY func complexFunction() { let i = 0

    let array = [] if true { if i != 0 { if false {} } else { if !array.isEmpty && false { for element in array { guard i >= 0 && i < 42 else { return } if i >= 42 { switch i { case 42: break case 43: break case _ where i >= 44: print(i) default: break } } } } } } }
  11. Type of Rules 1. Stylistic Rules 2. Hygenic Rules 3.

    Convention Rules 4. Code Smells 5. Cyclomatic Complexity
  12. fastlane3 is a tool for iOS and Android developers to

    automate tedious tasks 3 https://github.com/fastlane/fastlane
  13. WHY FASTLANE? ▸ saves time ▸ open source ▸ easy

    setup ▸ integrate with CI systems
  14. #1

  15. INSTALLATION ▸ Using RubyGems sudo gem install fastlane -NV ▸

    Using Homebrew brew cask install fastlane
  16. #2

  17. #3

  18. [22:22:32]: ▸ ✓ testSelectRowShouldSetCorrectSelectedSetting (0.001 seconds) [22:22:32]: ▸ Executed 32

    tests, with 0 failures (0 unexpected) in 0.162 (0.182) seconds [22:22:33]: ▸ 2018-11-19 22:22:33.198 xcodebuild[53785:4181855] [MT] IDETestOperationsObserverDebug: 24.020 elapsed -- Testing started completed. [22:22:33]: ▸ 2018-11-19 22:22:33.198 xcodebuild[53785:4181855] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start [22:22:33]: ▸ 2018-11-19 22:22:33.198 xcodebuild[53785:4181855] [MT] IDETestOperationsObserverDebug: 24.020 sec, +24.020 sec -- end [22:22:33]: ▸ Test Succeeded +--------------------+----+ | Test Results | +--------------------+----+ | Number of tests | 32 | | Number of failures | 0 | +--------------------+----+ +------+---------------------+-------------+ | fastlane summary | +------+---------------------+-------------+ | Step | Action | Time (in s) | +------+---------------------+-------------+ | 1 | Verifying fastlane | 0 | | | version | | | 2 | number_of_commits | 0 | | 3 | run_tests | 62 | +------+---------------------+-------------+ [22:22:39]: fastlane.tools finished successfully ! ✔ ~/develop/_private/cineaste-ios [master|⚑ 11] 22:22 $
  19. Without fastlane it would be xcodebuild \ -workspace Minions.xcworkspace \

    -scheme "Testing" \ -sdk iphonesimulator \ -destination 'platform=iOS Simulator,name=iPhone X' \ test
  20. WHAT WE @ADORSYS USE FASTLANE FOR? ▸ run tests ▸

    build app ▸ make screenshots ▸ upload app to Testflight, AppStore or adorsys AppCatalog
  21. Felizia Bernutz ▸ @fbernutz ▸ @felibe444 ▸ ! iOS dev

    @adorsys 28.11.2018 – TH Nürnberg