Search results for

Swift 6

49,196 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
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 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
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
Reply to mapkit js erro 401 Unauthorized
authorizationCallback:function(done) { // 注意这里不能 async done(eyJraWQiOiI3OVNYVEdIOU45IiwidHlwIjoiSldUIiwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiIzSzQ4UEE2MjRNIiwiaWF0IjoxNzU1ODAwMDAyLCJleHAiOjE3NTY0NTA3OTl9.qUD9RUV7oC6LAo1KmpDCst-CUyEvz1Lbk5ZPt4E3E0z0q_lFoES8YsJGdSc4_UV405XyCaBfyFNBP-BlKZzQew) }, language: zh-CN, }); // 使用的方法 async function getCurrentLocation() { if (!navigator.geolocation) { error.value = 您的浏览器不支持地理定位; return; } try { await mapTokenManager.initializeMapKit(); map = new (window as any).mapkit.Map(mapContainer.value); } catch (err) { error.value = 地图初始化失败; console.error(err); } isLoading.value = true; error.value = ; navigator.geolocation.getCurrentPosition( (position) => { currentLocation.value = { latitude: position.coords.latitude, longitude: position.coords.longitude, accuracy: position.coords.accuracy, timestamp: position.timestamp }; // 在地图上显示位置 if (map) { const coord = new (window as any).mapkit.Coordinate( position.coords.latitude, position.coords.longitude ); map.setCenterAnimated(coord); //
2w
Xcode 26 betas not work working
Hi all, I'm trying to install the Xcode 26 beta on Tahoe (M4 Mac mini). I tried the latest beta 6 both the universal and the apple silicon version, but at startup the system says the app is corrupted and will be deleted. I tried this multiple times - always with a fresh download. Then I downloaded the beta 5, which told me at startup that there is no macOS SDK available and then Xcode also quits. I want to update/test my macOS apps for the upcoming Tahoe and want to adapt for the new design. On my Mac is the Xcode version 16.4 installed and this is working correctly. In the last years I started with earlier versions of Xcode betas, but this year I'm a little bit more late. Are there any steps I missed or is this a known issue yet? I had never before so much trouble installing any beta. What can I do? Best regards, Jürgen Terpe
1
0
131
2w
Reply to iOS folder bookmarks
I figured out some further details: When I get a file or folder URL from the picker, I need to call startAccessingSecurityScopedResource on it first prior to converting it to a bookmark. If I don't do that and try to convert that URL to a bookmark, I am seeing this error in the console: [ERROR] getattrlist(/7{34}3/D{7}s/2{8}2/N{2}1/0{8}7/1{6}3/2{69}0.png) = 1 However, the call to make a bookmark: url!.bookmarkData(options: [], includingResourceValuesForKeys: nil, relativeTo: nil) doesn't return an error. Basically, yes, that all makes sense in terms of what's happening in the lower-level system. The situation isn't something I can easily describe, but the practical description is that the way the iOS's different file access control systems overlap means that your code can end up working that really shouldn't work. A few quick suggestions here: If it's feasible, I'd recommend testing your code as a native macOS app (not the simulator or in compatibility mode). macOS is better at enforcing the right be
Topic: App & System Services SubTopic: Core OS Tags:
2w
Unity GameKit plugin beta GameKit Activity UnsupportedOperationForOSVersion
I’m running into unexpected problems with the Unity GameKit plugin setup with the new Activities. I didn’t see anyone else mentioning these issues, so my guess is that it’s a problem with my setup. The authentication (GKLocalPlayer.Authenticate()) works as expected, but any call to the new GameActivity functionality (e.g. GKGameActivityDefinition.LoadGameActivityDefinitions() or GKGameActivity.WantsToPlay) gives me an exception with a 'UnsupportedOperationForOSVersion' reason despite it running on an iOS 18.6.1 device. I’m using a completely empty Unity 2022.3.62f1 project that only contains the official authentication example, followed by an event handler for activities from another example and the Unity core and gamekit plugins. The setup: macOS 15.6 Xcode 26 beta 6 (also tried with 5) Physical iPhone device running iOS 18.6.1 Unity 2022.3.62f1, which satisfies the requirements Unity plugin, Xcode setup, and build steps: I Followed the official beta branch build steps for Unity plugins with python3
2
0
410
2w
Reply to Where's the replacement for Quartz Debug?
Hello, Quartz Debug is available as an additional tools package for Xcode. For example, Additional Tools for Xcode 26 beta 6 contains: This package includes audio, graphics, hardware I/O, and other auxiliary tools. These tools include AU Lab, OpenGL Driver Monitor, OpenGL Profiler, Pixie, Quartz Debug, CarPlay Simulator, HomeKit Accessory Simulator, IO Registry Explorer, Network Link Conditioner, PacketLogger, Printer Simulator, 64BitConversion, Clipboard Viewer, Crash Reporter Prefs, Dictionary Development Kit, Help Indexer, and Modem Scripts.
2w
Invalid large app icon with Xcode 26 beta 6
I’m having a bit of trouble uploading my new icon to the App Store Connect. I created it entirely with Icon Composer, but it keeps throwing an error saying it’s an “Invalid large app icon.” The error message says that the large app icon in the asset catalog can’t be transparent or have an alpha channel. I only have one AppIcon in the asset catalog, and I’ve checked the “single size” option, which is set to 1024x1024 for any, dark, or tinted size. In the past, when I used the previous icon with the iOS 18 SDK, I didn’t have any issues uploading it. However, when I created the new icon with Icon Composer and compiled it with Xcode Beta, it broke. I’m a bit confused because the error message suggests that removing transparency is the solution, but the whole point of Icon Composer is to make the icon transparent for the new liquid glass design. I don’t want to remove the cool look that my new transparent icon has. Could you please help me out? I’d really appreciate it. Thanks a bunch!
2
0
121
2w