Swift

369 readers
5 users here now

This group focus on the content related to the development of Apple Eco-system software. So feel free to share and talk about, for example;

founded 2 years ago
MODERATORS
1
 
 

onAppear is an extremely crucial lifecycle method in SwiftUI, used to inject key logic when a view is presented. Since view instances may be created and rebuilt frequently, developers often choose to prepare data and perform initialization operations within these methods. In theory, the timing of these lifecycle method calls should be predictable and consistent. However, in certain specific scenarios, onAppear may be called unexpectedly and unnecessarily. This not only can lead to performance overhead but also may cause uncontrollable changes in the application’s state. This article will uncover this easily overlooked SwiftUI behavior trap and provide temporary countermeasures.

2
2
Fatbobman's Swift Weekly #062 (weekly.fatbobman.com)
submitted 3 days ago* (last edited 3 days ago) by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #062 | Making Swift Stronger, Keeping It Simple

  • Model Inheritance in Core Data
  • Use of Swift and SwiftUI in iOS 18
  • SF Symbol
  • Mocking Network Connection in Testing
  • Image Playground
  • Swift Macro
  • MLX Swift
3
4
6
submitted 1 week ago by fatbobman to c/swift
 
 

Model inheritance in Core Data is a powerful mechanism.

Dive into this article to uncover the magic of parent, child, and abstract entities, and master class inheritance techniques. This article will also be helpful for SwiftData users.

5
4
Fatbobman's Swift Weekly #061 (weekly.fatbobman.com)
submitted 1 week ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #061 | Two Hours Without a Smartphone

  • Concurrency Step-by-Step
  • Eight Fun SwiftUI Details
  • What Happens When Move File in Git
  • any and some
  • Simple State Sharing and Persistence in Swift
6
2
Fatbobman's Swift Weekly #060 (weekly.fatbobman.com)
submitted 2 weeks ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #060 | Older or Outer? Reminiscing About the Pre-Smart Era

  • The Anomaly of onChange
  • Using AppKit in Catalyst
  • Calling Hidden Swift Functions
  • Natural Language Framework
  • macOS Threading
  • Dev Conversations
  • Debugging Layouts
7
 
 

SwiftUI provides the onChange modifier, allowing developers to listen for changes in specific values within a view and execute corresponding actions when those values change. Intuitively, as long as a view is part of the currently visible branch of the view tree (active), the corresponding closure should be triggered when the observed value changes. However, in certain navigation scenarios, the onChange modifier seems to become “selectively deaf,” inexplicably remaining silent even when the observed value changes. Is this a carefully designed feature by Apple, or a long-hidden code defect? This article aims to unveil this phenomenon and provide necessary caution to developers.

8
 
 

Hi! I'm new to Swift and macOS development. I'm currently writing an app for me that allows me to backup my files and photos from icloud to NAS.

Getting the photos was easy, but I'm not sure how to get files stored in icloud drive. Do I need an Apple Developer account for the right permissions? If so, why can I download photos without it?

9
4
Fatbobman's Swift Weekly #059 (weekly.fatbobman.com)
submitted 3 weeks ago* (last edited 3 weeks ago) by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #059 | "Recommended for You" or "Recommended for Traffic"

  • Using Transactions Instead of Save
  • Dive into Environment in SwiftUI
  • Spring Animations
  • Camera Control Issues
  • TimelineView
  • Bottom Sheets
  • Layout Protocol
10
 
 

This article explores how to use the concept of transactions in SwiftData and Core Data to build more reliable and efficient persistence operations.

11
3
Fatbobman's Swift Weekly #058 (weekly.fatbobman.com)
submitted 1 month ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #058 | Luck Rewards Patience

  • View Update Mechanism
  • Code Spelunking in DocC
  • AttributeGraph Notes
  • Beware @unchecked Sendable
  • Live Activity and Dynamic Island
  • Nested Transparent Objects
  • Concurrency Proposal Index
12
 
 

Understanding SwiftUI's View Update Mechanism: Starting from a TimelineView Update Issue

This article explores SwiftUI’s view update mechanism through a seemingly simple but representative TimelineView update issue.

13
5
Fatbobman's Swift Weekly #057 (weekly.fatbobman.com)
submitted 1 month ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #057 | Ultra-Wide Virtual Display is Great, But We Expect More

  • Data Tracking in Core Data & SwiftData
  • Ownership and ~Copyable
  • Dev Containers
  • Sendable with SwiftData
  • Swift Format in Xcode
  • Self-Sizing Flow Layouts
14
 
 

Core Data and SwiftData, as powerful persistence frameworks in the Apple ecosystem, not only provide declarative data listening tools like @FetchRequest and @Query, but also have a complete set of data tracking and notification mechanisms built-in. Understanding and mastering these mechanisms is crucial for building robust data-driven applications. This article will take you through multi-layered solutions—from simple custom notifications to the powerful Persistent History Tracking and SwiftData History—to help you handle various complex data synchronization scenarios.

15
7
Fatbobman's Swift Weekly #056 (weekly.fatbobman.com)
submitted 1 month ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #056 | Reflections on the Pixelmator Acquisition

  • Apple is Killing Swift
  • iOS Performance Optimization
  • Understanding Actors
  • AnchoredRelativeFormatStyle
  • Type-Driven Design
  • Swift Concurrency
16
 
 
17
 
 
18
4
Fatbobman's Swift Weekly #055 (weekly.fatbobman.com)
submitted 1 month ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #055 | Master Technology, Don't Let It Master You

  • KeyPath in Swift
  • SwiftUI View Contracts
  • Swift Macros
  • AnyView in Xcode 16
  • Exploring Cursor
  • Swift Testing
19
 
 

In the world of Swift, KeyPath is a powerful yet often underestimated feature. Many developers use it inadvertently in their daily programming without fully realizing its potential and importance. This article aims to delve deeply into the functional characteristics of KeyPath, revealing its unique charm in Swift programming, and helping you transform it into a powerful assistant in your development process.

20
3
Fatbobman's Swift Weekly #054 (weekly.fatbobman.com)
submitted 1 month ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #054 | Security, Convenience, and Privacy

  • Applying SwiftData Principles in Core Data
  • Copy On Write
  • @preconcurrency
  • Visualizing SwiftUI Animations
  • Exploring Cursor
  • Data Loss in UserDefaults
21
 
 

This article will explore how to apply SwiftData’s way of thinking within Core Data, focusing on data modeling and concurrent programming.

22
0
Fatbobman's Swift Weekly #053 (weekly.fatbobman.com)
submitted 2 months ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #053 | Breaking the Annual Release Cycle: A New Dawn for Tech Innovation?

  • UserDefaults + Observation
  • SwiftUI Animation
  • Using Binaries as Libraries
  • Why I Stopped Building for visionOS
  • Arrays vs Sets
  • Dependency Injection in Swift
  • AI-Generated Unit Tests
23
 
 

This article will explore how to efficiently and conveniently manage data in UserDefaults under the Observation framework and propose a complete and practical solution.

ObservableDefaults responds to changes in UserDefaults from any source, offering the precision of Observation while maintaining the flexibility of AppStorage in handling modifications.

24
0
Fatbobman's Swift Weekly #052 (weekly.fatbobman.com)
submitted 2 months ago by fatbobman to c/swift
 
 

Fatbobman's Swift Weekly #052 | Reflecting on the Original Aspiration: On the First Anniversary of the Weekly's Inception

  • Dev Conversations
  • VoiceOver and Voice Control
  • Shared With You
  • UIKit or SwiftUI
  • SwiftUI Environment
25
view more: next ›