If you need to have some data in an external file and read it in playgrounds, here’s how to do it in Xcode 11.3 using Swift 5.1.
Here’s a simple method for getting the reverse of a positive integer.
If you need to continue looping over an array after you’ve reached the end, you can use the modulo operator to start the index back at 0.
This is a very gentle introduction to fetching data from an external API in iOS. This tutorial is aimed at beginners and doesn’t assume any prior knowledge.
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.
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:
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: