Category "swift"

Locale.current reporting wrong language on device

I'm trying to format currency values in an iOS app, and I'm using the current Locale settings on the device to use the appropriate currency formatting. In the

RealityKit – How to add a Video Material to a ModelEntity?

I use the code to add a picture texture in RealityKit and it works fine. var material = SimpleMaterial() material.baseColor = try! .texture(.load(named: "ima

Rotate UIButton 360 degrees

I've been trying to run an animation that rotates my UIButton 360 degrees using this code: UIView.animateWithDuration(3.0, animations: { self.vineTimeCapButt

Prevent UIAlertController from dismissing on UIAlertAction

I am working on one of the application where i am promoting user for force update using UIAlertController in which i don't wanted to allow user to perform any a

How to get the Iphone type from simulator (IOS)

There are a lot of solutions to find out on which device out app is running. iOS: How to determine the current iPhone/device model in Swift? But running in th

How to get battery life of Bluetooth Low Energy in Swift 4?

I am able to get a value for BLE battery life with the help of following questions: Read data from BLE device Reading a BLE Peripheral Characteristic and chec

Encountered an error communicating with IBAgent-iOS. Failed to boot device iPhone Xs

I am getting an Error on the top of my interface builder in Xcode 10.3 and while clicking on report bug and checking the log.txt file I found out that fails to

Property wrappers and SwiftUI environment: how can a property wrapper access the environment of its enclosing object?

The @FetchRequest property wrapper that ships with SwiftUI helps declaring properties that are auto-updated whenever a Core Data storage changes. You only have

Firestore query with inequality filters on multiple fields

I am building a calendar on IOS using Swift, with a Firestore back-end. I am retrieving all the events for each day in a month at one time. Currently I can only

SwiftUI Toolbar item getting clipped when back button is pressed

I've run in to a strange behavior in SwiftUI that I can't seem to work around. Given the following simple example app I experience this behavior: The toolbar it

Is there any way to load the GLTF file which is compressed by Draco?

I am looking for a way how to load the draco compressed .gltf on iOS. I am using GLTFSceneKit to render the gltf file which is exported by Blender. But if I com

Setting UIView.isAccessibleElement to true disables clicking of subview in voiceovermode

So I have a custom view controller that displays a dialog with a couple of buttons. When the view appears I want voiceover to read out some basic information d

Simple way to run SwiftLint for our Swift package

So far what I found is this blog article: It's time to use Swift Package Manager which recommends integrate SwiftLint and other tools with Package.swift. I was

Simple way to run SwiftLint for our Swift package

So far what I found is this blog article: It's time to use Swift Package Manager which recommends integrate SwiftLint and other tools with Package.swift. I was

How to animate collection view layout change while using `layoutAttributesForElements`?

I made a custom collection view flow layout that can toggle (with animation) between "film-strip" and "list" layouts. But after adding some fancy animations to

Re-authenticate with provider in Firebase and SwiftUI

I managed to re-authenticate the users with Apple, Facebook, Google, Email, and Phone in Firebase with SwiftUI, but when the users re-authenticate with Facebook

Add a xib file to a Swift Package

I want to start using modular code with the new Swift Package Manager integration with Xcode 11. The problem is that I can't seem to add any kind of UI files t

Unique Integer Value

I need a way to generate unique integer values in swift //string let g = NSUUID().UUIDString How can I accomplish the above in int format?

SwiftUI TextField doesn't commit change when tapping another TextField

I am building some basic form functionality in my app at the moment and I am having trouble with TextFields not changing the value in the relevant binded variab

Difference between creating ViewModifier and View extension in SwiftUI

I'm trying to find out what is practical difference between these two approaches. For example: struct PrimaryLabel: ViewModifier { func body(content: Conte