Post

Replies

Boosts

Views

Activity

Reply to Function types as return types
It works in iOS playground, but not in MacOS playground, either Xcode 16.4 or 26.0ß6. So, that's definitely a bug you should report. You got the answer in your SO post: https://forums.swift.org/t/why-is-there-a-type-of-expression-is-ambiguous-without-a-type-annotation-error-when-using-a-ternary-operator-on-inferred-function-types-in-swift/77306/2 As said, this works: func chooseStepFunction(backward: Bool) -> (Int) -> Int { let res = oneStepBackward ? stepBackward : oneStepForward return res }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’25
Reply to Function types as return types
Which Xcode version do you test with ? Do you test in playground or in app, or SwiftUI App ? I tested in Xcode 16.4, with the following call: print(chooseStepFunction(backward: true) (10)) And got 9 as expected. I tested also in Xcode 26 ß6, works as expected. How do you use chooseStepFunction? please give more context.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’25
Reply to UISlider valueChanged has uninitialized UIEvent
That's at least a documentation bug (or an error compiler should detect). I note the modified code also works with Xcode 16.4 / iOS 18.4, but givesa different UIControlEvents value Slider value changed to: 0.00042842288 UIControlEvents(rawValue: 105553178306624) Slider value changed to: 0.0038560412 UIControlEvents(rawValue: 105553178306624) So, yes, I think it is worth a bug report, because many of us will face the issue. Let's wait for DTS engineer analysis, in case. Then close the thread.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to UISlider valueChanged has uninitialized UIEvent
Effectively, your code crashes in Xcode 26 / iOS 26 (but works in Xcode 16.4 / iOS 18.4). I think problem is the type used for event. I changed UIEvent in sliderValueDidChange: @objc func sliderValueDidChange(_ sender: UISlider, for event: UIEvent) { to UIControl.Event @objc func sliderValueDidChange(_ sender: UISlider, for event: UIControl.Event) { print("Slider value changed to: \(sender.value) ") print(event) } No more crash, just the log: Slider value changed to: 0.025641026 UIControlEvents(rawValue: 0) Slider value changed to: 0.03926282 UIControlEvents(rawValue: 0) Did Xcode 26 replaced UIEvent by UIControl.Event ? In that case I could not find it in documentation.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25