Hello :)
You can try to add .toolbarBackground(.visible, for: .navigationBar) below the navigation title modifier.
Post
Replies
Boosts
Views
Activity
Hello :)
That‘s interesting because I had the exact same issue a few months ago and I haven‘t found a solution for it yet. I can’t remember if I changed anything but it worked for me after I tried it again a few hours later… maybe it just needs some time to really revoke the first key.
Hello :)
First things first: that piece of code is working on a fast internet connection, and I don't get any error message. As far as I can tell, the problem is that the loading process is placed to the Main Thread. That causes some blocking on slow internet connections. Some others had the same issue (more to find here).
You can try to use this:
struct ContentView: View {
@State private var player = AVPlayer()
var videoUrl: String = "https://video.twimg.com/amplify_video/1760315643142750208/vid/avc1/640x360/-1etorSK7w2g9Nlc.mp4?tag=16"
var body: some View {
VideoPlayer(player: player)
.task {
player = AVPlayer(url: URL(string: videoUrl)!)
}
}
}
Please let me now, if this fixes your error message. If not, we will find a solution.
Hello :)
I would recommend you to use the .environment(). Therefore you create one instance of your ViewModel in order to handle it through the hierarchy to be accessible whenever it is necessary. Apple shows us with this example:
@main
struct BookReaderApp: App {
@State private var library = Library()
var body: some Scene {
WindowGroup {
LibraryView()
.environment(library)
}
}
}
And for the LibraryView():
struct LibraryView: View {
@Environment(Library.self) private var library
var body: some View {
List(library.books) { book in
BookView(book: book)
}
}
}
You can find more information here.
If you have any further questions don’t hesitate to ask.
Hello :)
One opportunity might be to connect your iPhone to your Mac. Simply by choosing your iPhone as a run device and executing, Xcode will install your application on your device. After that you can use your application. If you have any further questions, don’t hesitate to ask :)
Hello :)
I don’t have a solution for that but I had the exact same issue. It uploaded after I deleted the previews and tried it again but I think you might have already tried that.
Hello :)
That's a really interesting question. I tried many things but I only found two different approaches.
The problem is, you don't get the form's height itself in any way because a form always takes as much vertical space as it gets.
So that's why you could fix the height of the image, so that there is enough space for the form with its content. The drawback of this solution is, that if the content in the form gets more and more, it's not visible anymore when it gets too much. It would be something like:
Image(systemName: "gear")
.resizable()
.scaledToFit()
Form {
Section("section 1") {
Text("text 1")
Text("text 2")
Text("text 3")
}
Section("section 2") {
Text("text 1")
Text("text 2")
Text("text 3")
}
}
.scrollDisabled(true)
.frame(height: 500) //added the .frame() modifier
Another approach would be to not use the Form. By using a normal VStack with the .layoutPriority() modifier the image gets maximized dynamically and the VStack adjusts its height itself. The advantage is that you can fill the VStack with any content you want and the image resizes itself. Example would be:
Image(systemName: "gear")
.resizable()
.scaledToFit()
VStack {
ForEach(1..<9) { value in
HStack {
Text("Test + " + value.description)
Spacer()
}
.padding(.leading)
.padding(.bottom, 4)
}
}
.layoutPriority(1) //very important, otherwise it won't work
Maybe someone else found another solution but I think the second approach might be the best way to start in order to see everything good and adjusted on any device.
If you have any further questions, don't hesitate to ask :)
Hello :)
Yes, both syntaxes are equivalent. The only difference is that if a>b, c>d is evaluated as two separate expressions and if a>b && c>d is treated as one whole expression :)
Hello :)
Can you share the piece of code to see where the problem might appear? Do you save the information locally or synchronized with CloudKit?
Hello :)
Here is the link for the CloudKit Console. There you can manage all your iCloud stuff like containers.
There is still no way to delete CloudKit containers. So the only opportunity is to hide them as you already did.
If you have further questions, don't hesitate to ask :)
Hello :)
You just need to embed your whole VStack (so everything inside the var body: some View {}) into a NavigationStack, then it works.
If you have further questions, don't hesitate to ask :)
Hello :)
you can check this post, someone else had the exact same issue. If you have further questions, don’t hesitate to ask :)
That's awesome! You don't need to close this thread, it might be a problem for other developers. Then they can see a possible solution too. If there are any further questions, don't hesitate to ask :)
Hello Andrea :)
there seems to be a problem with the certificates. Try to go to the top left corner, click "Xcode", then go to "Settings" and then choose "Accounts".
Your Apple-ID should be listed there. Click the button "Download Manual Profiles".
Try to restart Xcode. Maybe it is working then.
I hope, this might help.
Hello :)
SwiftData only supports primitive types (Int, Bool, ...) currently, so there is no possibility to save a color itself at the moment. In order to save a color you can choose different approaches.
For example, you could define a SwiftData Model to save the different values of red, green, blue and alpha like this:
final class ColorModel {
var red: CGFloat
var green: CGFloat
var blue: CGFloat
var alpha: CGFloat
init(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) {
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
}
}
Then you can display your colors through the following code (simplified here in a ForEach(), has to be adjusted):
ForEach(colors, id: \.self) { color in
Color(UIColor(red: color.red, green: color.green, blue: color.blue, alpha: color.alpha))
}
If you have any further questions, don't hesitate to ask.
I hope I was able to help you.