Category "swift"

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

Swift 5 UIButton title didn't change

I just learned Swift and developed an iOS project. But the button title doesn't change when I click it. How can I change the title? Simulator: iPhone 11 iOS14.4

SwiftUI - How to pass EnvironmentObject into View Model?

I'm looking to create an EnvironmentObject that can be accessed by the View Model (not just the view). The Environment object tracks the application session da

NSOpenPanel malfunctioning

I have an app that needs to have a "choose file" function and I used a button hooked up to a function using NSOpenPanel to do that. But after I tried to add a d

Swiftui - How do I initialize an observedObject using an environmentobject as a parameter?

I'm not sure if this is an antipattern in this brave new SwiftUI world we live in, but essentially I have an @EnvironmentObject with some basic user information