Cart
Free Shipping in Australia
Proud to be B-Corp

Asynchronous Programming with SwiftUI and Combine Peter Friese

Asynchronous Programming with SwiftUI and Combine By Peter Friese

Asynchronous Programming with SwiftUI and Combine by Peter Friese


$136.49
Condition - New
Only 2 left

Asynchronous Programming with SwiftUI and Combine Summary

Asynchronous Programming with SwiftUI and Combine: Functional Programming to Build UIs on Apple Platforms by Peter Friese

Develop UI-heavy applications more easily, faster, and error-free. Based on several enhancements to the Swift language, SwiftUI takes a declarative approach to building UIs. Instead of imperatively coding the UI, this book will show you how to describe how you want your UI to look.

SwiftUI treats the UI as a function of its state, thereby making managing your app's state a lot easier. Change the underlying data model to redraw all parts of the UI that are connected to that particular slice of data. Likewise, easily update the underlying data model from the UI elements your data model is connected to. Combine is Apple's Functional Reactive Programming framework. It complements SwiftUI and other frameworks, such as the networking APIs, in a natural way. Using Combine, you can subscribe to events and describe data processing in a way that is free of side effects. This allows for an easier implementation of event-driven applications.

Using SwiftUI and Combine build more error-free apps in a shorter amount of time, targeting all of Apple's platforms (iOS, iPadOS, watchOS, macOS, tvOS) with little to no overhead.

By the end of the book you will have a solid understanding for architecting and implementing UI-heavy apps in a declarative and functional reactive way using SwiftUI, Combine, and async/await.

You will:

- Build simple and gradually more complex UIs in SwiftUI

- Understand SwiftUI's state management system

- Work with Combine and Swift's new async/await APIs to access the network and access other asynchronous APIs

- Architect and structure modern applications on Apple platforms using SwiftUI, Combine, and async/await


About Peter Friese

Peter Friese is a software engineer, author, speaker, and musician with a passion for helping developers build great apps. He works as a Developer Relations Engineer / Developer Advocate on the Firebase team at Google, where he focuses on helping developers build better apps using Firebase on iOS and other Apple platforms.

Peter shares his knowledge and experience through writing on his personal blog, peterfriese.dev, publishing videos on YouTube, speaking at conferences and meet-ups, crafting sample apps and contributing to the Firebase SDKs.

Prior to working at Google, he has held roles as a software engineer, software architect, and principal consultant at companies such as Lufthansa Systems, Gentleware, itemis, and Zuhlke.

Table of Contents

Chapter 1: SwiftUI - A new Beginning

  • Why a New UI framework?
  • SwiftUI Principles
    • Declarative vs Imperative
    • State Management
    • Composition over Inheritance
    • Everything is a View
    • UIs are a function of their state
  • A quick tour of SwiftUI
    • Creating a new app
    • Anatomy of a SwiftUI app
  • Two-way tooling
  • Adding your first button
    • Print hello to the console
    • Explain live mode (need to turn on debug mode so you can

see console output while in preview)

  • A brief overview of statement management
  • Use code editor and preview pane to update the hello
  • world app to allow the user to give their name

    • TextField, Label, (Button)
    • @State to bind the TextField input
    • Bind Label, so it gets updated automatically
    • Run the app in live preview

    Chapter 2: Getting Started with SwiftUI

    Building Blocks

    • Views
    • View Modifiers
    • Property Wrappers
    • Simple UI Controls

    Lists

    Navigation
    Composing UIs from simple UI elements

    • Building a list row
    • Making it reusable
    • extracting parts into separate structs / views
    • using ViewBuilders (properties / functions)

    Chapter 3: SwiftUI Foundation

    • Opaque return types
    • Implicit returns from single-expression functions
    • Function Builders
    • View Builders
    • Multiple Trailing Closures
    • Domain Specific languages
    • Property Wrappers
    • The View Life Cycle

    Chapter 4: State Management

    • Managing State with Property Wrappers @State

    @ObservableObject @ObservedObject
    @StateObject
    @EnvironmentObject

    • SwiftUI Patterns and State Management

      • Pattern: Drill-Down Navigation
      • Pattern: Input form
      • Pattern: Lookup field
      • Pattern: Local state in a single dialog
    • View Lifecycle
    • See Michael Long's article
    • Maybe even build some sort of introspector?
    • Build my own debugging utilities
    Chapter 5: Building Input Forms

    • Building simple forms
      Build a simple form with a couple of simple input fields.
    • Building advanced forms

    Look-up fields

    Drill-down

    In-place editing (e.g. date picker) Sections

    Forms and Data Binding / State Management

    Building a sign-up form

    Username

    Password / Repetition Validation

    Come up with a non-Combine version for the following rules:

    • Do the passwords match?
    • Password strong enough?
    • Username long enough?
    • Username still available?
    • How to handle state?

    Chapter 6: Functional Reactive Programming and Combine

      • Introduction to Functional Reactive Programming
        • What is it?
        • Why is it so cool / hot?
        • How can it help to make your apps better and more error-free
      • Core Combine Concepts Publishers

    Subscribers

    Operators

      • Combine Visualised
        • Marble Diagrams
        • Show some Combine operators as Marble Diagrams

    Chapter 7: Combine and SwiftUI

    Driving UI state
    Input validation using Combine

      • verify that the passwords match
      • verify username length
      • verify username is still available
      • verify password meets password complexity rules
      • show error messages for the individual error conditions
      • combine all the above into a single state that drives the enabled

    state of the sign-up button

    • Optimise our code
    • use debounce to throttle the number of calls on our fake backend
    • ensure UI updates happen on the main thread (use receiveOn)
  • Closure
    • Combine makes our code more maintainable.
    • It helps to decouple business logic from our UI
    • This also makes our code more testable

    Chapter 8: Testing Combine Code

      • Writing tests for asynchronous code
      • Mocking parts of your implementation
      • Some useful helpers

    Chapter 9: Advanced SwiftUI UIs

    LazyVGrid / LazyHGrid

    Outlines

    Chapter 10: Advanced SwiftUI - Building Reusable UI Components

      • Keep it lean and mean
        • Extracting functionality into sub-views
        • Using ViewBuilders to organise view code within a screen
      • Creating Container Components
      • Making your views customisable
      • Packaging your components using Swift Package Manager
      • Integrating views and view modifiers with the Xcode library

    Chapter 11: Building a Complete App with SwiftUI and Combine

    • Features of the app
    • Data Model
      • OpenLibrary API
      • Firebase

    Chapter 12: Displaying a list of books

      • Building a list cell from simple UI views
      • Compose a list view
      • Make your code reusable

    Chapter 13: Implementing a search screen

    Implementing a re-usable search bar

    • Designing the UI
    • Data Binding and State Management
    • Making the view re-usable

    Connecting to the OpenLibrary API

    • Searching book titles
    • Using Combine to improve working with the API
    • Debounce
      • Mapping JSON Data
      • Error handling
      • Automatic retries

    Chapter 14: Drill-Down Navigation and State Management

    Implementing a book details / edit screen

    Drill-down navigation pattern

    Chapter 15: Persisting Data in Firestore

    • What is Firebase?
    • What is Firestore?
    • NoSQL

    Real-time Sync

    • Mapping our data model to Firestore
    • Reading and writing data from / to Firestore
    • Implementing Combine Publishers for Firestore

    Chapter 16: App Store Hero Animation

    • Magic Move

    • SwiftUI Magic Move Animations
      • Explain how they work
      • Transition the current list view to make use of animations
    • Distribute your code
    Appendix A: An Overview of all SwiftUI Views

    Additional information

    NPB9781484285718
    9781484285718
    1484285719
    Asynchronous Programming with SwiftUI and Combine: Functional Programming to Build UIs on Apple Platforms by Peter Friese
    New
    Paperback
    APress
    2023-01-14
    434
    N/A
    Book picture is for illustrative purposes only, actual binding, cover or edition may vary.
    This is a new book - be the first to read this copy. With untouched pages and a perfect binding, your brand new copy is ready to be opened for the first time

    Customer Reviews - Asynchronous Programming with SwiftUI and Combine