Category "swiftui"

SwiftUI TabView PageTabViewStyle prevent changing tab?

I have a TabView in SwiftUI in the PageViewTabStyle so i can swipe from page to page. I'd like to have a setting that "locks" the current view in place, so the

Why am I getting "Instance method 'background(_:alignment:)' requires that 'UIColor' conform to 'View'"?

I would like to understand why am I having issue with the background()? Instance method 'background(_:alignment:)' requires that 'UIColor' conform to 'View' v

SwiftUI DragGesture only in one direction

I'd like SwiftUI DragGesture to start only when the gesture is in a specific direction (horizontal/vertical). Is it possible?

SwiftUI TextField with formatter broken when built with Xcode 13.3?

It looks like Xcode 13.3 broke the TextField with formatter. In example below the Text should show the value entered in the TextField, which works fine when bui

How to view PDF from Firebase Storage - SwiftUI PDFVIEW

I am having some issues trying to display a PDF which is stored in Firebase Storage in my SwiftUI app. I have successfully done the following; Uploaded a PDF fi

Segue To UIViewController From SwiftUI View

I am working to implement some SwiftUI content into my existing app. I currently have a UIViewController, which hosts a MTKView for camera preview. I have cre

SwiftUI - Animations triggered inside a View that's in a list doesn't animate the list as well

I have a List that's displaying two Views of the same type. When you tap on one of the views, they change their height with an animation. However, the List tho

How to get the iPhone's screen width in SwiftUI?

I want to resize an Image frame to be a square that takes the same width of the iPhone's screen and consequently the same value (screen width) for height. The

SwiftUI - text gets truncated after embedded on a ScrollView

When added a long text inside a text view, it works as expected (not truncated). Xcode 11.0 beta 6 (11M392q) import SwiftUI struct ContentView: View { v

Inject a StateObject into SwiftUI View

Can @StateObject be injected using Resolver? I have the following: struct FooView: View { @StateObject private var viewModel: FooViewModel some code }

SwiftUI Emoji Keyboard hidden with ScrollView

When I try below code and show Emoji keyboard, keyboard will hide with Emoji keyboard horizontal scroll. I applied "keyboardDismissMode" to make keyboard hide w

How to use a SwiftUI view in place of table view cell

How can I use a SwiftUI view struct in place of a traditional cell and xib in a UITableViewController? import UIKit import SwiftUI class MasterViewController:

SwiftUI: Sheet cannot show correct values in first time

I found strange behavior in SwiftUI. The sheet shows empty text when I tap a list column first time. It seems correct after second time. Would you help me? impo

SwiftUI hiding navigation bar affects other animations

I have the following SwiftUI view and I want to have it repeat the scale animation to simulate a pulsing effect. However, in addition to the scaling, the circle

Why does binding to the Picker not work anymore in swiftui?

When I run a Picker Code in the Simulator or the Canvas, the Picker goes always back to the first option with an animation or just freezes. This happens since l

How to display an int without commas?

I have a list of Text views that include a year saved as an int. I'm displaying it in an interpolated string: Text("\($0.property) \($0.year) \($0.etc)") The p

UIHostingController and navigationController

Default swift project with view controller embedded in navigationController and pushing to next UIHostingController. How to call navigationController?.popViewC

Error message: Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffeead03e18)

I'm creating an app and I get this error: Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffeead03e18). Whole code runs without any errors, it's just when I try to

SwiftUI TextField binding to Double not working with custom Formatter

I have a Binding to a Double parameter that is set by a SwiftUI TextField. I use a custom Formatter that converts to and from a Double value. The TextField

SwiftUI: Translucent background for fullScreenCover

So technically I want to show a loading screen view. I'm using fullScreenCover. struct ContentView: View { @State private var isLoading = false