Post

Replies

Boosts

Views

Activity

Does Swift Playground Support Custom Code Snippets Like Xcode?
While demonstrating Swift Playground to my students, I noticed that, unlike Xcode, it doesn’t seem possible to predefine or insert custom code snippets. In Xcode, we can easily create and reuse our own code snippets to improve teaching and development efficiency, but I couldn’t find a similar feature in Swift Playground. Is there currently a way to predefine or insert custom code snippets in Swift Playground? Are there any recommended workarounds, or plans to support this feature in the future? Any suggestions or insights would be greatly appreciated.
1
0
31
Jul ’25
Unable to Tint Custom View in UIBarButtonItem on iOS 26
When using a custom UIButton as the customView for a UIBarButtonItem in iOS 26, setting the tintColor on the UIBarButtonItem or the button itself does not affect the button’s appearance in the navigation bar. The button displays, but the tint is not applied as expected. Steps to Reproduce: Create a new iOS project with a navigation controller. Use the following code in your view controller: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .secondarySystemBackground var configuration = UIButton.Configuration.plain() configuration.title = "Why Not Tinted...?" configuration.baseForegroundColor = .systemBlue configuration.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 12) let button = UIButton(configuration: configuration) let rightBarButton = UIBarButtonItem(customView: button) rightBarButton.tintColor = .green navigationItem.rightBarButtonItem = rightBarButton } } Expected Result: The UIButton in the navigation bar should appear green with glass effect, according to the tintColor set on the UIBarButtonItem. Actual Result: The UIButton appears, but the tintColor is not applied. Changing the tintColor on either the UIBarButtonItem or the UIButton has no effect on its appearance in the navigation bar.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
99
Jul ’25