Category "swift"

Unable to activate constraint with anchors

So, I'm trying to create a sceneView programatically class ViewController: UIViewController, ARSCNViewDelegate { var sceneView: ARSCNView = ARSCNView()

How can I replace a ModelEntity in RealityKit?

I want to switch the ModelEntity from the fvBoatAnchor.fvBoatObject to the fvBridgeAnchor.fvBridgeObject with the click of a button, but I'm not sure how I do i

How to create CGImage from CVPixelBuffer?

I have a simple function to create CGImage from CVPixelBuffer: if let buffer = (results as? [VNPixelBufferObservation])?.first { let pixelBuffer = buffer.pi

Auto login using UserDefaults() not working Swift 5

I have followed some tutorials and used their methods to implement auto login for my app, but once I relaunch the app after entering the credentials, the app do

SwiftUI can not add onChange event

I have a view in which I display a list of my messages. Whenever a new message is added I want to scroll to the bottom. I am trying to add an onChange event to

SwiftUI - how to change text alignment of label in Toggle?

Code for Toggle in SwiftUI is this: Toggle(isOn: $vibrateOnRing) { Text("Vibrate on Ring") } This will produce a toggle button with text label looking like

Disable swipe back gesture in Swift

Been looking around on here for a while but can't seem to find a working solution. I'm trying to disable the swipe to go back to previous view gesture, in Swif

Using reflection to set object properties without using setValue forKey

In Swift it's not possible use .setValue(..., forKey: ...) nullable type fields like Int? properties that have an enum as it's type an Array of nullable objec

xcode ios 'No such module GoogleSignIn'

I have an ios project that works good but after i push it to git hub and clone it again from other computer i get this error 'No such module GoogleSignIn' No su

Getting error in debugger: This app has attempted to access privacy-sensitive data without a usage description

I'm having an issue in the debug area. It's saying that: "This app has attempted to access privacy-sensitive data without a usage description. The app's Info.pl

How to add polylines and annotations from user taps in SwiftUI

I am trying to drop annotations/pins wherever a user touches a certain location on the map. Whenever a user drops more 2 or more pins, it creates a polyline tha

Path extension and MIME type of file in swift

I'm learning swift , and I made a table with cells that show an image ,and classes in groups by MIME TYPE (using path extension). I had a question about extens

How to group by the elements of an array in Swift

Let's say that I have this code: class Stat { var statEvents : [StatEvents] = [] } struct StatEvents { var name: String var date: String var hours

Dismiss button in SwiftUI modal called from UIKit

I have got a SwiftUI modal view which I am calling from main UIKit view. I want to add a dismiss button to my modal view. As I can tell, there is no @State vari

Setting Autolayout Constraints on UIButton in Swift

I'm still trying to get my head around Swift Autolayouts here in XCode 6.3. I have set up a View Controller that I stuck a couple of labels on in Interface Buil

How do I atomically increment a variable in Swift?

I want to be able to increment a counter atomically and I can't find any reference on how to do it. Adding more information based on comments: Are you using GCD

Is it possible to detect if any other certain app is Currently running or not in iOS?

Let say If I want to check if the facebook or any other application is currently running on device ?

How do I refactor my code to call AppDelegate on the main thread?

I recently started migrating my project from Swift3/Xcode8 to Swift4/Xcode9. My app crashes at runtime because the main thread sanitizer allows access to UIAppl

RealityKit as a framework to build 3D nonAR apps

RealityKit has an option for .nonAR camera, but lacks fundamental options to build 3D nonAR apps, like camera control (.allowsCameraComtrol). Is it viable to us

In iOS (swift) app, registration of a second Firebase app can't receive remote notifications

I'm having two Firebase projects (on se same account, but could be two different accounts) and each project have an iOS app registered with the same bundle ID (