Category "swift"

RealityKit – Get a model entity from USDZ file

I haave a file (exists in main bundle with target membership checked) named matrix.usdz and need to load it with do { let path = Bundle.main.path(forResour

How to make exponents in the SwiftUI

I found the new method in SwiftUI to allow you to create an exponent. Here what I write code is based in SwiftUI on the Swift Playground. import SwiftUI impo

RealityKit app and lower iOS deployment target

I have an iOS app with deployment target iOS 10+, I need to add some features that depend only on RealityKit to appear with users whom their iOS version is 13+,

iOS: How to add Assets folder inside a Framework and how to access them in code?

I create an iOS app and added a framework to it. The generated framework doesn't have an assets folder like the generate Single View App. So I made an Assets fo

SceneKit Cocoa snapshot failed assertion

I am working on a Swift/Cocoa/Xcode application. This application contains a SceneKit View. The rendering API is set to Default (I think this is Metal). If I

Is it possible to create IndoorMaps like airports from Apple with IMDF?

Im quite confused about creating an IndoorMap for our company to display it on iPad's. Regarding to the new IndoorMaps-Program from Apple I thought I found the

In which cases ARSCNView.raycastQuery returns nil?

In my renderer delegate I create a raycast query from the center of the view to track estimated plane and display a 3D pointer that follows the raycast result.

Turn off or bypass SSL Certificate Verification in Swift iOS

I have my server certificates expired. I want to bypass or turn off certs verification from my swift iOS app so i can test app features. I need this just for

SwiftUI on macOS - handle single-click and double-click at the same time

Consider this view in SwiftUI: struct MyView: View { var body: some View { Rectangle() .fill(Color.blue) .frame(width: 200,

PubNubSwift Capture Receive Message

I'm working with PubNub. I have a standard WebRTC string being published with PubNub. self.pubnub.publish(channel: self.channels[0], message: ["type": "offer",

SwiftUI on macOS - handle single-click and double-click at the same time

Consider this view in SwiftUI: struct MyView: View { var body: some View { Rectangle() .fill(Color.blue) .frame(width: 200,

Can I track more than 4 images at a time with ARKit?

Out of the box it's pretty clear ARKit doesn't allow for the tracking of more than 4 images at once. (You can "track" more markers than that but only 4 will fun

ARKit: How to add button to ARView in storyboard?

I am brand new to ARKit (and a novice in swift) but I am trying to create a basic AR app. I am following this tutorial in which a simple scene is created essent

I can't make extension convenience init for UIImage

I want to create UIImage(urlString: String?). There is no error when I run this code but it is not working. extension UIImage { convenience init?(urlString:

@MainActor is not safely when it used with propertyWrapper?

Combined use @mainActor and propertyWrapper is not safe? The code will execute directly in the background thread. It is a bug? Here is the demo: struct DetailVi

Get Image from CALayer or NSView (swift 3)

I was looking for a way to render a CALayer or NSView and get NSImage back. I have a custom class, which is a subclass of NSView. At the beginning I simply make

UIStackview align left

I'm trying to align the items in UIStackview horizontally to the left. Is there anyway to do this programmatically? I tried to do this via storyboard but was n

Swift Package Manager (SPM) and Cocoapod Dependency Conflict

Overview I have two dependencies, one available as a Swift Package, and the other only available as a Cocoapod. The problem is that each has a dependency on a t

How to initialize multiple variables of some type in one line

I want to achieve something like var a, b, c: MyType = MyType() but this line doesn't compile because compiler treats the type annotation MyType is only for

Mic input through headphones and output to iPhone speakers

Is there any way yet of being able to use wired headphones' mic as input and iPhone speakers as output using the high level AVFoundation framework: AVAudioSessi