Mastering iOS 18 Development - Avi Tsadok - E-Book

Mastering iOS 18 Development E-Book

Avi Tsadok

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Embark on a comprehensive iOS 18 development journey with Avi Tsadok, a veteran iOS developer and author of 4 books and over 40 tutorials and articles. A recognized public speaker, Avi has a knack for demystifying complex concepts and brings unparalleled expertise to the forefront of iOS 18 development education. This guide focuses on iOS 18 advancements, equipping developers with tools to maximize its potential.
This book covers essential topics for seasoned developers, including Swift, SwiftUI, Xcode foundations, and the latest iOS SDK updates. You’ll get to grips with optimizing performance and understanding advanced architectural paradigms. By implementing the newest iOS updates, you’ll also explore intricate animation methods and harness a new framework, SwiftData that replaces Core Data for having persistent storage. The book builds your proficiency in advanced networking with URLSession and shows you how to conjure stunning visuals and adopt sophisticated testing techniques. You'll explore the world of machine learning with Apple’s Core ML diving into built-in frameworks like NLP, vision, and sound analysis to train and integrate your own models into iOS apps.
By the end of the book, you'll possess skills to build exceptional apps, excel in advanced roles, and confidently tackle iOS development challenges.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 502

Veröffentlichungsjahr: 2024

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Mastering iOS 18 Development

Take your iOS development experience to the next level with iOS, Xcode, Swift, and SwiftUI

Avi Tsadok

Mastering iOS 18 Development

Copyright © 2024 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

The author acknowledges the use of cutting-edge AI, in this case Grammarly, with the sole aim of enhancing the language and clarity within the book, thereby ensuring a smooth reading experience for readers. It's important to note that the content itself has been crafted by the author and edited by a professional publishing team.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Rohit Rajkumar

Publishing Product Manager: Chayan Majumdar

Book Project Manager: Sonam Pandey

Senior Editor: Rashi Dubey

Technical Editor: K Bimala Singha

Copy Editor: Safis Editing

Indexer: Subalakshmi Govindhan

Production Designer: Ponraj Dhandapani

DevRel Marketing Coordinator: Nivedita Pandey

First published: November 2024

Production reference: 1091024

Published by Packt Publishing Ltd.

Grosvenor House 11 St Paul’s SquareBirmingham B3 1RB, UK

ISBN 978-1-83546-810-4

www.packtpub.com

This book was a year in the making, filled with countless hours of research, investigation, and a few too many late-night coffee runs. While I loved every minute of it, I have to give a big shoutout to my amazing wife, Tammy, for her endless support and understanding, and to my kids, Harel and Maya, who heroically endured my “just five more minutes” promises. And last but not least, a huge thank you to my trusty alarm clock, which somehow managed to drag me out of bed at 5 A.M. every day to pursue my passion for writing.

– Avi Tsadok

Contributors

About the author

Avi Tsadok, a seasoned iOS developer with a 14-year career, has proven his expertise by leading projects for notable companies, such as Any.do, a top productivity app. He is currently at Melio Payments, where he steers the mobile team. Known for his ability to simplify complex tech concepts, Avi has written 4 books and published 40+ tutorials and articles that enlighten and empower aspiring iOS developers. His voice resonates beyond the page, as he’s a recognized public speaker and has conducted numerous interviews with fellow iOS professionals, furthering the field’s discourse and development.

It was a challenging year for me and my family, and writing this book became a source of strength during those difficult times. I want to express my deepest gratitude to Packt for their unwavering support and professionalism, with special thanks to Sonam, Chayan, and Rashi – your efforts did not go unnoticed. Finally, a heartfelt thank you to my family – Tammy, Harel, and Maya – who gave me the strength to complete this incredible project.

About the reviewers

Hritik Raj is an iOS developer-turned-product manager at meShare, with extensive experience working on IoT apps used by millions of users. Passionate about learning, Hritik taught himself SwiftUI through books and tutorials during his time at the University of Illinois at Urbana-Champaign, where he graduated with a degree in computer engineering. His expertise spans both development and product management, giving him a unique perspective on building user-centric apps.

Ruy de Ascenção Neto is an alumnus of the Apple Developer Academy in Brazil with six years of experience in Objective-C, Swift, and SwiftUI. He has experience in developing applications for iPhone, Apple TV, and Apple Watch. He has worked at both national and international banks, as well as streaming companies.

Table of Contents

Preface

Part 1: Getting Started with iOS 18 Development

1

What’s New in iOS 18

Technical requirements

Understanding iOS 18 background

Introducing Swift Testing

Introducing Swift Data Improvements

Unique value

History API

Custom data stores in Swift Data

Introducing zoom transition

Adding a floating tab bar

Having more control over scroll views

Observing the scroll view position

Observing items’ visibility

Changing the text rendering behavior

Positioning sub-views from another view

Entering the AI revolution

Summary

2

Simplifying Our Entities with SwiftData

Technical requirements

Understanding SwiftData’s background

Defining a SwiftData model

Expanding the @Model macro

Adding relationships

SwiftData relationship deletion rules

Defining the inverse relationship

Adding the @Attribute macro

Going non-persistent with transient

Exploring the container

Setting up ModelContainer

Connecting the container using the modelContainer modifier

Working with ModelConfiguration

Fetching and manipulating our data using model context

Saving new objects

Fetching objects

Migrating our data to a new schema

Learning the basic migration process

Creating a version schema

Creating the migration stages and plan

Connecting the migration plan to our container

Summary

3

Understanding SwiftUI Observation

Technical requirements

Going over the SwiftUI observation system

Conforming to the ObservableObject protocol

Explaining the problem with the current observation situation

Adding the @Observable macro

Learning how the @Observable macro works

Excluding properties from observation using @ObservationIgnored

Observing computed variables

Working with environment variables

Adding an environment variable by type

Adding environment variable by key

Binding objects using @Bindable

Migrating to Observable

Summary

4

Advanced Navigation with SwiftUI

Technical requirements

Understating why SwiftUI navigation is a challenge

Exploring NavigationStack

Separating the navigation destination using the navigationDestination view modifier

Using data models to trigger navigation

Responding to the path variable

Working with different types of data using NavigationPath

Working with the Coordinator pattern

Understanding the Coordinator’s principles

Building the Coordinator object

Adding CoordinatorView

Calling the coordinator straight from the view

Navigating with columns with NavigationSplitView

Creating NavigationSplitView

Moving to three columns

Summary

5

Enhancing iOS Applications with WidgetKit

Technical requirements

The idea of widgets

Understanding how widgets work

Adding a widget

Configuring our widget

Working with static configuration

Understanding the Timeline Provider for Widgets

Building our widget UI

Working with timeline entries

Adding animations

Customize our widget

Using the AppEntity in our Widget

Keeping our widgets up to date

Reload widgets using the WidgetCenter

Go to the network for updates

Interacting with our widget

Opening a specific screen using links

Adding interactive capabilities

Adding a control widget

Summary

6

SwiftUI Animations and SF Symbols

Technical requirements

The importance of animations

Understanding the concept of SwiftUI animations

Performing basic animations

Using the animation view modifier

Using the withAnimation function

Bringing some life to our animations with spring animations

Performing advanced animations

Performing transitions

Executing keyframe animations

Animating SF Symbols

Modifying symbol colors

Localizing our symbols

Summary

7

Improving Feature Exploration with TipKit

Technical requirements

Learning the importance of tips

Understanding the basics of TipKit

What do tips look like?

Adding our first tip

Dismissing tips

Defining the tip ID

Customizing our tips

Customizing our tips’ appearance

Adding actions

Adding tips rules

Adding a rule based on a state

Adding a rule based on events

Grouping tips with TipGroup

Customizing display frequency

Setting the max display count for a specific tip

Setting our tips’ display frequency

Summary

8

Connecting and Fetching Data from the Network

Technical requirements

Understanding mobile networking

Handling an HTTP request

Basic HTTP request methods

Working with URLSession

Handling the response

Integrating network calls within app flows

Just-in-time fetching

Read-through cache

Incremental loading

Full data sync with delta updates

Exploring Networking and Combine

Summary

9

Creating Dynamic Graphs with Swift Charts

Technical requirements

Why charts?

Introducing the Swift Charts framework

Creating charts

Creating BarMark chart

Creating LineMark charts

Creating a SectorMark chart

Creating an AreaMark chart

Creating a PointMark chart

Visualizing functions with Charts

Allowing interaction using ChartProxy

Adding an overlay to our chart

Responding to the user’s gesture

Finding the closest data point to the user’s touch

Conforming to the Plottable protocol

Summary

Part 2: Refine your iOS Development with Advanced Techniques

10

Swift Macros

Technical requirements

What is a Swift macro?

Exploring SwiftSyntax

Parsing and AST

Setting up SwiftSyntax

Building our Abstract Syntax Tree

Creating our first Swift macro

Adding a new Swift macro

Examining our Swift Macros package structure

Declaring our macro

Implementing the macro

Handling macros errors

Adding tests

Practice exercises

Summary

11

Creating Pipelines with Combine

Technical requirements

Why use Combine?

Going over the basics

Starting with the publisher

Setting up the subscriber

Connecting operators

Delving into Combine components

Creating a custom publisher

Working with Subjects

Creating a custom subscriber

Connecting the custom publisher and subscriber

Working with operators

Learning about Combine using examples

Managing UIKit-based view state in a view model

Performing searches from multiple sources

Validating forms

Summary

12

Being Smart with Apple Intelligence and ML

Technical requirements

Going over the basics of AI and machine learning

Learning the differences between AI and machine learning

Delving into the ML model

Training the model

Apple intelligence and ML

Exploring built-in ML frameworks

Interpreting text using NLP

Analyzing images using the Vision framework

Classifying audio using the Sound Analysis framework

Performing a semantic search with Core Spotlight

Integrating custom models using CoreML

Getting to know the Create ML application

Building our Spam Classifier model

Using our model with Core ML

Where to go from here

Summary

13

Exposing Your App to Siri with App Intents

Technical requirements

Understanding the App Intents concept

Creating a simple app intent

Running the intent with the Shortcuts app

Creating an app shortcut

Adding a parameter to our app intent

Returning a custom view

Having multiple result types

Adding confirmation and conditions

Formalizing our content using app entities

Conforming to AppEntity

Creating an Open a task intent

Chaining app intents

Integrating our intent to other intents

Adjusting our app intents to work with Apple Intelligence

Exploring the Assistant Schema

Creating AssistantEntity

Summary

14

Improving the App Quality with Swift Testing

Technical requirements

Understanding the importance of testing

Learning the testing history in Apple platforms

Exploring the Swift Testing basics

Adding a basic test

Providing names to our test functions

Enabling and disabling tests

Tagging our test functions

Working with arguments

Managing our tests

Going over the testing structure

Grouping our test functions into test suites

Building test plans

Setting up a Scheme

Tips to write testable code

Writing pure functions

Separating your code based on concerns

Performing mocking using protocols

Summary

15

Exploring Architectures for iOS

Technical requirements

Understanding the importance of architecture

Learning what exactly architecture is

Going over the different architectures

Separating our project into layers

Separating our project into modules

Combining the multi-layer architecture with modules

Building hexagonal architecture

Comparing the different architectures

By separation of concerns

By testing

By maintenance and scalability

Summary

Index

Other Books You May Enjoy

Part 1: Getting Started with iOS 18 Development

In this part, you will review all the new capabilities of iOS 18. We will explore exciting topics, such as SwiftData, Observation, and SwiftUI navigation. In addition, we will build widgets with WidgetKit, animate our views, add tips and graphs to our apps, and learn how to build a great network layer.

This part contains the following chapters:

Chapter 1, What’s New in iOS 18Chapter 2, Simplifying Our Entities with SwiftDataChapter 3, Understanding SwiftUI ObservationChapter 4, Advanced Navigation with SwiftUIChapter 5, Enhancing iOS Applications with WidgetKitChapter 6, SwiftUI Animations and SF SymbolsChapter 7, Improving Feature Exploration with TipKitChapter 8, Connecting and Fetching Data from the NetworkChapter 9, Creating Dynamic Graphs with Swift Charts