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 :)
Post
Replies
Boosts
Views
Activity
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
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
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!
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!
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)")
}
}
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!