Category "swift"

String iterator in swift

I try to create an iterator for string processing in swift that will return every time the next chracter. But with no luck. (The final goal is to write a parser

reverse .label in swift

I want my text to appear .white when in normal mode and .black when in dark mode. How do I do that? .label only makes the text .black in normal and .white in da

SceneKit : how to get distance between two SCNNode ? (ObjC and Swift)

I wonder how to get distance between two SCNNode (ObjC and Swift) Thanks

Simplest way to throw an error/exception with a custom message in Swift?

I want to do something in Swift that I'm used to doing in multiple other languages: throw a runtime exception with a custom message. For example (in Java): th

In SwiftUI, where are the control events, i.e. scrollViewDidScroll to detect the bottom of list data

In SwiftUI, does anyone know where are the control events such as scrollViewDidScroll to detect when a user reaches the bottom of a list causing an event to ret

Occlusion Material or Hold-Out Shader in ARKit and SceneKit

I have seen some examples demo of ARKit where material A is blocking material B, kind of creating occlusion effect, or black hole, or masking. But all of them s

ARKit how position nodes base on horizon and not the camera orientation?

When I add a new node with ARKit (ARSKView), the object is positioned base on the device camera. So if your phone is facing down or tilted, the object will be i

How to access a Swift enum associated value outside of a switch statement

Consider: enum Line { case Horizontal(CGFloat) case Vertical(CGFloat) } let leftEdge = Line.Horizontal(0.0) let leftMaskRightEdge

Getting the result of input from one view to another SwiftUI [closed]

I have this view: struct CreateBoardView: View { @State public var BoardName: String = "" var body: some View { ZStack {

What is the "some" keyword in Swift(UI)?

The new SwiftUI tutorial has the following code: struct ContentView: View { var body: some View { Text("Hello World") } } The second line the

Could not find a valid GoogleService-Info.plist in your project

When I run my swift 3.2 code with Xcode 9 beta 4 this is the error I get: *** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp c

TextField in Table behavior

I'm trying to use the new SwiftUI Table with TextField's in each row. However, the behavior of the text field's is weird, for 3 reasons: Clicking on a text fiel

UNNotificationAttachment failing to attach image

So the following code is being used to attach an image from local storage url of an image. I check in Terminal to see if the image is stored and it does store t

Display window on OSX using Swift without XCode or NIB

Disclaimer: I'm attempting the following exercise because I think it will be instructive. I'm interested in how it might be done. So please don't be too hasty t

Display window on OSX using Swift without XCode or NIB

Disclaimer: I'm attempting the following exercise because I think it will be instructive. I'm interested in how it might be done. So please don't be too hasty t

SWIFT TASK CONTINUATION MISUSE: leaked its continuation - for delegate?

I'm trying to extend my class with async/await capabilities, but at run-time there is an error in the console: SWIFT TASK CONTINUATION MISUSE: query(_:) leaked

SwiftUI's keyboardShortcut is not working if Button has a buttonStyle

My code: Button(action: { AudioServicesPlaySystemSound(1026) isActive.toggle() }){

How would I program the interface from the shortcuts gallery?

I'd really like to program an interface similar to the shortcuts gallery as shown below: (source: i.ibb.co) So I'm thinking this would be a table view with cust

Using Decodable in Swift 4 with Inheritance

Should the use of class inheritance break the Decodability of class. For example, the following code class Server : Codable { var id : Int? } class Deve

Find Duplicate Elements In Array Using Swift

How to find Duplicate Elements in Array? I have array of phone numbers so in the phone numbers i should start searching from the right side to the left side and