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

Custom Label and OOP

I added a photo as an example of "how we can initialize and assign properties" so I wonder If can do the same thing for Labels to assign their value by myself?...
No description

I'm having a stroke with CGEvents and simulated input - please help

Anyone here happened to mess with the Quartz Event Services API ? I'm having a hard time trying to simulate input to a particular app. My goal is to achieve a simulated click input at any coordinates in a target app's window, if possible even if it is in the background (not foremost). The purpose of this is to have an automated custom routine running on an app in the background without hindering mouse movements and clicks. ...

NavigationStack with path initializer giving me "No exact matches in call to initializer "

My code: ```swift struct ListView: View { @State private var presentedViews: [DayView] = [DayView(date: "March 23")] ...

market demand/supply

Is there more demand for swift developers and not as much supply? I’m a web dev with mainly MERN trying to make myself more competitive in the market so I was thinking native iOS is a good route anyone here in the field and have first hand experience with hiring practices etc?...

Cannot show Automatic Strong Passwords for app bundleID: io.blinqpay.blinqpost

i did a firebase user authentication and got the above error in the console, i have enabled keychain but the error is still showing. Kindly see the attached screenshots.
No description

Xcode 14 Archive Failed with "Command SetOwnerAndGroup Failed with a nnonzero exit code"

Hello guys, I'm developing the Driverkit on Macos 13 with Xcode 14. As Apple new terms to distribute the applications, I think that I have to archive my project with Development profile and notarize it. I can Build it successfully but always archive failed with the same error code, even if I use command to change owner group or mod 777. How to deal with it ? I'm totally no idea 😦 Or some how to distribute Driverkit Application with Develope ID application profile in Xcode14 later. Thanks....
No description

help in animating table view once

Hey guys I am trying a fade animation on table view, the table view rows are supposed to render one after the other while fading in ```swift func animate( cell: UITableViewCell, index: Int) { cell.alpha = 0...

Custom Font not working

I added a custom font named Lemon-Regular, its a ttf file and I made sure that the project is checked in the font's target ownership and that it also occurs in the resources in build phases. The code doesnt throw up any error but the font itself is not being rendered. This is my code ```swift Text(text) .font(.custom("Lemon-Regular", size: 24)) .frame(width: 200, height: 50)...

init(coordinateRegion... was deprecated in iOS 17.0: Use Map initializers

i'm doing the basic SwiftUI tutorial https://developer.apple.com/tutorials/swiftui/creating-and-combining-views#Use-SwiftUI-Views-From-Other-Frameworks, and I got this error: 'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:)' was deprecated in iOS 17.0: Use Map initializers that take a MapContentBuilder instead. What should I do? I don't know how to use Map initializers...
No description

resources

Anyone have any recommendations for courses of YouTuber to follow to pick up swift?

Swift compiler error

Hi devs, The minimum deployment target set in my project is ios 14.1. I am trying to run it on xcode 13.2. When I run the project, I get this error during build time. Module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.2 compiler.....

Swift on Android failing to link during runtime `System.load`

I love Swift. In fact, I love it so much that I'm building my own game engine, from scratch, just so I can use Swift for my day-to-day development work. Games on Apple platforms tend to have limited reach, so developing for Android is a great way to significantly increase my audience size. However, Swift is not supported for Android. Sort of. There are some amazing efforts by super smart folks that have allowed me to build my Swift games for Android, the first of which I released to both the App Store and Play Store last year! All of that is to say: I know Swift-first cross-platform development is possible because I've done it. But I am starting on an upgrade of my engine and a new game project, and upgraded my Android Studio version (to Electric Eel), my NDK version (to 25.1.XXX), and other details and I finally have everything building into a .so in a src/main/jniLibs folder in my Android project. Upon launch, however, when calling System.load("SimpleSwaps") crashes with an exception: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "UCNV_FROM_U_CALLBACK_STOP_71" referenced by "/data/app/~~YKZSrHhpcARXDne-qsQsCA==/com.bigbytestudios.SimpleSwaps-SpPUj44-DeMvkCjBboGuyA==/base.apk!/lib/arm64-v8a/libFoundation.so"..., suggesting that Android can't find some symbols. I was experiencing other similar linkage crashes when it was looking for libcurl.so as well. I expect that I'm the only person on this server/continent crazy enough to try these things, but I can't figure out how to fix these issues and hope that someone here can help me figure it out. Thanks!...

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.