Post

Replies

Boosts

Views

Activity

How to avoid committing my XCTestCase test credentials in public repo?
How would you design an XCTestCase that needed valid credentials to pass (+fail) authentication-related testing? The key is doing so without committing credentials in a repo for the world to sniff out. For now, I have the following: let uid="me" let pwd="my password" final class test: XCTestCase { code-block } This works for me, for now ... how would you make the test less personal and more ready for public git repositories?
1
1
698
Feb ’23
How would you share common button actions across views?
How would you share a common Button(action: { some action }) across Views? I have: VStack { ToolbarViewA(states) TableViewB(states) ... } View initializer states include $data & $selection, so each View has the 'same' data. I would like a Button in a contextMenu on a Table in TableViewB to perform the identical click action as a Button in ToolbarViewA. How would you approach this challenge? I am interested in learning how to think SwiftUI so I would appreciate your thoughts! I really like v5, it is gelling with me. Thank you Apple!
2
1
563
Jan ’23
SwiftUI Table - scroll to selected row
How would you scroll to a selected row in a Table? I have implemented a find capability that successfully selects row(s) in a Table. Sadly, often the selections aren't immediately visible, so users have to scroll up/down to confirm (my pinky promise isn't enough). How would you (in effect or reality) scroll to a selected row? Impl Dtl Data is @Identifiable Selection is @State selection = Set(<Data.Id>); Table is Table(data, selection: $selection){ TableColumn("Col"){ ... } A find Button successfully selection.insert(foundId) The table shows the selected result either on screen or after user scroll. It's the after user scroll thing...who has time to for that? :) All pretty vanilla stuff (I am enjoying SwiftUI a bunch). Hopes + Dreams The find Button is intended to grow selection - it selects a chunk of data, and then the user can decide to grow that chunk by clicking the find Button again. Ideally, I'd like the Table to scroll to the first selection in each iteration of the "selection chunk", but honestly, auto-scrolling to selection.first at this point would be fantastic. Any tips or tricks? I am new and stumped. Thx (MacOS, for now)
2
1
1.6k
Jan ’23