
عنوان:
Asynchronous Programming with SwiftUI and Combine
نویسنده:
Peter Friese
انتشارات:
Apress
تاریخ انتشار:
2023
حجم:
6.26MB
معرفی کتاب:"Asynchronous Programming with SwiftUI and Combine - آموزش برنامهنویسی واکنشی و اعلانی در پلتفرمهای اپل"
توسعه اپلیکیشنهای سنگین از نظر رابط کاربری (UI-heavy) را سادهتر، سریعتر و بدون خطا انجام دهید. این کتاب با تکیه بر بهبودهای مهم در زبان Swift، شما را با روش Declarative در ساخت رابط کاربری با SwiftUI آشنا میکند. بهجای کدنویسی Imperative، یاد میگیرید تنها مشخص کنید که رابط کاربری چگونه باید بهنظر برسد.
در SwiftUI، رابط کاربری بهعنوان تابعی از وضعیت (State) در نظر گرفته میشود؛ با تغییر مدل داده، تمام بخشهای مرتبط از UI بهصورت خودکار بهروزرسانی میشوند. همینطور میتوانید از طریق عناصر UI، دادههای مدل زیرین را تغییر دهید.
فریمورک Combine نیز بهعنوان ابزار Functional Reactive Programming اپل، مکملی طبیعی برای SwiftUI و APIهای شبکه است. با استفاده از آن، میتوانید به رخدادها Subscribe کنید و دادهها را بدون side effect مدیریت کنید. این موضوع پیادهسازی اپهای event-driven را بسیار سادهتر میکند.
با ترکیب SwiftUI، Combine و قابلیتهای async/await، میتوانید اپلیکیشنهایی کمخطاتر و سریعتر برای تمامی پلتفرمهای اپل (iOS, iPadOS, macOS, watchOS, tvOS) توسعه دهید، بدون نیاز به تغییرات زیاد در ساختار کد.
در پایان این کتاب، درک عمیقی از معماری و پیادهسازی اپلیکیشنهای پیچیده از نظر UI با رویکرد تابعی و اعلانی بهدست خواهید آورد.
آنچه در این کتاب خواهید آموخت:
- ساخت رابطهای کاربری ساده تا پیچیده با SwiftUI
- درک عمیق از سیستم مدیریت وضعیت (State Management) در SwiftUI
- کار با Combine و async/await برای کار با دادههای ناهمگام و شبکه
- توسعه اپلیکیشنهای مدرن برای پلتفرمهای اپل بدون پیچیدگی
مخاطبان این کتاب:
اگر به دنبال توسعه حرفهای رابطهای کاربری پیچیده و مدرن با استفاده از روشهای نوین Swift هستید، این کتاب یک راهنمای کامل، کاربردی و بهروز برای شماست.
فهرست مطالب
- About the Author
- Foreword
- Preface
- Acknowledgments
- About This Book
- Part 1
- Chapter 1: SwiftUI: A New Beginning
- Why a New UI Framework?
- SwiftUI Principles
- A Quick Tour of SwiftUI
- Exercises
- Summary
- Chapter 2: Getting Started with SwiftUI
- What We’re Going to Build
- Composing a View for Displaying a Book
- Build the View with Static Data
- Using the Preview to Make Sure Our View Works As Intended
- Displaying a List of Books
- Setting Up Data Binding
- Adjusting the Preview Canvas
- Making the Code Reusable
- Views and View Modifiers
- Exercises
- Tips and Tricks
- Summary
- Chapter 3: SwiftUI Building Blocks
- Views
- View Modifiers
- Summary
- Chapter 4: State Management
- Managing State in SwiftUI
- Binding Value Types
- Binding Objects
- ObservableObject
- @StateObject
- @ObservedObject
- @EnvironmentObject
- Summary
- Chapter 5: Displaying Data in Lists
- Getting Started with Lists in SwiftUI
- Dynamic Lists
- Styling
- Actions
- Managing Focus in Lists
- Summary
- Chapter 6: Building Input Forms
- Building Simple Forms
- Showing Data in a Form
- Make It Editable
- Drill-Down Navigation
- Input Validation
- Summary
- Part 2
- Chapter 7: Getting Started with Combine
- What Is Functional Reactive Programming?
- Publishers
- Subscribers
- Operators
- Composing Operators
- Combining Publishers
- Summary
- Chapter 8: Driving UI State with Combine
- Input Validation Using Combine
- Exercises
- Summary
- Chapter 9: Networking with Combine
- Fetching Data Using URLSession
- Using Combine to Fetch Data
- Connecting to the UI
- Handling Multithreading
- Optimizing Network Access
- Bringing It All Together
- Exercises
- Summary
- Chapter 10: Error Handling in Combine
- Error Handling Strategies
- Typical Error Conditions and How to Handle Them
- Summary
- Chapter 11: Implementing Custom Combine Operators
- What Is a Combine Operator?
- Implementing Custom Operators
- Implementing a Retry Operator with a Delay
- Conditionally Retrying
- Implementing a Retry Operator for Exponential Backoff
- Summary
- Chapter 12: Wrapping Existing APIs in Combine
- A Case Study
- Using Combine to Access Firestore
- Creating Your Own Publishers
- Summary
- Chapter 13: Combine Schedulers and SwiftUI
- What Is a Scheduler
- Types of Schedulers
- Default Behavior
- Switching Schedulers
- Performing Asynchronous Work
- Integrating with Other APIs
- Summary
- Part 3
- Chapter 14: Getting Started with async/await
- Synchronous Programming with Functions
- Asynchronous Programming with Closures
- Asynchronous Programming with async/await
- Summary
- Chapter 15: Using async/await in SwiftUI
- Fetching Data Asynchronously Using URLSession
- Calling Asynchronous Code
- The Task View Modifier
- Calling Asynchronous Code When the User Taps a Button
- Using Pull-to-Refresh to Update Views Asynchronously
- Searchable Views and async/await
- Updating the UI from the Main Thread
- Summary
- Chapter 16: Bringing It All Together: SwiftUI, async/await, and Combine
- Fetching Data Using Combine
- Fetching Data Using async/await
- Is This the End of Combine?
- Connecting the UI…
- …to a Combine Pipeline
- …to an async/await Method
- Calling Asynchronous Code from Combine
- Summary
- Index
مشخصات
نام کتاب
Asynchronous Programming with SwiftUI and Combine: Functional Programming to Build UIs on Apple Platforms
نویسنده
Peter Friese
انتشارات
Apress
تاریخ انتشار
2023
ISBN
9781484285718
تعداد صفحات
447
زبان
انگلیسی
فرمت
حجم
6.26MB
موضوع
Programming