Quite often while using iOS apps you come across many quirky animations such as an innovative loading symbol, a unique progress bar, a fancier calendar and many more. You may want to integrate all this into your app but have no idea how to build it.
That's where Cocoapods come into the picture. Cocoapods has many libraries, i.e. code written by other people, that are available for everyone to use. You don't have to code all of this from scratch. Just install the library, include it in your code, and you're good to go.
You can also read about Cocoapods more at its official website: CocoaPods.org.
You can search for Cocoapods on the official website. For example, if you want a progress bar for your app, just search for "progress bar", go through a few designs and see what you like best.
Previously, Apple made only one screen size for the iPhone. Today there are many different sized iPhones and iPads. Moreover, many apps support landscape mode as well.
If you try running the apps you created so far on different simulators, you'll notice that the alignment of your UI objects is different than what you designed. For example, try running your last project on different simulators ranging from iPhone 5s to iPhone 8 plus. You'll often notice objects that are off-center. Sometimes the objects shift left, and sometimes they shift right depending on the size of the iPhone or iPad you're trying to run it in.
Rather than creating different interfaces for each screen size, Apple came up with a system known as auto-layout. Auto Layout is a system of constraints, or UI rules, that govern the size and position of elements on the screen.
Let's see to how use auto-layout to make sure your apps look good on all the devices, regardless of the screen-size.
In this tutorial, you are going to learn how to sideload your apps onto your iPhones and iPads! The following steps are for the latest iOS and Xcode versions. Incase you have an older iPhone in which iOS cannot be updated, you'll have to do some minor changes to side-load your app.
During the sideloading steps, at various times, you may see a popup that will request your password for Keychain. It's essential that you enter your password and click Always Allow. This pop up might show up more than once, usually around 3-4 times. You must click Always Allowevery single time.
The reason for this is because Xcode is setting up your developer certificates and signing in the background. If at any point in this process you deny permission, you'll get an error that says Swift Sdtlib tool error and you will have to troubleshoot using these steps listed here: Swift Sdtlib tool error: Task failed with exit code 1.
In this exercise, you will be implementing a game known as Hotter or Colder. This exercise will give you a chance to (a) practice your Swift skills such as variables, if-statements, etc (b) practice your app building skills and (c) teach you about the TextField UI object. Also, by the end of it, you will have a really fun game to play when you're bored (and show to friends and family)!
Here's how the game works.
The app chooses a secret number at random between 1 and 100, and the user is asked to guess it.
If the guess is too low, the program should display "You're too cold". If the guess is too high, it shows "You're too hot".
This repeats till the user guesses the secret number.
In this tutorial, we will put everything we've learnt so far together to build our very own app from scratch. We will be building an app based on a classic kid's toy, the Magic 8-ball. Magic 8-ball is used to ask a yes/no question and upon shaking it, it gives out an answer.
You have already learnt about arrays and loops in previous tutorials. In this tutorial, we're going to dive deeper into these two topics.
Review of arrays
Array's are written within square brackets [ ]. Use the .count attribute to get number of elements inside the array and square brackets [index] to access data of that specific index. Remember the first element is at index 0.