Relative Content

Tag Archive for swiftui

SwiftUI ShareLink not working inside ForEach

I’ve been working with SwiftUI ShareLink for a bit and I’ve noticed there are some contexts in which it doesn’t seem to work but it’s not clear as to why. More specifically, I’ve noticed that a share sheet doesn’t pop up when the ShareLink is tapped inside of a ForEach loop but when moved outside of the loop, it works fine and pops as expected.

Basic SwiftUI code not working in landscape

I am integrating a swift UI view in a UIKit application, my swift ui view is cut off when switching from portrait mode to landscape mode. I have followed tutorial online and my ViewController looks like:

I need to fix SwiftUI

import SwiftUI struct ContentView: View { @State var isError = false var body: some View { Button { isError = true } label: { Text(“CHMO”) .background(Color.orange) .cornerRadius(10) } .confirmationDialog(“are you sure”, isPresented: $isError) { Alert(title: Text(“Gooo”), message: Text(“No More”), primaryButton: .default(Text(“Yes”)), secondaryButton: .cancel(Text(“No”))) } VStack { Image(systemName: “globe”) .imageScale(.medium) .foregroundStyle(.brown) Text(“Hello, world!”) } .padding() } […]

Circular Image in SwiftUI Menu

Every time I put an Image as Menu content in SwiftUI, I am unable to round its edges or clip its shape. I’d like my displayed image to be the shape of a circle.