Skip to content

Instantly share code, notes, and snippets.

@gokselkoksal
Last active April 23, 2020 20:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gokselkoksal/93aa1cee702541c979027b71d3eff7f0 to your computer and use it in GitHub Desktop.
Save gokselkoksal/93aa1cee702541c979027b71d3eff7f0 to your computer and use it in GitHub Desktop.
SwiftMigrationJustifications

Number of Lines in Swift Files

Might be handy when estimating work.

  1. Open Terminal
  2. cd to your Xcode project
  3. Execute the following when inside your target project:

Number of lines:

find . -name "*.swift" -print0 | xargs -0 wc -l

Credit: https://gist.github.com/Tokuriku/f7d6ce5a68d2154c28b0

Number of lines without whitespace and comments:

total=0; for file in $(find . -name “*.swift”); do export file; export count=“$(egrep -v ‘^$|^\s*$|\/\/.*’ ${file} | wc -l)“; echo ${file} ${count}; total=$((count + total)); done; echo $total

Credit: @vellori

Justifications for Swift 2.2 to Swift 3 Migration

  • We can't use iOS 9 devices while debugging and all the devices we'll purchase as new will come with iOS 10.
  • Enables Xcode 8 which will let us develop faster. (more tools = speed)
  • Enables lots of open source frameworks that can be very useful for us. No open source developers support Swift 2.2 for their new frameworks.
  • Lets us update dependencies that are not currently maintained for Swift 2.2. These dependencies are years-old currently and might have serious bugs which are fixed in the latest version which only supports Swift 3+.
  • Apple occasionally disables app submissions using certain versions of Xcode. This is due to compatibility reasons. Xcode 9 is the latest version and Xcode 10 is on the way for mid-2018 release. Using Xcode 8 might be OK for now but Xcode 7 is risky as will be 4 versions behind soon. It's recommended to support only latest 2 major releases of a software...
  • Documentation from Apple provides nice examples about how we should use the latest Xcode and SDK versions: https://developer.apple.com/library/content/qa/qa1806/_index.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment