Category "swift"

iOS 14 UIColorPicker eyedropper tool not returning selected color

I am currently trying to implement the new iOS 14 UIColorPicker. Everything works great, except the eye dropper functionality of the UIColorPicker. After select

iOS: How to listen hotspot turn on, turn off notification events

I am working on an application where I need to observe the hotspot events e.g. there must be a callback when the mobile hotspot turn on also when turn off. I ha

How to use UIApplicationDelegateAdaptor as ObservableObject?

In my iOS 14 App, I can register the legacy AppDelegate by doing this: @main struct MyApp: App { #if os(iOS) @UIApplicationDelegateAdaptor(AppDeleg

Deserialize double array

I try to deserialize some JSON on Swift 4.2 with Codable Protocol. My Json: { "status":1, "data":[ [ { "id":"4klJeiCKTs

SwiftUI Localize Raw Strings

In SwiftUI how can i get my raw string localized? Text(#"Hello \\\\"#) Adding this to the localized file will not work. "Hello \\\\" = "is not translated \\\\"

Crashlytics: What does compiler-generated means?

I'm using Firebase Crashlytics to get crash reports from my iOS app and I get some crashes that I don't understand with a <compiler-generated> error messa

SnapSDK integration not working properly, Snapshot shows error: Something went wrong. Please try again later

I followed all the steps from documentation and integrated SnapSDK in my iOS app but when I click the share button in my app it directs me to the snapchat but e

SwiftUI custom accentColor not working on physical device(iOS 13) but works everywhere else(iOS 14.0+)

In my SwiftUI View I've an Image that I've loaded from assets. I've set the foregroundColor to accentColor, which I've also set in asset as my custom AccentColo

Preview not changing device to iPhone SE when using SwiftUI

I am new to SwiftUI and I was trying to change my preview device to iPhone SE but the device does not change. When I update the text "Hello, world!" to somethin

How to hide suggested email id from keyboard in swift

I want to hide email suggestion which is displaying while i choose email textField in my application. I have tried different options like below but none of them

Can I load both obj and materials as an MDLAsset?

I have a directory containing an obj, mtl, and the textures. If I do let asset = MDLAsset(url: url) then it loads the mesh, but no textures. Now, if I go rename

Why 3d object added to scene view scene moves along with camera?

I have added 3d object to scene view scene which is in dae format. But its moving along with camera. How to fix it to a particular position. Same code works wit

How to add gradient color to UIView using Custom Class and UIAppearnace() in swift

Hello Everyone I want to add Gradient Background Color to UIView using UIAppearnce() with CustomView Class.I am facing an error - Thread 1: " Illegal axis type,

iOS 15 Navigation Bar Transparent

My iOS app uses the storyboard for the UI and uses a custom tint for the background color of the navigation bar. I have tested my app on the Xcode 13 beta 5 and

How to programmatically export 3D mesh as USDZ using ModelIO?

Is it possible to programmatically export 3D mesh as .usdz file format using ModelIO and MetalKit frameworks? Here's a code: import ARKit import RealityKit impo

Swift: Accessing argument of closure stored as variable

I ran into some code for a location manager class and I noticed that there is a variable that holds a closure. var locationInfoCallBack: ((_ info: LocationInfor

How to add test data to PreviewProvider

I am new to iOS/Swift and to the MVVM architecture and was wondering how to send in test data to the SwiftUI Preview. (Actual data is received from the ViewMode

How to use NSKeyedUnarchiver.unarchiveObject

I have a working code but that was deprecated. The following part of the code is the line with a warning. let dict = NSKeyedUnarchiver.unarchiveObject(with: out

how to get current displaying page month in string in Fscalender in swift

I know how to get the month of current page but I want to know how to get the month of current page in string in fscalender please help me I'm new to iOS. let v

Prime numbers print from range 2...100

I have been assigned with a task to print prime numbers from a range 2...100. I've managed to get most of the prime numbers but can't figure out how to get rid