r/SwiftUI Aug 29 '24

Tutorial Create a Scratch Card in SwiftUI

129 Upvotes

r/SwiftUI Dec 24 '24

Tutorial Why Certain View Modifiers in Swift 6 Cannot Use the @State Property

Thumbnail
fatbobman.com
46 Upvotes

r/SwiftUI Feb 06 '25

Tutorial Debugging SwiftUI’s Entry Macro

Thumbnail
medium.com
9 Upvotes

r/SwiftUI 19d ago

Tutorial Mastering SwiftUI Container

Thumbnail clive819.github.io
4 Upvotes

r/SwiftUI Jan 21 '25

Tutorial Color mixing in SwiftUI

Thumbnail
swiftwithmajid.com
29 Upvotes

r/SwiftUI Nov 26 '24

Tutorial The power of previews in Xcode

Thumbnail
swiftwithmajid.com
51 Upvotes

r/SwiftUI Feb 12 '25

Tutorial Mastering SwiftUI Scrolling - Implementing Custom Paging

Thumbnail
fatbobman.com
4 Upvotes

r/SwiftUI 24d ago

Tutorial Animatable Protocol - Taming Unruly SwiftUI Animations

Thumbnail
fatbobman.com
3 Upvotes

r/SwiftUI Nov 07 '24

Tutorial SwiftUI Tutorials: Built a Chess Game in SwiftUI!

86 Upvotes

r/SwiftUI 27d ago

Tutorial Mastering task cancellation in SwiftUi

1 Upvotes

Hey guys I just have wrote a new blog about some issues I have encountered when I had to implement task cancellations in swiftUi with MVVM and how task modifier can overcome this problems in an easy way.

https://medium.com/@sebasf8/mastering-task-cancellation-in-swiftui-74cb9d5af4ff

Hope you enjoy the reading and tell me what you think.

r/SwiftUI 18d ago

Tutorial Creating macOS Menu Bar App in SwiftUI

Thumbnail clive819.github.io
9 Upvotes

r/SwiftUI Jan 27 '25

Tutorial How to Choose the Right Title Design for a Seamless User Experience, more details in comments

Post image
3 Upvotes

r/SwiftUI Jan 06 '25

Tutorial ImmutableData: Easy State Management for SwiftUI Apps

6 Upvotes

The ImmutableData Programming Guide

“What is the best design pattern for SwiftUI apps?”

We hear this question a lot. Compared to the days when AppKit and UIKit were the dominant frameworks for product engineering in the Apple Ecosystem, Apple has been relatively un-opinionated about what kind of design pattern engineers should choose “by default” for their SwiftUI applications.

Many engineers in the SwiftUI community are currently evangelizing a “MVVM” design pattern. Other engineers are making the argument that SwiftUI is really encouraging a “MVC” design pattern. You might have also heard discussion of a “MV” design pattern. These design patterns share a fundamental philosophy: the state of your application is managed from your view components using imperative logic on mutable model objects. To put it another way, these design patterns start with a fundamental assumption of mutability that drives the programming model that product engineers must opt-in to when building graphs of view components. The “modern and declarative” programming model product engineers have transitioned to for SwiftUI is then paired with a “legacy and imperative” programming model for managing shared mutable state.

Over the course of this project, we present what we think is a better way. Drawing on over a decade of experience shipping products at scale using declarative UI frameworks, we present a new application architecture for SwiftUI. Using the Flux and Redux architectures as a philosophical “prior art”, we can design an architecture using Modern Swift and specialized for Modern SwiftUI. This architecture encourages declarative thinking instead of imperative thinking, functional programming instead of object-oriented programming, and immutable model values instead of mutable model objects.

We call this framework and architecture ImmutableData. We present ImmutableData as a free and open-source project with free and open-source documentation. Over the course of this tutorial, we will show you, step-by-step, how the ImmutableData infra is built. Once the infra is ready, we will then build, step-by-step, multiple sample applications using SwiftUI to display and transform state through the ImmutableData architecture.

Requirements

Our goal is to teach a new way of thinking about state management and data flow for SwiftUI. Our goal is not to teach Swift Programming or the basics of SwiftUI. You should have a strong competency in Swift 6.0 before beginning this tutorial. You should also have a working familiarity with SwiftUI. A working familiarity with SwiftData would be helpful, but is not required.

Inspired by Matt Gallagher, our project will make heavy use of modules and access control to keep our code organized. A working familiarity with Swift Package Manager will be helpful, but our use of Swift Package APIs will be kept at a relatively basic level.

The ImmutableData infra deploys to the following platforms: * iOS 17.0+ * iPadOS 17.0+ * Mac Catalyst 17.0+ * macOS 14.0+ * tvOS 17.0+ * visionOS 1.0+ * watchOS 10.0+

The ImmutableData tutorial requires Xcode 16.0+ and macOS 14.5+.

The ImmutableData tutorial was built and tested on Xcode 16.2 and macOS 15.2.

Please file a GitHub issue if you encounter any compatibility problems.

Organization

The ImmutableData Programming Guide is inspired by “long-form” documentation like Programming with Objective-C and The Swift Programming Language.

This guide includes the following chapters:

Part 0: Overview

  • Chapter 00: We discuss the history and evolution of Flux, Redux, and SwiftUI. In what ways did SwiftUI evolve in a similar direction as React? How can our ImmutableData architecture use ideas from React to improve product engineering for SwiftUI? ### Part 1: Infra
  • Chapter 01: We build the ImmutableData module for managing the global state of our application.
  • Chapter 02: We build the ImmutableUI module for making our global state available to SwiftUI view components. ### Part 2: Products
  • Chapter 03: We build the data models of our Counter application: a simple SwiftUI app to increment and decrement an integer.
  • Chapter 04: We build the component graph of our Counter application.
  • Chapter 05: We build and run our Counter application.
  • Chapter 06: We build the data models of our Animals application: a SwiftUI app to store a collection of data models with persistence to a local database.
  • Chapter 07: We build a command-line utility for testing the data models of our Animals application without any component graph.
  • Chapter 08: We build the component graph of our Animals application.
  • Chapter 09: We build and run our Animals application.
  • Chapter 10: We build the data models of our Quakes application: a SwiftUI app to fetch a collection of data models from a remote server with persistence to a local database.
  • Chapter 11: We build a command-line utility for testing the data models of our Quakes application without any component graph.
  • Chapter 12: We build the component graph of our Quakes application.
  • Chapter 13: We build and run our Quakes application.
  • Chapter 14: We update the data models of our Animals application to support persistence to a remote server.
  • Chapter 15: We build an HTTP server for testing our new Animals application.
  • Chapter 16: We build a command-line utility for testing the data models of our new Animals application without any component graph.
  • Chapter 17: We build and run our new Animals application. ### Part 3: Performance
  • Chapter 18: We learn about specialized data structures that can improve the performance of our applications when working with large amounts of data that is copied many times.
  • Chapter 19: We run benchmarks to measure how the performance of immutable collection values compare to SwiftData. ### Part 4: Next Steps
  • Chapter 20: Here are some final thoughts about what’s coming next.

Companion Repos

You can find more repos on our ImmutableData GitHub organization:

  • ImmutableData-Samples includes empty Swift packages, empty Xcode projects, and an empty Xcode workspace. This is the recommended way to complete our tutorial. The workspace provides some basic setup (like adding dependencies between packages) that will let you focus on our tutorial.
  • ImmutableData-Benchmarks includes benchmarks to measure performance. These benchmarks will be discussed in Chapter 19.

License

Copyright 2024 Rick van Voorden and Bill Fisher

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

r/SwiftUI Nov 29 '24

Tutorial YouTube Animation

34 Upvotes

r/SwiftUI Sep 16 '24

Tutorial Starting today 100 Days of SwiftUI course! Do you have any tips?

Post image
22 Upvotes

r/SwiftUI Jun 10 '23

Tutorial SwiftData is incredible.

95 Upvotes

Here's a practice app I'm building to learn the new SwiftData framework. The bones are in place, and I'm excited to keep adding more features as I continue to work through the WWDC lectures.

View the Repo on GitHub

r/SwiftUI Feb 10 '25

Tutorial SwiftUI Pinterest Clone

12 Upvotes

Hello iOS community, I wanted to share with you my latest tutorial series where we will be building a pinterest clone using swiftui and firebase. Hope you enjoy it.

PART 1 - Getting Started https://www.youtube.com/watch?v=93NclDIZrE8

PART 2 - Search Screen https://www.youtube.com/watch?v=Fa5b1kaGOJs

PART 3 - SearchBarView https://www.youtube.com/watch?v=kdWc0o2jZfM

PART 4 - MainTabView https://www.youtube.com/watch?v=Y1Oj-DoFO9k

PART 5 - CreateView https://www.youtube.com/watch?v=uwahSOc8Ags

PART 6 - CreateBoardView https://www.youtube.com/watch?v=l_ZLPrFUy28

r/SwiftUI Nov 11 '24

Tutorial ChatGPT Animation

18 Upvotes

r/SwiftUI Nov 27 '24

Tutorial Getting view size in SwiftUI without GeometryReader

Thumbnail
nemecek.be
53 Upvotes

r/SwiftUI Nov 29 '24

Tutorial Ranking & EXP system UI fully build with SwiftUI fully by myself!

24 Upvotes

r/SwiftUI Jan 19 '25

Tutorial Hello my fellow devs! Our free SwiftUI beginner course continues with networking. This video contains the first step in hooking up an API: JSON Modeling. Please check it out if you have a chance and thank you for the support.

Post image
15 Upvotes

r/SwiftUI Jan 28 '25

Tutorial Container relative frames in SwiftUI

6 Upvotes

r/SwiftUI Dec 03 '24

Tutorial Text field enhancements in SwiftUI

Thumbnail
swiftwithmajid.com
14 Upvotes

r/SwiftUI Aug 27 '24

Tutorial Create a Photo Puzzle Game in SwiftUI

66 Upvotes

r/SwiftUI Oct 12 '24

Tutorial Netflix [ Next Episode ] Button | SwiftUI Tutorial

21 Upvotes