Category "swiftui"

automatic delete token in userdefaults after 6 hours in swiftui

I have two apis Login DataShow when i login server gives me token which remains valid for only 6 hours and i am saving it in userdefaults, so that user will not

In SwiftUI how can I clip a part of a view with another view?

I am trying to overlap two circles in SwiftUI and have a margin between them. I am presently using this method: ZStack { Circle() .frame(width: 60,

How to use view modifiers only available for iOS 14+ with deployment target of iOS 13

How can you add a view modifier to a view when it's only available on iOS 14 but your app is available for iOS 13? For an example, textCase(_). Section headers

Size a UILabel in SwiftUI via UIViewRepresentable like Text to wrap multiple lines

The goal is to get a UILabel integrated via UIViewRepresentable to size the same way Text does - use the available width and wrap to multiple lines to fit all t

SwiftUI Adjusting frame size of VStacks by percent height

I have a card view. Which sizes I give myself. I know that is wrong. I want to do it resizable and divided by percent like blue = 70% & red = 30% or somethi

How to change toggle on just one Core Data item using ForEach in SwiftUI?

How to change just one toggle in a list without subviews? I know how to make it work if I extract Subview from everything inside ForEach, but how to do it on on

SwiftUI, multiple shapes with unified shadow?

Is there a way in SwiftUI to union two shapes so that they cast a unified shadow. I have tried various combinations and modifiers but don't seem to be able to a

Binding to an associated value of an enum

Is there a standard way to bind, say, a TextField to an associated value of an enum? So, given this: enum Choice { case one(String) case two(String) } C

Combining Navigation Bar, TabView and searchable causes the NavigationBar UI issue with lists

Combining Navigation Bar, TabView and searchable causes the NavigationBar and Search InputField to stay stationary when scrolling up on the second selected tab.

WKWebView - Update HTML Tags from SwiftUI TextFields

In my SwiftUI App, i used a WKWebView to update some html tags from native side, using SwiftUI TextFields and a TextEditor. To get the communication working, i

Rectangle progress bar swiftUI

Hey does someone know how can I create rectangle progress bar in swiftUI? Something like this? https://i.stack.imgur.com/CMwB3.gif I have tried this: struct

Get Shape for view dynamically in SwiftUI

Using Swift 5.2 I would like to create a function to dynamically change the Shape I have a view like import SwiftUI struct CardView: View { let suit : S

SwiftUI DatePicker breaks sheet dismiss?

Scenario: RootScreen presents DateScreen modally though .sheet DateScreen has a DatePicker with CompactDatePickerStyle() and a button to dismiss the modal User

unable to align multiple controls in SwiftUI

I'm trying to align controls as shown in "Storyboard" pic using the SwiftUI but not sure why still there is distance between segment control and search-Bar, and

Swipe to delete function

using my code below how can I swipe right to left on a Task to have an option to be able to delete it. I have tried using .SwipeAction but have gotten no luck w

SwiftUI - how to avoid navigation hardcoded into the view?

I try to do the architecture for a bigger, production ready SwiftUI App. I am running all the time into the same problem which points to a major design flaw in

How to apply a context menu to buttons in a SwiftUI list row?

When I'm long-pressing on a button in list row, all of context menus for all buttons are shown. It looks like the whole list row is selected. How can I make it

SwiftUI: Display file url from Array after user Picks file using DocumentPicker

I followed a tutorial on getting Url from a Document a user chooses and be able to display it on the View. My problem now is I want to add those Url's into an a

SwiftUI MVVM Coordinator/Router/NavigationLink

I am having problems to translate UIKit architecture patterns to SwiftUI. My current pattern is mostly MVVM with Coordinators/Routers. The MVVM part seems quite

How to detect current device using SwiftUI?

I am trying to determine whether the device being used is iPhone or iPad. Please see this question: Detect current device with UI_USER_INTERFACE_IDIOM() in Swi