Streaming File Reader in Swift

If you need to read a very large file you’ll want to stream it so you’re not loading the entire thing into memory at once. Here’s a snippet for doing that.

Fibonacci Sequence Explained

If you’re not familiar with the Fibonacci sequence, the gist is that each number is the sum of the two numbers before it, starting from 0 and 1.

How to Perform a Binary Search in Swift

The basic idea behind a binary search is that you take the midpoint of a sorted array and compare that with the item you’re searching for. The key thing to remember is that the array must be sorted. The steps are:

Intro to Terminal Aliases

Terminal aliases are just shortcuts for the terminal so you can type less. For example, if you use git on the command line you probably type git status a lot. Well, with an alias, you can do something like gs instead. Here’s how you do it:

Location of Xcode Derived Data

Usually Cmd + Shift + K will do a clean but if not, the derived data is in ~/Library/Develop/Xcode/DerivedData cd into that directory and do rm -r [directory name]

Published
Categorized as hints Tagged