Post

Replies

Boosts

Views

Activity

SwiftUI toolbar visibility transition?
I have the need to show and hide a toolbar (bottomBar) when certain conditions are met. I am able to do this via: func toolbar(_ visibility: Visibility, for bars: ToolbarPlacement...) -> some View However, changes to state result in the toolbar appearing immediately rather than sliding in the from the bottom of the screen like I, and iOS users in general, are used to when using: self.navigationController.setToolbarHidden(false, animated: true) I've tried adding a .transition() and .animation() view modifiers to the ToolbarItemGroup but no such API exists. What do I need to do?
1
0
3.0k
Sep ’22
Always On display
I'm updating a timer app that is written in regular Swift. After being built using watchOS 8 the display stays on (Hooray!) but none of the text elements update (Boo!). I've read the documentation at: https://developer.apple.com/documentation/swiftui/text But this suggests that the only way to get the Always On display to update is to user SwiftUI. Please tell me this is not the case.
0
0
725
Mar ’22
Why do animations not work when deselecting a `UITableViewCell` in a `UITableView` asynchronously?
Below is a simple example. If you tap and release the first cell, it deselects with the animation as you would expect. If you tap and release the second cell, you may not notice anything happen at all. You may even need to hold the cell to see the selection, and when you release it reverts back to the unselected state immediately. This is obviously a contrived example but it shows the essence of the issue. If I wanted to delay the deselection until something had happened I would face the same issue. Why does this happen and is there any way around it? import UIKit class ViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) cell.textLabel?.text = indexPath.row == 0 ? "Regular deselection" : "Async deselection" return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.row == 0 { tableView.deselectRow(at: indexPath, animated: true) } else { DispatchQueue.main.async { tableView.deselectRow(at: indexPath, animated: true) } } } }
1
0
1.2k
Sep ’21
SwiftUI toolbar visibility transition?
I have the need to show and hide a toolbar (bottomBar) when certain conditions are met. I am able to do this via: func toolbar(_ visibility: Visibility, for bars: ToolbarPlacement...) -> some View However, changes to state result in the toolbar appearing immediately rather than sliding in the from the bottom of the screen like I, and iOS users in general, are used to when using: self.navigationController.setToolbarHidden(false, animated: true) I've tried adding a .transition() and .animation() view modifiers to the ToolbarItemGroup but no such API exists. What do I need to do?
Replies
1
Boosts
0
Views
3.0k
Activity
Sep ’22
Always On display
I'm updating a timer app that is written in regular Swift. After being built using watchOS 8 the display stays on (Hooray!) but none of the text elements update (Boo!). I've read the documentation at: https://developer.apple.com/documentation/swiftui/text But this suggests that the only way to get the Always On display to update is to user SwiftUI. Please tell me this is not the case.
Replies
0
Boosts
0
Views
725
Activity
Mar ’22
Why do animations not work when deselecting a `UITableViewCell` in a `UITableView` asynchronously?
Below is a simple example. If you tap and release the first cell, it deselects with the animation as you would expect. If you tap and release the second cell, you may not notice anything happen at all. You may even need to hold the cell to see the selection, and when you release it reverts back to the unselected state immediately. This is obviously a contrived example but it shows the essence of the issue. If I wanted to delay the deselection until something had happened I would face the same issue. Why does this happen and is there any way around it? import UIKit class ViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) cell.textLabel?.text = indexPath.row == 0 ? "Regular deselection" : "Async deselection" return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.row == 0 { tableView.deselectRow(at: indexPath, animated: true) } else { DispatchQueue.main.async { tableView.deselectRow(at: indexPath, animated: true) } } } }
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’21