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

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...

How to pass parameter to custom iterator

I'm making a custom iterator that returns every slice of a given width through a collection. I got it working with a hardcoded width but can't figure out how to make it a parameter. I want the hard-coded 3 to be replaced with that param: ```swift extension Array {
func windows() -> AnySequence<ArraySlice<Element>> {...