Category "swift"

How do I make a hexagon with 6 triangular SCNNodes?

I'm trying to make a hexagon grid with triangles without altering any pivot points, but I can't seem to position the triangles correctly to make single hexagon.

How can I perform an Array Slice in Swift?

var mentions = ["@alex", "@jason", "@jessica", "@john"] I want to limit my array to 3 items, so I want to splice it: var slice = [String]() if mentions.count

ScrollView not covering entire screen in XCode

I'm running into an issue that has me rather puzzled. I have a UIView in Xcode with a ScrollView inside of it. I also have a UIView inside the ScrollView that I

How to get All Extensions for UTType Image, Audio, and Video

Is there a way to get All of the different UTType extension types as Strings? I need them specifically for images, audio, and video. I followed this answer, but

How to make Scroller background transparent in NSScrollView?

I've used Storyboard to set up the NSScrollView and I cannot find any option where I can disable the scroller's background. Any ideas on how to make this happen

SceneKit – Why does adding spot light blacken the floor?

Screenshot #1 shows a simple SceneKit scene with only an ambient light (explicitly added, not the default one). Screenshot #2 shows what happens after adding a

Swift UI: Center Text into Circle

I try to put a circle-shaped frame around a text view, but I just can't get it properly aligned and I can't see where the problem is. As you can see in the pict

SwiftUI HStack with equal Height

I want the Text("111") to have the equal height of the VStack containing 2222... and 333.... struct Test7: View { var body: some View { HStack (alignment:

Swift Array extension for standard deviation

I am frequently needing to calculate mean and standard deviation for numeric arrays. So I've written a small protocol and extensions for numeric types that seem

thin line on top of tab bar not removed in iOS 15

Tried using below code in iOS 15, but the thin line on top of tabbar is not removed but below code works in iOS 13, iOS 14 let appearance = UITabBarAppearance()

Swift Add Footer View In UITableView

This is actually a tableview and tableview cell, and i wanted to add a Submit button after the end of the tableview cell, but how do i do it? I tried to do it

Place multiple SCN objects in touchesBegan method

My Swift code below uses func touchesBegan to place a SCN object in the ARKit view. The problem is – it's only placing the object one time. I would like t

How to setup physical based rendering in SceneKit from code?

I want to present some scene with PBR. I created metalness and roughness textures and want to apply it to the mesh. When I try to do it in Xcode - everything is

Create secKey form data/hex/bytes using SecKeyCreateWithData give nil

I'm new to encryption. i want to create public seckey from data but i always get nil. Please help me. I need this public key as seckey to create a shared secret

Swiftui - Fetch data after login

I'm starting to learn SwiftUI and i'm looking for better solution to fetch user data after successful login. For example, i need to see if the user has the acco

Swift & Navigation : Navigation Bar changes its background color when scroll the view

I have 2 ViewControllers embedded in a Navigation Controller shown in the picture below. Every time I scroll through my table item, the navigation background c

Blank Map with Mapbox and SwiftUI

I try to use Mapbox with SwiftUI. I applied this answer https://stackoverflow.com/a/56551675/5653544 and also followed the mapbox tutorial. So I have a MapV

AppIcon is not displaying on SignIn with Apple login pop-up

This application is for iPhone only. This project is in flutter and AWS Cognito is used for social login. check this documentation AppIcon is not displaying in

Listen for documents just when actually added to collection - swift

I have a collection on Firestore and I listen for changes like this: func createMatchesListener(){ let db = Firestore.firestore() guard let current

didUpdateLocations never called

I'm trying to get the user's location. To do so I have set the following property in the info.plist : I have also added the following code in my viewDidLoad