Category "swiftui"

How do I detect when User has reached the bottom of the ScrollView?

I used the following code as a reference: SwiftUI - Get size of child? SwiftUI - How to get size (height) of ScrollView content Get the current scroll position

SwiftUI: preview doesn't display content in list [duplicate]

I have created a very simple test in SwiftUI: Pokemon struct Pokemon: Identifiable { let id: Int let name: String } PokemonList struc

Thread 4: Fatal error: 'try!' expression unexpectedly raised an error

I'm trying to learn to make an API call in swiftUI, I'm following the next tutorial https://www.youtube.com/watch?v=1en4JyW3XSI but the code is giving me an err

SwiftUI & WidgetKit: Why Intent Handler does not load saved data?

I'm building a Widget with dynamic configuration. I provide a dynamic list of options with an Intents Extension - inside Intent Handler (code below). However on

Restoring macOS window size after close using SwiftUI WindowsGroup

By default, on a macOS app using SwiftUI the window size is not restored after the window is closed. Is there a way to keep whatever size & position the use

How to execute a CPU-bound task in background using Swift Concurrency without blocking UI updates?

I have an ObservableObject which can do a CPU-bound heavy work: import Foundation import SwiftUI @MainActor final class Controller: ObservableObject { @Pub

Creating a macos windowless menu bar application with SwiftUI

I am looking for a solution to create a macos windowless menu bar application with SwiftUI. I have implement the function ralated to the menu bar, the problem i

How to enter the amount of shapes in for each identifiable loop SwiftUI

I am beginner in SwiftUI, updating my app and remaking it on SWIFTUI. Here is the screenshot what I had to do... Screenshot I've successfully done actually the

SwiftUI and tvOS: adjustsImageWhenAncestorFocused

How do you get the same focus effect in SwiftUI for images as you can with UIKit? I see you can use the card button style and it does provide motion effects but

How do I fix "Expression requiring global actor 'MainActor' cannot appear in default-value expression of property '_audioPlaybackManager'"?

I have created a class called "AudioPlaybackManager" which is a MainActor class as a StateObject when the app starts up. Im getting this warning. How do I fix t

How to write auto-toggle Publisher operator?

because of a requirement to auto remove Text after its appearance in 2 seconds, I want to write this operator but still cannot figure out the best way to implem

Using UISheetPresentationController in SwiftUI

I'm really struggling to wrap the new iOS 15 UISheetPresentationController for use in SwiftUI (for a half-modal). I understand that I should inherit UIViewContr

How to turn on showPhysics in a Swift UI SpriteView?

I have been playing with the SpriteView in iOS14 and its working quite well however, I noticed that some collisions that worked fine when using a UIViewcontroll

How can I force ProgressView to run its task again?

I have content that is loaded in the background. Loading is a long running task and I want to show data as soon as it's available. My view show loaded content a

Swift Switching from HTTPS to HTTP

This one's a weird one. I have a little API server that does some stuff that I want my mobile app to talk to. It has DNS and SSL correct configured, I can reach

SwiftUI: Animate subview when map annotation is selected

I have a MapView implementing UIViewRepresentable with the following coord function: func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView

"Expected to decode Dictionary<String, Any> but found an array instead.", underlyingError: nil; GitHub repo showing app; SwiftUI

I need to create an app that will be able to return all the repositories that a GitHub user owns. I created an app that contains of 3 files: CONTENT VIEW import

SwiftUI not detecting dark mode from setting

In SwiftUI on my device, I set the appearance to dark mode. However, my application doesn't change the background colour based on that appearance. For the color

View resizing when hiding tab bar with Introspect in SwiftUI

I'm using Introspect to hide the tab bar on child navigation link pages. However, I've noticed some odd behavior when the app is backgrounded and then brought b

SwiftUI: How do you implement List + ForEach loop for child elements (shown in a disclosure group)?

Currently, my app uses only a list view to display folders (as seen below). All of the tutorials online suggest that for dynamic content (In my case, an array o