Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Swift Cookbook
  • Table Of Contents Toc
Swift Cookbook

Swift Cookbook - Third Edition

By : Keith Moon, Chris Barker, Daniel Bolella, Nathan Lawlor
5 (3)
close
close
Swift Cookbook

Swift Cookbook

5 (3)
By: Keith Moon, Chris Barker, Daniel Bolella, Nathan Lawlor

Overview of this book

Unlock the full potential of Swift and elevate your iOS development skills with this new edition of Swift Cookbook, highlighting the latest features in Swift 5.9. This cookbook will take your Swift programming skills to the next level, boosting your productivity and efficiency step by step through a plethora of practical recipes. Although this book is primarily for experienced iOS developers, it provides an introductory overview of Swift 5.9, including its basic building blocks, syntax, and the functionalities of Swift constructs, to get you warmed up. Once you’ve mastered the fundamentals, you’ll get down to business. Unless you’re completely new to Swift, this recipe-based guide doesn’t need to be read in order; you can jump to whichever topic takes your fancy, from UIKit and SwiftUI to advanced UI techniques, from Swift’s control flow and generics to machine learning with Vision, CoreML, and augmented reality with ARKit. By the end of this book, you’ll be fully up to speed with Swift’s capabilities and be able to develop amazing applications across a wide variety of domains.
Table of Contents (15 chapters)
close
close

Declarative syntax

With the introduction of SwiftUI comes a more modern coding paradigm called declarative syntax. In this section, we’ll take a look at what exactly declarative syntax is and how it compares to the style of syntax we might be used to seeing already.

Getting ready

For this section, you’ll need the latest version of Xcode available from the Mac App Store.

How to do it…

  1. Open Xcode and select File | New | Playground, then select Blank in order to open a new playground canvas to work from.
  2. Once that’s open, add in the following syntax:
    import PlaygroundSupport
    import SwiftUI

    We’ve seen the first import statement before, so it should be familiar. The next one is for SwiftUI—pretty self-explanatory as to why we need this.

  3. Now, let’s create a view in SwiftUI by adding the following code:
    struct MyView: View {
         var body: some View {
            ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Swift Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon