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

Xcode XML problem

Does anyone know how to resort back to the old main visual file after something accidentally happened to it and now looks like an XML file? Here is what it looks like
No description

how to fetch data for every 5 seconds?

I making an app that logs battery value every 5 seconds. I am also doing a api get request along with it. these values are added in a csv file. my doubt is how do i make this task run continuously. Thank you😄...

how to randomly display data in SwiftUI?

typical use case for flash cards... I have shelves that contain boxes that contain cards. i want to randomly select a card from a box and display its data (front) and accept user input (right or wrong) and increment card.level if user selects "right" or decrement if he/she selects "wrong", after he/she has seen the back of the card. How to approach this use case?...

Problem only if want Archive App

Has anyone had the problem that the app runs without problems on iPhone or Simulator, but throws an error if i try archive this app?
No description

i can’t type into my xcode console #cplusplus

Does anyone know what’s going on? #cplusplus...

swift collection layout

I’m new to Xcode and swift. I would like to know the function / layout used to create this below. When you click on an item it tells you how to craft it, then click another item the images in the cells change for the new item....

Context menu program

Hello, I'd like to write a program that allows me to create a new file from the context menu. It's the first time I'm trying to code something like this, and I'm not sure where to start. I would like to use Swift, but which API/technology can I use to accomplish this?...

how to get caret position!

Hey guys I have tried to get the current caret/cursor position (not mouse!) but no success! Tried with accessibility API Any chance someone could help me out and understand how to do that or just navigate? I would appreciate it...
No description

AR help - object won't place

Hi! I'm currently working on an AR application, I've put the code in a github so you can see it. It can recognise the ref image, but for some reason it won't place the object correctly. The object I could't place in github, as it was too large of a file. The github: https://github.com/Sjandor/postar And some info on the model is as the image. I've made it quite tiny, as at first it was too large. I've also had some code to make the size of it relative to the image reference, but to no success. Can anyone help me out on this? Thanks in advance!...
No description

Hi all.

Currently working on my first project and running into a bug within the initializer in my game's model. The app is very simple so it should be an easy fix for someone knowledgable...

View starts off lower than expected

I ran into a problem where the view starts off lower than what I wanted. However, by clicking on the side menu icon(the hamburger icon), it puts the view and the contents back into the right spot? I used GeometryReader ->Zstack(alignment: .topLeading). Im not sure where I can pinpoint the problem. My side menu is a slider menu, and has a fading effect that blur the background when it is open.
No description

Button not showing

Hey, I've created a button that shows in the Preview, but does not show when I compile & test my app using the iPhone Simulator, can someone help? https://github.com/oZoey/notes/issues/12...

SwiftUI TabView vs ScrollView for Infinite Horizontal Carousel with Page Control

Hi all, I am trying to create an infinite horizontal carousel with page control. After the last page the scrollview should show the first page and vice versa while scrolling backwards. Most of the posts I see are using a TabView, instead of a ScrollView for this purpose. 1. Is TabView a better option for this use case? 2. What are the benefits of using TabView vs ScrollView? ...

SwiftData nested Lists

👋 Hey, I have two SwiftData Models and I want to create a nested list with "ItemList" being the parent: @Model class Item { var name: String = ""...

Centering in Swift

Hi, everyone. I am having trouble with creation of SwiftUI ui's. I have a Form and I want to center it vertically. How can I do this? Thanks in advance.

what project is good for resume?

swift question What are some good swift projects for GitHub?...

Submodules

Hello, i'm trying to make an app that links about 20 other apps. each person in my class mad an interactive story app and now i'm trying to make an app that links all 25 and one i click on the book cover it takes me to that specific story. is there a way to do this using git submodules in swift? all projects are their ow repositories. Thank You...

Using Cursor editor (A VSCode clone that runs the Swift.org plugin)

I'm trying to get started with Swift using Cursor, which is a neat AI driven VSCode clone, which runs on macOS. I've got Xcode installed but would prefer to use Cursor if possible. I've checked that Swift is available from the command-line, but I cannot get the plugin within Cursor to do anything other than display the correct syntax highlighting. There is no indication of syntax errors, of which Xcode displays many 😉 Has anyone else used the Swift plugin in either Cursor, or more likely, VS Code, and gotten full functionality from it?...