Posts

Post marked as solved
7 Replies
512 Views
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)") } }
Posted Last updated
.
Post not yet marked as solved
1 Replies
613 Views
Hi devs, I was looking for a platform on which to send and store data received from an ios app. Considering that the data should then be send from the server to a website for statistical graphs, can anyone advise me which is the best server platform for this case? Thanks!
Posted Last updated
.
Post not yet marked as solved
0 Replies
558 Views
Hi, I searched all over the documentation, but I didn't find anything about that. Is there a method to save a frame as UIImage from an AVCaptureSession? Basically what I'm trying to do is saving an image as preview of an output of a capture session. Thank you anciently!
Posted Last updated
.
Post marked as solved
2 Replies
2.4k Views
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
Posted Last updated
.
Post marked as solved
3 Replies
2.6k Views
Hi, I'm new in coding :), I have a struct that contains variables in a .swift file. I need these datas on another .swift file. How can I import them? (They're on a SwiftUI based app) I have this on the first .swift file   struct MyVariables { static var infoProduct = "" static var idProduct = "" }      I have to use the infoProduct var on the other file Thanks
Posted Last updated
.
Post marked as solved
1 Replies
3.4k Views
Hi, I state that I am a self-taught developer, so I apologize if I will ask you some trivial questions. I developed an app in UIkit, but later decided to use Swift UI for the main grafic interface, implementing it on a HostingViewController. I wanted to ask if and how it is possible to make a button (SwiftUI button) open another ViewController (based on UiKit) Thanks guys :)
Posted Last updated
.