The Swift Den

TSD

The Swift Den

The Discord server for Swift developers. Get tips and snippets for your projects!

Join

swift-development

javascript

python

rust

c-sharp

Metal `setFragmentBytes` not uploading data

I am trying to pass an array of 2D points to my Metal fragment shader fragment float4 bg_frag(FragIn frag [[ stage_in ]], constant float4& color [[ buffer(0) ]], constant float2* points [[ buffer(1) ]]) but the data I see in the shader is complete garbage. I am passing it to the shader using ``` switch param {...

Alamofire 5.X "Type of expression is ambiguous without more context"

Title. I've been messing with this for almost a full hour and can't fix this stupid error message ```swift let urlString = "(baseURL)(header)"...

.env file

I have api keys that I need to put into an .env file which will be included in my .gitignore. What would be the best way to go about this?

Verified Role

tl;dr - To post you need to verify you are a human by getting verified. Open the server menu (see below for photos) You must have GitHub account, Steam account, eBay account, PayPal account or Twitter account with at least 15 tweets to get it. Click on 'The Swift Den' on top of the channel list, then in the menu, click on 'Verified Roles'. Then go to 'Verified'. It will give you the role and guide you through linking accounts....
No description

How do you make an expiration system

I was making an app that has packages in it and I wanted to add an expiration system like but when make it using @AppStorage the timer stops when i access the view with the timer but on the contentView the timer is running, but I don't know how to fix the bug. cant put the code bc its too long...

Google Sign in pod with swiftui and xcode 14 issue

Hello, I am having trouble installing google sign in using cocoapod. any one else having the same issue?

Detected view visible.

I'm trying to detect when a view is first made visible so I can connect to a BLE device and then when it is dismissed it is disconnected. I've tried using onAppear/onDisappear and isPresented but they all have the same problem that when I go through a NavigationLink to a child view, it called onDisappear or sets isPresented to false.

How do you set the text font to the custom font?

How do you set the text font to the custom font bc I was making an app that lets you have some fonts to add in the list and save it.. I already got the info.plist and it has the Fonts provided by application property in the plist.. I added the whole font file name in the Fonts provided by application section But the main question is How do you set the text font to the custom font?

How do you make an Add Button that adds a Text? - Already Answered ✅

How do you make an add button that opens a sheet and there is a TextField that you can set to any text and when you press "Add" it will add the text that you put on the TextField and put it in the list.. I tried searching it up "How to make a button that adds a text in swiftUI" on google but the steps didnt work.....

How do you add spacing in LazyVGrid

How do you add spacing in the LazyVGrid, I tried using Spacer() but it didn't add a space...