nouun
nouun
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/24/2023 in #swift-development
SideMenuView help please, I don't have long
I’m going to need a bit more information to help.
6 replies
TSDThe Swift Den
Created by finlay β˜€ on 8/18/2023 in #swift-development
Nondescript crash in my SwiftData app when trying to access a dictionary
SwiftData is a very new framework and it has many bugs so it may be an underlying issue with SwiftUI, I know when I was trying it out I was having so many issues that I just stopped using it completely.
6 replies
TSDThe Swift Den
Created by finlay β˜€ on 8/18/2023 in #swift-development
Nondescript crash in my SwiftData app when trying to access a dictionary
Not sure what the issue is but another way of storing the data could just be an array of dates when it was completed and then append to that array when completed or pop when marked as incomplete.
6 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/24/2023 in #swift-development
SideMenuView help please, I don't have long
Have you tried running the application?
6 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
One of them should hopefully work for your use case.
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
The other option would be something like this:
.onAppear() {
NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event -> NSEvent? in
if event.keyCode == 53 { // if esc pressed
// Do something here

return nil // Do not do "beep" sound
}

// Return original event if not handled
return event
}
}
.onAppear() {
NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event -> NSEvent? in
if event.keyCode == 53 { // if esc pressed
// Do something here

return nil // Do not do "beep" sound
}

// Return original event if not handled
return event
}
}
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
It’s the β€œSwiftUI” way to do it.
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
SwiftUI or UIKit?
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
You don’t need to ping coaches 6 minutes after the post was created.
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
macOS or iOS? Is this to do with a text box or just a generic keypress? Do you want it to happen outside the application if on macOS?
20 replies
TSDThe Swift Den
Created by bobtheguy_32392 on 8/24/2023 in #swift-development
Changing a Boolean when a key is pressed.
Can you give any more information?
20 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
Define the array wherever you see fit.
35 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
Beware that the function will return nil if there aren’t any elements in the array, you can safely force unwrap the element if you’re manually setting the array and know that it won’t be empty.
35 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
You don’t need to manually find a random index as of Swift 4.2, you can use Array’s randomElement function.
35 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
Also I much nicer, imo, way to do timers without using combine would be something like:
Timer.scheduledTimer(withTimeInterval: 131.23, repeats: true) { _ in
self.ad = ads.randomElement()
}
Timer.scheduledTimer(withTimeInterval: 131.23, repeats: true) { _ in
self.ad = ads.randomElement()
}
35 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
@thatgoldman ^
35 replies
TSDThe Swift Den
Created by πŸ‡¦πŸ‡ΊπŸ¦…βœπŸ”₯ π•°π–•π–Žπ–π–šπ–˜ πŸ”₯βœπŸ¦…πŸ‡¦πŸ‡ΊπŸ‘‘Β©β„’ on 8/12/2023 in #swift-development
help please
// your code here
// your code here
35 replies