Category "swiftui"

Manually set light/dark mode in SwiftUI and save users choice

I found a solution to manually set light/dark mode in a swiftui app in another thread found here https://stackoverflow.com/a/58476468/11698443 it mostly works,

How to enable pasting with keyboard shortcut into SwiftUI macOS agent application

I'm creating an app with Swift 5 and SwiftUI. The application runs as a status bar app (LSUIElement is true). I've created a simple preferences window with Swif

SwiftUI / Xcode Error - Updating took more than 5 seconds

When I try to preview one of my views in the canvas I keep getting the following error: PreviewUpdateTimedOutError: Updating took more than 5 seconds All

How to work with bindings when using a view model vs using @Binding in the view itself?

@State and @Binding work so well in SwiftUI, as long as you put all the view's data inside itself, like this: struct ColorView: View { @Binding public var

How to animate transition between views in SwiftUI?

I have the following view. import SwiftUI struct AppView: View { @EnvironmentObject var appStore: AppStore var body: some View { ZStack {

SwiftUI Pass Value from Geometry Reader to Function

I have a view which uses Geometry Reader to calculate how large the image area should be: GeometryReader { metrics in ZStack{ self.image

SwiftUI - how to detect long press on Button?

I have a Button where when it gets pressed, it performs some actions. But I would like to modify the same Button to detect a longer press, and perform a differe

SwiftUI HStack with equal Height

I want the Text("111") to have the equal height of the VStack containing 2222... and 333.... struct Test7: View { var body: some View { HStack (alignment:

Get CGRect of View

I'm using a "RectGetter" to get the CGRect of a View. Like this: Text("Hello") .background(RectGetter(rect: self.$rect)) struct RectGetter: View {

Swiftui - Fetch data after login

I'm starting to learn SwiftUI and i'm looking for better solution to fetch user data after successful login. For example, i need to see if the user has the acco

Blank Map with Mapbox and SwiftUI

I try to use Mapbox with SwiftUI. I applied this answer https://stackoverflow.com/a/56551675/5653544 and also followed the mapbox tutorial. So I have a MapV

SwiftUI: How to do additional work when clicking a NavigationLink?

Right now I have a navigation link NavigationView { NavigationLink(destination: AnotherView())) { Text("Click Here") } } .navi

Which watchface uses CLKComplicationTemplateGraphicExtraLargeCircularView?

Is there a documentation/web page on which Apple Watch watch faces uses which complication types? I am trying to find which watch face uses CLKComplicationTempl

SwiftUI how to align the view‘s leading to the most super view’s leading?

I’m new to SwiftUI and I’m making a widget. The default code included a text view which is both x-centered and y-centered in the super view(which I

I'm trying to use "objectWillChange.send()" in an protocol extension but it's not working, any idea why?

I've a SwiftUI navigation view showing a list of players. I designed the view model protocols as follows. protocol PlayerListStateProviding: ObservableObject

SwiftUI - How can I blur the default background color of a view?

no code to show here, but I would like to know how it may be possible to do this. I have tried to use .blur(radius: (20) on a view, but it tends to blur the

SwiftUI UIApplication.shared.isIdleTimerDisabled = true just on one View

How can i turn Sleep off when just one View is Appeared ? UIApplication.shared.isIdleTimerDisabled = true stop the screen from going to sleep on every View. how

SwiftUI: How do I "zoom in" to a specific CardView on a tiled interface?

I am trying to build a tiled interface out of CardViews. I want the user to be able to tap on a Card and have that Card expand to take up the available space,

SwiftUI List rows in Edit Mode do not allow Buttons actions/NavigationLinks to work?

SwiftUI List rows in Edit Mode do not allow Buttons actions to work I note (as well as NavigationLinks too). Is there a way to get this working? Goal - Want

SwiftUI + Dynamic action closure for Button

I am exploring SwiftUI and I was able to create a subclass of Button. The subclass contains image & title properties, which makes it a reusable component.