Category "swift"

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

Mutable Binding in SwiftUI Live Preview

I have a ChildView with a variable: @Binding var itemName: String In this ChildView I have few buttons that change value of the variable: Button(action: {

WCSession counterpart app not installed or installed throughout settings in the watch app

I have developed my watch app for my iOS App. The problem is that I need to use WCSession logic in order to send data from iOS to the AppWatch and vice versa. I

Function opaque return type was inferred as ... which defines the opaque type in terms of itself

Xcode gives the error: Function opaque return type was inferred as 'Button', which defines the opaque type in terms of itself on the line below: @State var sh

Mimic the iOS Photos APP browsing behavior with SwiftUI

I am new to SwiftUI (iOS development). I would like to mimic the iOS Photos APP browsing behavior with SwiftUI. More specifically, I want to display a photo in

Can I change the Weekday format to be like (Su, Mo, Tu, We, Th, Fr, Sa) in FSCalendar

I want to change the current week title to two letters, eg: sun to su, mon to mo, in FSCalendar.