Skip to main content

Explore Swift, Xcode, and the Salesforce Mobile SDK for iOS

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain how Swift helps you write safe code.
  • Explain how Xcode is a unified development environment.
  • Identify when you’re ready to build an app using the Salesforce Mobile SDK for iOS.
  • Explain the primary features of the Salesforce Mobile SDK for iOS.

Challenge accepted. You saw the results of poor mobile app development in the woes of the competition. Now, it’s time to build your mobile app. Your CEO has your back. Your manager has your back. All that’s left is to get your hands on the right tools.

Swift: Speak the Language of Safety and Efficiency

Swift is the modern programming language for writing apps for Apple devices. It’s designed to be easy to learn and use. More importantly, it’s designed to make app development safer.

Are you ready to look at some code? Don’t worry if the following example doesn’t make much sense at first. We’ll do this together.

var customerName : String
var claimNumber : Int
customerName = “Julian”
claimNumber = 123456
customerName = claimNumber

The first thing to know is that when you get to the end, customerName = claimNumber, you have code that will not work. That’s right, this is poor code. How can the customer’s name be the claim number? Let’s go over how Swift knows this (as well as several other things about the code) and how it helps you catch errors as you build your own app.

First, Swift knows that in line 1, the customer name is supposed to be text, or string. This is noted by the declaration : String. Similarly, in line 2, Swift knows that the claim number is supposed to be a whole number, or integer, as defined by : Int. The act of declaring value types is called Initialization. It helps set the rules of how your values interact with one another.

Swift then runs a check on your code, making sure you’re using the types correctly. It prevents your code from running if they don’t match up. This is called Type Safety. customerName can never equal claimNumber because their types are a mismatch (string vs. integer).  

These are just a couple of basic security features of Swift. Yet they are powerful. When you put them together, you get a programming language that proactively helps you write safe code. 

Note

Swift can do other proactive things like predict what types you are using. You can explore this and more in Swift Essentials.

Xcode: IDE and Beyond

First off, what’s an Integrated Development Environment (IDE)? Typically, it’s a program that gives developers a collection of tools including source code editor, build automation, and debugging. Xcode provides these for all your Apple development. Then, it goes further. 

The Xcode interface.

It’s for all Apple devices—iPhone, iPad, Mac, Apple Watch, and Apple TV. Swift is included, as well as all the tools to build and debug in the modern language. You can also use entire, pre-built structures to refactor or transform your code with a simple command-click.

You get Playgrounds in Xcode, where you can build and test your skills in Swift in a safe environment. (There is ample opportunity to dive into Playgrounds in this trail.)

The device picker in Xcode with iPhone 8 selected.

There’s also device simulator, where you can build and review your app design across multiple devices, iOS versions, screen sizes, and more. All this makes for a truly unified developer experience tailored specifically for Apple development and Apple devices.

Get Ready for Mobile Development

Where does the Salesforce Mobile SDK for iOS come in? If you’re a developer who wants to use the Salesforce Mobile SDK for iOS, here’s a quick checklist to help you determine when you're ready to use it.

  • Your company is familiar with iOS development.
  • You want to build an experience tailored to your customers’ unique needs beyond what the Salesforce mobile app supports.
  • You want to use iOS device features such as on-device machine learning, augmented reality, geo-fencing, location, photography, and audio.

The insurance app your company wants to build checks all these and more—it’s high priority, you have the right support and an eager team, and you’re excited to learn new skills along the way.

Optimized for Swift

As you start working with the SDK, you notice a couple of things that make life easier.

Naming Conventions. Many of the classes, methods, and parameters are in Swift style. This makes it easy to build the integration and know how and where the data is moving.

Dynamic Updates. When you make metadata updates to your connected app in Salesforce (often with simple clicks), the UI dynamically changes for your iOS user. The app refreshes and you have the most up to date interface. This happens without the customer having to update the app itself. 

Let’s Get Started

You’re almost there. To get set up to develop with Swift, Xcode, and the Salesforce Mobile SDK for iOS, here are the prerequisites.

  • A device running macOS (a Mac), with High Sierra or greater.
  • An Apple Developer account. If you already have an Apple ID, you may link it to your developer account.
  • XCode.
  • Git, or a Git client.
  • The Salesforce Mobile SDK for iOS.

You can find links to sign up for your developer account and download the required tools in the Resources section below.

Ready? Complete the quiz below to earn your badge, explore the rest of Get Started with iOS App Development, build your skills with Swift and Xcode, and get hands-on with the insurance app.

Resources

Lernen Sie weiter kostenlos!
Registrieren Sie sich für einen Account, um fortzufahren.
Was ist für Sie drin?
  • Holen Sie sich personalisierte Empfehlungen für Ihre Karriereplanung
  • Erproben Sie Ihre Fähigkeiten mithilfe praktischer Aufgaben und Quizze
  • Verfolgen Sie Ihre Fortschritte nach und teilen Sie sie mit Arbeitgebern
  • Nutzen Sie Mentoren und Karrierechancen