Search results for

Swift 6

49,195 results found

Post

Replies

Boosts

Views

Activity

Reply to Seeing some behaviour in Swift that I don't understand...
This suggests to me that my Sunday and Monday static instances are being passed by reference No, that's not the problem. But this way of adding a new trigger is causing the problem. fetchTriggers.append(Int.random(in: 1..<3) == 1 ? .sunMorning : .monEvening) This adds a new item. By it adds the same Sunday or Monday, with its existing ID. So, you reuse the same struct. Change to this to solve: Button(New Trigger) { let newTrigger = Int.random(in: 1..<3) == 1 ? FetchTrigger(dayOfWeek: .sunday, hour: 3) : FetchTrigger(dayOfWeek: .monday, hour: 6) fetchTriggers.append(newTrigger) // fetchTriggers.append(Int.random(in: 1..<3) == 1 ? .sunMorning : .monEvening) } You can also create a new ID: struct FetchTrigger: Identifiable { static var monEvening: FetchTrigger = .init(dayOfWeek: .monday, hour: 6) static var sunMorning: FetchTrigger = .init(dayOfWeek: .sunday, hour: 3) var id = UUID() // all need to be var mutating func changedId() -> FetchTrigger { self.id = UUID() return self } and
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Reply to Possible typo in concurrency diagram (WWDC25: Elevate an app with Swift concurrency)
[quote='798011021, Blume, /thread/798011, /profile/Blume'] I noticed something in the slide/diagram that might be incorrect. [/quote] Yeah, I think you’re right. I’d appreciate you filing a bug against that video, and then posting your bug number here, just for the record. [quote='798011021, Blume, /thread/798011, /profile/Blume'] Swift 6’s concurrency model is doing a fantastic job at helping us write safer code—so thank you to the team for that! [/quote] That’s great news, and I’ll pass that along to the team. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Programming Languages SubTopic: Swift Tags:
2w
Reply to Equatable with default actor isolation of MainActor
[quote='797933021, InstantInteractive, /thread/797933, /profile/InstantInteractive'] I filed the following issue on swiftlang/swift on GitHub (Aug 8th), and a followup the swift.org forums [/quote] Please provide links to those items. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Programming Languages SubTopic: Swift Tags:
2w
Icon Composer and Xcode building time
Hi everyone, I’ve run into a strange issue while building my app with Xcode 26 beta 6 (targeting iOS 26). When I include an app icon created using Icon Composer, the build time jumps to over 5 minutes. During this time, I noticed that a utility called AssetCatalogSimulatorAgent is consuming a significant amount of CPU. If I remove the Icon Composer-generated icon from my target, the build completes in about 40 seconds. This behavior is consistent across multiple builds. Has anyone else experienced this? Is there a known workaround or optimization for icons created with Icon Composer? I’d love to keep using the new icon format, but the build time is becoming a real bottleneck. Thanks in advance!
3
0
198
2w
Possible typo in concurrency diagram (WWDC25: Elevate an app with Swift concurrency)
Hello, While watching WWDC25: Code-along: Elevate an app with Swift concurrency at timestamp 25:48, I noticed something in the slide/diagram that might be incorrect. The diagram shows ExtractSticker twice, but based on the code context and spoken explanation, I think it was meant to be ExtractSticker and ExtractColor. Reasoning: The surrounding code and narration describe the use of async let and a Sendable Data object. From the flow, one task extracts a sticker while the other extracts a color, so it seems like the diagram is inconsistent. I do understand that with @concurrent, having two ExtractSticker operations on the same Data is technically possible (with two concurrent process executing their respective ExtractSticker) — but that would be a different meaning than what the talk was describing. Since concurrency is already a subtle and error-prone topic, I thought it was worth pointing this out. If I’m mistaken, I’d love clarification. Otherwise, this could be a small correction to keep things a
2
0
1.5k
2w
Reply to Learn to code / beginner
Welcome to the forum. A first comment: edit your text to make each question clear and post easier to read. And avoid asking so many questions on so different topics. Anyway, I'll try to provide some answers. Q1: How should I best start learning? For example, is Swift Playgrounds the right first step? My personal advice: start with tutorials from Apple like 'Develop in Swift fundamentals'. Or go and visit https://developer.apple.com/pathways/. If you want to learn SwiftUI, select it. Q2: How should I continue afterwards to gain further knowledge, possibly in areas like system architecture, cybersecurity, or cloud computing (even though I don’t want to commit too early to one direction)? You will find resources here again: https://developer.apple.com/pathways/. My advice to continue, after step 1, is to imagine and develop a complete (yet simple) app. That's how you will put what you learned in practice. And then, each time you fall on a problem, ask the forum for help. Q3: Can you recommend a
2w
Reply to Output is stuck on String
First a question. What do you mean with: xoutput: () = self.xaxis.text = String(data.acceleration.x) Which type do you expect for xoutput ? Secondly, you redeclare xoutput. that's an error. var xoutput = xoutput * 9.81 Why not simply: var output = String(data.acceleration.x * 9.81) An advice, seeing some of your posts. You should probably spend some time to learn Swift and app development from Apple's tutorials. For instance, Develop in Swift fundamentals (in Apple Library).
2w
Xcode 26 and Plugin Support: Any Updates?
I’m new to iOS development. Previously, I’ve worked with Python and Django, mainly using JetBrains PyCharm PRO. In PyCharm, I really benefit from plugins like Rainbow Brackets , which help a lot with readability and code navigation. As someone who wears glasses, I find such visual aids very helpful for reducing eye strain. While exploring Xcode, I noticed that similar built-in features or up-to-date plugin support seem limited. Considering Apple’s strong focus on accessibility and user experience, I was a bit surprised by this. With Xcode 26 coming soon, I’m also wondering if there will be improvements in plugin support or built-in tools like Swift Linter and Swift Format. Are there any current tools or plugins you’d recommend to fill these gaps?
2
0
81
2w
Seeing some behaviour in Swift that I don't understand...
It's related to the passByValue nature of structs. In the sample code below, I'm displaying a list of structs (and I can add instances to my list using Int.random(1..<3) to pick one of two possible predefined versions of the struct). I also have a detail view that can modify the details of a single struct. However when I run this code, it will instead modify all the instances (ie either Sunday or Monday) in my list. To see this behaviour, run the following code and: tap New Trigger enough times that there are multiple of at least one of the sunday/monday triggers tap one of the matching trigger rows modify either the day, or the int expected: only one of the rows will reflect the edit actual: all the matching instances will be updated. This suggests to me that my Sunday and Monday static instances are being passed by reference when they get added to the array. But I had thought structs were strictly pass by value. What am I missing? thanks in advance for any wisdom, Mike struct ContentView: View { @State v
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
181
2w