Starting an App in Swift

This post describes the simple procedures to start a minimalistic app in Swift.

  1. Launch XCode, and select Create a new Xcode project.

    Create a new Xcode project

  2. Select Single View App in the view that follows, and click next.

    Single View App

  3. Key in the Product Name and other information and click next. If Team is left as None, then this project cannot run on phones, but can only run on simulators.

    Project Info

  4. On the upper left corner of the IDE, pick a simulator (e.g. iPhone 8 Plus), and click the play button to build and run. It might take some time to boot the simulator. As the app runs on the simulator, you will see a mostly white screen, and some log information at the bottom of the IDE.

    IDE

    Simulator

That’s it! You’ve started a minimalistic app in Swift, and had it running on a simulator. the viewDidLoad() in ViewController.swift is the first function that gets called. You may add print("view loaded.") in this function, and see the message printed in the log.

You may follow this video to add buttons and let your app play music. To learn more about the Swift language, I recommend you watch this video and read its cheat sheet.

Happy coding!