Swift

365 readers
9 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 1 year ago
MODERATORS
26
27
28
 
 

“The Swift compiler is notoriously slow due to how types are inferred. Every June I hope that Apple will announce that they fixed it; sadly this is not that year.”

29
1
What's new in Swift 6.0? (www.hackingwithswift.com)
submitted 5 months ago by mattie@lemmy.world to c/swift@programming.dev
30
 
 

Hey all! I've been writing up a series on the changes coming to Swift 6 related to concurrency. Thought I'd start sharing them here too.

31
32
33
34
35
36
 
 

“Now that iOS 17 is available, let’s analyze its built-in apps to answer a few questions: How many binaries are in iOS 17? Which programming languages are used to develop these apps? How many apps are written with Swift? What is the percentage of apps using SwiftUI versus UIKit?”

37
 
 

cross-posted from: https://programming.dev/post/3558087

Type parameter packs and value parameter packs allow you to write a generic function that accepts an arbitrary number of arguments with distinct types. As a result of SE-393, SE-398, and SE-399, you can use this new feature from Swift 5.9.

38
39
 
 

In iOS 17, Apple added a range of sensory feedback view modifiers to SwiftUI removing the need to rely on UIKit.

40
 
 

#Predicate is a new Macro available since Swift 5.9 and Xcode 15, allowing you to filter or search a data collection. It can be seen as a replacement for the old-fashioned NSPredicate we’re used to from the Objective-C days.

41
 
 

An overview of the different types of charts you can make with Swift Charts

42
 
 

Get ready to dive deep into the inner workings of the Objective-C language and runtime! Each post delves into a specific aspect of the language and explores the details of its implementation. I hope you’ll find this valuable to demystify the language, tackle tricky bugs, and optimize your code for performance.

43
 
 

Hi,

I thought we could make a list of open source Swift projects that's open to public contribution. Which is one of the most effective ways to really learn programming.

We could follow this template to make it easy for readers:

Title in Bold

Short Description:

Link:

44
45
 
 

We’re excited to announce a new open source package called Swift HTTP Types.

Building upon insights from Swift on server, app developers, and the broader Swift community, Swift HTTP Types is designed to provide a shared set of currency types for client/server HTTP operations in Swift....

46
 
 

So I've got the following code, which seems to work, and I'm wondering if there is a better, cleaner way to approach adding/editing elements in an array.

var category: Category
var idx: Int = -1

switch mode {
case .add:
    category = Category()
case .edit(let _category):
    category = _category
    idx = categoryViewModel.categories.firstIndex(of: _category) ?? idx
}

category.name = categoryName
category.icon = "category-\(categoryIdx)"
category.color = colors[colorIdx]

switch mode {
case .add:
    categoryViewModel.categories.append(category)
case .edit:
    categoryViewModel.categories[idx] = category
}

I understand I'm not checking idx to make sure it's not -1. I'm not concerned about that part right now. It's the overall approach I'm looking for thoughts on.

Thanks!

47
48
 
 

Although at WWDC 2023, Apple will mainly focus on introducing the new data framework SwiftData, Core Data, as the cornerstone of SwiftData, has also been enhanced to some extent.

49
 
 

MainActor is a new attribute introduced in Swift 5.5 as a global actor providing an executor which performs its tasks on the main thread. When building apps, it’s essential to perform UI updating tasks on the main thread, which can sometimes be challenging when using several background threads. Using the @MainActor attribute will help ensure your UI is always updated on the main thread.

50
view more: ‹ prev next ›