Getting Started with SwiftUI

In previous chapters, you created the User Interface (UI) for the Let's Eat app using storyboards. The process involved dragging objects representing views to a storyboard, creating outlets in view controller files, and connecting the two together.

This chapter will focus on SwiftUI, an easy and innovative way to create a user interface across all Apple platforms. Instead of using storyboards, SwiftUI uses a declarative Swift syntax, and works with new Xcode design tools to keep your code and design in sync. Features such as Dynamic Type, Dark Mode, localization, and accessibility are automatically supported.

In this chapter, you will build a new version of the Restaurant Detail screen using SwiftUI. Since SwiftUI is very different from storyboards and is very early in its development, you will not be modifying the LetsEat app you have been working on. You will create a new SwiftUI Xcode project instead.

You'll start by adding and configuring text views to a screen. Next, you'll learn how to combine views using stacks. After that, you'll learn how to add an image view to the screen and configure its appearance, and learn how to use UIKit and SwiftUI views together by adding and configuring a map view to the screen. Finally, you'll create the Restaurant Detail screen by combining all the views you created earlier.

By the end of this chapter, you'll have learned how to use SwiftUI to create a screen containing text views, stacks, image views, and UIKit views, which you can then use for your own projects.

The following topics will be covered:

  • Creating a SwiftUI Xcode project
  • Working with text
  • Combining views using stacks
  • Working with images
  • Using UIKit and SwiftUI views together
  • Composing the Restaurant Detail screen
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.20.56