SwiftUI Cookbook - Second Edition: A guide to solving the most common problems and learning best practices while building SwiftUI apps

Giordano Scalzo , Edgar Nzokwe

買這商品的人也買了...

商品描述

Key Features

  • Apply the declarative programming paradigm to build cross-platform UIs for Apple devices
  • Learn to integrate UIkit, Core Data, Firebase, and Sign in with Apple with SwiftUI
  • Adopt the new SwiftUI 3.0 features to build visually appealing UIs speedily

Book Description

SwiftUI provides an innovative and simple way to build beautiful user interfaces (UIs) for all Apple platforms, from iOS and macOS through to watchOS and tvOS, using the Swift programming language. In this recipe-based cookbook, you'll cover the foundations of SwiftUI as well as the new SwiftUI 3 features introduced in iOS 15 and explore a range of essential techniques and concepts that will help you through the development process.

The cookbook begins by explaining how to use basic SwiftUI components. Once you've learned the core concepts of UI development, such as Views, Controls, Lists, and ScrollViews, using practical implementations in Swift, you'll advance to adding useful features to SwiftUI using drawings, built-in shapes, animations, and transitions. You'll understand how to integrate SwiftUI with exciting new components in the Apple development ecosystem, such as Combine for managing events and Core Data for managing app data. Finally, you'll write iOS, macOS, and watchOS apps by sharing the same SwiftUI codebase.

By the end of this SwiftUI book, you'll have discovered a range of simple, direct solutions to common problems encountered when building SwiftUI apps.

What you will learn

  • Explore various layout presentations in SwiftUI such as HStack, VStack, LazyHStack, and LazyVGrid
  • Create widgets to quickly display relevant content at glance
  • Get up to speed with drawings in SwiftUI using built-in shapes, custom paths, and polygons
  • Discover modern animation and transition techniques in SwiftUI
  • Add user authentication using Firebase and Sign in with Apple
  • Manage concurrency with Combine and async/await in SwiftUI
  • Solve the most common SwiftUI problems, such as integrating a MapKit map, unit testing, snapshot testing, and previewing layouts

Who this book is for

This book is for mobile developers who want to learn SwiftUI as well as experienced iOS developers transitioning from UIkit to SwiftUI. The book assumes knowledge of the Swift programming language. Knowledge of object-oriented design and data structures will be useful but not necessary. You'll also find this book to be a helpful resource if you're looking for reference material regarding the implementation of various features in SwiftUI.

商品描述(中文翻譯)

主要特點


  • 運用聲明式編程範式來建構適用於蘋果設備的跨平台使用者介面(UI)

  • 學習如何將UIkit、Core Data、Firebase和Sign in with Apple整合到SwiftUI中

  • 採用新的SwiftUI 3.0功能,快速建構視覺上吸引人的UI

書籍描述

SwiftUI提供了一種創新且簡單的方式,使用Swift程式語言為所有蘋果平台(包括iOS、macOS、watchOS和tvOS)建構美觀的使用者介面(UI)。在這本以食譜為基礎的烹飪書中,您將學習SwiftUI的基礎知識,以及iOS 15中引入的新的SwiftUI 3功能,並探索一系列的基本技術和概念,這些將有助於您的開發過程。

這本烹飪書首先解釋了如何使用基本的SwiftUI元件。一旦您學會了UI開發的核心概念,例如視圖(Views)、控制項(Controls)、列表(Lists)和滾動視圖(ScrollViews),並使用Swift進行實際實現,您將進一步通過使用繪圖、內建形狀、動畫和轉場等實用功能,為SwiftUI添加有用的功能。您將了解如何將SwiftUI與蘋果開發生態系統中的令人興奮的新元件整合,例如使用Combine來管理事件和使用Core Data來管理應用程式數據。最後,您將通過共享相同的SwiftUI代碼庫來編寫iOS、macOS和watchOS應用程式。

通過閱讀這本SwiftUI書籍,您將發現一系列簡單、直接的解決方案,用於解決在構建SwiftUI應用程式時遇到的常見問題。

您將學到什麼


  • 探索SwiftUI中的各種佈局呈現方式,例如HStack、VStack、LazyHStack和LazyVGrid

  • 創建小工具(widgets),以便快速顯示相關內容

  • 使用內建形狀、自定義路徑和多邊形在SwiftUI中進行繪圖

  • 在SwiftUI中發現現代動畫和轉場技術

  • 使用Firebase和Sign in with Apple添加使用者驗證

  • 使用Combine和async/await在SwiftUI中管理並發

  • 解決最常見的SwiftUI問題,例如整合MapKit地圖、單元測試、快照測試和預覽佈局

適合閱讀對象

本書適合想要學習SwiftUI的移動應用程式開發人員,以及從UIkit轉向SwiftUI的經驗豐富的iOS開發人員。本書假設讀者具備Swift程式語言的知識。對於物件導向設計和資料結構的了解將有所幫助,但不是必需的。如果您正在尋找有關在SwiftUI中實現各種功能的參考資料,本書也將是一個有用的資源。

作者簡介

Giordano Scalzo is a developer with 20 years of programming experience, since the days of ZX Spectrum. He has worked in Swift, Objective-C, C/C++, Java, .Net, Ruby, Python, and in a ton of other languages that he has forgotten the names of. After years of backend development, over the past 10 years, Giordano has developed extensively for iOS, releasing more than 20 apps―apps that he wrote for clients, enterprise applications, or on his own. He is currently a Tech Lead Consultant in London, where he leads mobile digital transformations through his company, Effective Code Ltd. Edgar Nzokwe is a software engineer with 6+ years of experience building web and mobile applications. His areas of expertise include SwiftUI, UIKit, and Kotlin, Python, and a few Javascript frameworks. Edgar is dedicated to advancing the knowledge base of SwiftUI because he believes it empowers developers to design and build dazzling cross-platform apps with minimal development time.

作者簡介(中文翻譯)

Giordano Scalzo是一位擁有20年程式設計經驗的開發者,從ZX Spectrum時代開始。他曾在Swift、Objective-C、C/C++、Java、.Net、Ruby、Python等許多語言上工作,但已經忘記其中很多語言的名稱。在多年的後端開發之後,過去的10年中,Giordano在iOS上進行了大量的開發,發布了超過20個應用程式,這些應用程式是為客戶、企業應用程式或自己編寫的。他目前是倫敦的技術領導顧問,通過他的公司Effective Code Ltd.帶領著移動數字轉型。Edgar Nzokwe是一位擁有6年以上網頁和移動應用程式開發經驗的軟體工程師。他的專業領域包括SwiftUI、UIKit、Kotlin、Python和一些Javascript框架。Edgar致力於推進SwiftUI的知識庫,因為他相信它能夠讓開發者以最少的開發時間設計和建立令人驚艷的跨平台應用程式。

目錄大綱

  1. Using the Basic SwiftUI Views and Controls
  2. Going Beyond the Single Component with Lists and Scroll Views
  3. Exploring Advanced Components
  4. Viewing while Building with SwiftUI Preview
  5. Creating New Components and Grouping Views with Container Views
  6. Presenting Extra Information to the User
  7. Drawing with SwiftUI
  8. Animating with SwiftUI
  9. Driving SwiftUI with Data
  10. Driving SwiftUI with Combine
  11. SwiftUI Concurrency with async await
  12. Handling Authentication and Firebase with SwiftUI
  13. Handling Core Data in SwiftUI
  14. Creating Cross-Platform apps with SwiftUI
  15. SwiftUI Tips and Tricks

目錄大綱(中文翻譯)

使用基本的SwiftUI視圖和控制項
使用列表和滾動視圖超越單個組件
探索高級組件
使用SwiftUI預覽時進行構建
創建新組件並使用容器視圖分組視圖
向用戶呈現額外信息
使用SwiftUI繪圖
使用SwiftUI進行動畫
使用數據驅動SwiftUI
使用Combine驅動SwiftUI
使用async await進行SwiftUI並發
處理身份驗證和Firebase與SwiftUI
在SwiftUI中處理Core Data
使用SwiftUI創建跨平台應用程序
SwiftUI技巧和技巧