Category "swift"

UICollectionViewCompositionalLayout header misalignment

I have created a custom layout based on UICollectionViewCompositionalLayout that presents each section's items in a panel or card... ...here the blue area is

How to access own window within SwiftUI view?

The goal is to have easy access to hosting window at any level of SwiftUI view hierarchy. The purpose might be different - close the window, resign first respon

How to use sharing with CoreData/CloudKit synching

I have an app that works well synchronizing the local core data records with a private database. I would like to make the CloudKit database a shared database an

SwiftUI - How to close the sheet view, while dismissing that view

I want to achieve the function. Like, "Look up" view that is from Apple. My aim is when the sheet view push another view by navigation, the user can tap the na

iOS keyboard: How can I start with a disabled done/return/go button on the keyboard and KEEP it disabled until the validation requirements are met?

I've got a text field delegate setup which disables/enables the done button on keyboard when certain conditions are met (between 5 and 15 characters, not just w

SceneKit: How to constrain movement of a node to one axis locally, not the entire world

It's very easy to prevent movement of a node in one axis (X, Y, or Z) being moved by other forces with an SCNTransformConstraint.positionConstraint in world spa

SwiftUI: prevent View from refreshing when presenting a sheet

I have noticed that SwiftUI completely refresh view when adding sheetmodifier. Let's say I have View that displays random number. I expect that this value wou

How to make custom video player with swift

I'm trying to make a video player like youtube, with double-tap the screen to fast forward 5 seconds. But I'm having trouble implementing that. I tried using co

ios13 - UITabBar tintColor for unSelectedItem not working

In Xcode 10 unselectedItemTintColor property working properly but after Xcode 11 with ios 13 UITabbar unselectedItemTintColor property not working. override f

How can I display my user custom data in String format?

I'm new to Swift UI and MongoDB Realms. I'm trying to display a user's email (from their respective custom user data) in a text box but I'm getting a weird resu

Where's the particle system file in SceneKit in Xcode 11.3.1

Recently I updated my Xcode to 11.3.1. But while working with SceneKit, I found that I can't create a particle system file. Before After How can I create a

prefersStatusBarHidden issue in iOS 13

Hi everyone I'm trying to hide my statusBar in a View Controller but it doesn't seem to work .. I used the function: override var prefersStatusBarHidden: Bool

SwiftUI: observe @Environment property changes

I was trying to use the SwiftUI @Environment property wrapper, but I can't manage to make it work as I expected. Please, help me understanding what I'm doing wr

RealityKit – Difference between loading model using `.rcproject` vs `.usdz`

I'm building a simple app that adds a hat on top of the user's face. I've seen examples of 2 different approaches: Adding the object as a scene to Experience.rc

UISearchBar warning: UITextEffectsWindow should not become key. Please file a bug to Keyboard | iOS with this call stack

I have a UISearchBar in a view which I am presenting using: view.addSubview(searchView) searchView.mySearchBar.becomeFirstResponder() This works fine in most c

SwiftUI Picker SegmentedStyle Image bad display

I have a simple Picker in SegmentedStyle with two images inside: @State var selectedIndex = 0 @State var segmentOptions = [ Image.carFill, Image.walkin

SwiftUI add inverted mask

I'm trying to add a mask to two shapes such that the second shape masks out the first shape. If I do something like Circle().mask(Circle().offset(…)), th

SwiftUI: how to detect when List is scrolled? [closed]

I have a view with a search bar at the top and a SwiftUI List below. I need to detect when the List is scrolled so I can dismiss the search ba

Swift AVPlayer How To Stop Automatically When Audio Finished

I've created a button to play audio (streaming from a link) with AVPlayer in Swift. How to stop the audio automatically when the audio time is finished? Here is

Use Binding<Int> with a TextField SwiftUI

I am currently building a page to add player information to a local database. I have a collection of TextFields for each input which is linked to elements in a