Skip to main content

Questions tagged [swiftui]

SwiftUI is a way to build user interfaces across all Apple platforms. Build user interfaces for any Apple device using one set of tools and APIs. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with Xcode design tools to keep your code and design perfectly in sync. Automatic support for Dynamic Type, Dark Mode, localization, and accessibility. Use this tag for questions about SwiftUI on any platform.

swiftui
0 votes
0 answers
8 views

How to pad a button to fit its view in a SwiftUI form

I have a page in swift like below. import Foundation import SwiftUI struct SomeViewName: View { @State private var languages = [String]() var body: some View { NavigationView { ...
Metadata's user avatar
  • 2,105
-1 votes
0 answers
19 views

Downloading video in .m3u8 file for caching in iOS

I currently receive videos from an API in .m3u8 format that contain only 1 video per file. I can play these videos just fine using the URL to the .m3u8 file directly in AVPlayer. However, I would like ...
fadipon's user avatar
  • 11
0 votes
0 answers
8 views

Swiftui share view controller called the app, but SceneDelegate method is never called

We're building a PDF share extension. The app is launched, but the SceneDelegate isn't, so the scheme can't be used further. I assume the controller works fine, but the SceneDelegate can't print ...
ao xu's user avatar
  • 11
0 votes
1 answer
24 views

How to decode a JSON API (php) call and then display it as text in a ScrollView - SWIFTUI

I have been trying to decode a JSON from a PHP that I have and then displaying the results as Text. I am getting either one of two errors with everything I have tried. The first issue would be "...
HKelz's user avatar
  • 1
1 vote
1 answer
21 views

Dismiss keyboard in ios17

I am having trouble getting the keyboard to dismiss. When nil it should dismiss but it's not working so I added the dismiss but that's also not working. The keyboard flashes but stays. Any ...
David's user avatar
  • 287
0 votes
0 answers
19 views

Why does LazyHStack render the first 3 views therefore calling onAppear too early?

I want to toggle a Boolean state when a view is visible in the phone screen. I've made the LazyHStack as below however, the following 2 views, somehow is already appeared. I tried using the new API ...
Vina's user avatar
  • 989
-1 votes
1 answer
15 views

How do you use selection in a List when it has a foreach in inside it

I had a list that was bound to a selection that was working as intended: @State private var selection: ExerciseName? List(exercisesNames,id: \.self, selection: $selection) { exercisename in ...
Milan Labus's user avatar
-3 votes
1 answer
29 views

Convert adress to coordinates

I got a little problem with changing the value of an object. I have got the following code and want to change the value of the object. import SwiftUI import MapKit import CoreLocation struct ...
Libiph's user avatar
  • 537
1 vote
0 answers
35 views

SwiftUI unexpected body render

I'm trying to understand how SwiftUI decides whether or not to re-render a view; In this example I have a PageView which shows horizontal scrollable pages through a DragGesture for every week, very ...
Rico Crescenzio's user avatar
-3 votes
0 answers
41 views

How do you check if a Swift date is next month?

I have a functionality where the user can swipe through months using buttons: @State private var selectedDate: Date = Date.now ToolbarItem(placement: .principal) { HStack { ...
Milan Labus's user avatar
-2 votes
0 answers
25 views

How to make scrollView items disappear after scrolling past a certain point in Swift?

Currently I'm trying to implement a scrollView in my app where I want the items of the scrollView to disappear once they hit the blue border (which is the outline of the scrollView container). ...
Jesse Tzo's user avatar
1 vote
1 answer
28 views

Animate Map Annotation Swift UI

I am trying to animate map annotations when they appear with an interactive spring. But currently no animation takes place. The actual annotation label does not accept any view modifiers like ....
Ahmed Zaidan's user avatar
0 votes
1 answer
34 views

Get SwiftUI preview to work with NavigationStack

I've abstracted my navigation into a service for my SwiftUI app. When I run it on the simulator or physical device it works perfectly. However, when testing in the #Preview, the navigation doesn't ...
markb's user avatar
  • 1,186
0 votes
1 answer
34 views

Unit testing a published variable

I have a set up like this: class ViewModel: ObservableObject { @Published var data: [Int] = [] func fetchData() { someAPICall() { result in data = result // Assume 10 ...
Shawn Frank's user avatar
  • 5,043
-1 votes
0 answers
31 views

Managing Shared ModelContext for Adding Items in SwiftUI from Both ContentView and Background Tasks

I’m working on Testing a SwiftUI project using SwiftData where I need to add Book objects to my model context from both the ContentView and a background task. I want to ensure that both operations use ...
Damiano Miazzi's user avatar

15 30 50 per page
1
2 3 4 5
2638