Post

Replies

Boosts

Views

Activity

Swift Playgrounds Incompatibility with Xcode 16 Files and Swift Versions
I'm facing an issue with Swift Playgrounds and files created in Xcode 16. It seems that Swift Playgrounds does not support Swift 6, but even when I create files specifically with Swift 5, Swift Playgrounds still reports that the files are unsupported. This creates a significant problem because macOS Sequoia does not allow me to revert to Xcode 15, which might have offered better compatibility. As it stands, I can't find a solution to work seamlessly between Xcode and Swift Playgrounds. Has anyone else encountered this issue? Are there any workarounds or updates planned to address this compatibility gap? Any advice would be greatly appreciated!
5
1
929
Oct ’25
Swift unable to find sound file
Hi everyone, I'm currently facing an issue with AVAudioPlayer in my SwiftUI project. Despite ensuring that the sound file "buttonsound.mp3" is properly added to the project's resources (I dragged and dropped it into Xcode), the application is still unable to locate the file when attempting to play it. Here's the simplified version of the code I'm using: import SwiftUI import AVFoundation struct ContentView: View { var body: some View { VStack { Button("Play sound") { playSound(named: "buttonsound", ofType: "mp3") } } } } func playSound(named name: String, ofType type: String) { guard let soundURL = Bundle.main.url(forResource: name, withExtension: type) else { print("Sound file not found") return } do { let audioPlayer = try AVAudioPlayer(contentsOf: soundURL) audioPlayer.prepareToPlay() audioPlayer.play() } catch let error { print("Error playing sound: \(error.localizedDescription)") } }
8
0
2.7k
Jan ’25
Xcode 13 - Swift compile error
Dear community, Yesterday I update Xcode from 12.5.1 to 13.0 and I came across a lot of compile error. Until before the update all was working great, but I suppose probably some syntax rules changes with the update for iOS 15.  .background(Color.systemBlue) error: Type 'Color' has no member 'systemBlue'  .maxWidth(.infinity) error: Cannot infer contextual base in reference to member 'infinity' Value of type 'Image' has no member 'maxWidth' .aspectRatio(contentMode: .fit) error: Cannot infer contextual base in reference to member 'fit'  Image(.system("line.horizontal.3.circle.fill")) error: Type 'String' has no member 'system' .font(.largeTitle, weight: .bold) errors: - Cannot infer contextual base in reference to member 'bold' - Extra argument 'weight' in call  Image(section.logo) .resizable() .height(32) error: Value of type 'Image' has no member 'height' Command CompileSwift failed with a nonzero exit code I hope that this one will fix by itself Basically I got 23 errors... and the code before yesterday was working great. Thanks to those who will help me, hoping it will be useful to other users, Martin
2
0
3.1k
Oct ’21