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
Reply to How to identify which UIControl.Event triggered a common selector for UIButton?
That cannot work, unfortunately. I tested for the event rawValue, to no avail, even after changing event type in the @objC: @objc func handleButtonEvent(_ sender: UIButton, forEvent event: UIControl.Event) { touchDown 1 touchDownRepeat 2 touchDragInside 4 touchDragOutside 8 touchDragEnter 16 touchDragExit 32 TouchUpInside 64 touchUpOutside 128 TouchCancel 256 PrimaryActionTriggered 8192 As explained here: https://stackoverflow.com/questions/31122418/in-swift-how-do-you-detect-which-uicontrolevents-triggered-the-action Curiously, none of the action selector parameters provide any way to learn which control event triggered the current action selector call! Thus, for example, to distinguish a Touch Up Inside control event from a Touch Up Outside control event, their corresponding target–action pairs must specify two different action handlers; if you dispatch them to the same action handler, that handler cannot discover which control event occurred. So you have to create a target action for each event.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to Recommended way to detect double-tap on UIButton and scope of UIControl.Event
I recommend the simplest (that's what I use): UITapGestureRecognizer with numberOfTapsRequired = 2. The difference is that it is made specifically for the purpose of doublets. And impossible to detect any performance difference, if ever there were. If you want to have a different action for single and double tap on theObject, you should create 2 gestures (you could create the gestures in storyboard): let doubleTap = UITapGestureRecognizer(target: self, action : #selector(self.doubleTapped(tap:))) doubleTap.numberOfTapsRequired = 2 self.theObject.addGestureRecognizer(doubleTap) let singleTap = UITapGestureRecognizer(target: self, action: #selector(self.singleTapped(tap:))) singleTap.numberOfTapsRequired = 1 self.theObject.addGestureRecognizer(singleTap) // For doubleTap to be detected, avoid interception by single tap: singleTap will fire only if doubleTap has timedout. singleTap.require(toFail: doubleTap) And create the appropriate actions: @objc func singleTapped(tap: UIGestureRecognizer) { }   @objc func doubleTapped(tap: UIGestureRecognizer) { } I noticed that UIControl.Event defines a large set of events (like .editingChanged, .valueChanged, etc.). Can all these events be applied to any UIControl subclass such as UIButton No, for instance, editingChanged has no meaning for a button.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to Is my POST method correct
@kevdoescode you ask if the post is correct. That probably means it does not work properly. If so, do you get and error message ? Is the result different from what you expected ? To use the forum properly, you have to provide this information, not just ask someone to correct your code. I advise also to read the very good post on how to properly use the forum: https://developer.apple.com/forums/thread/706527 A simple code sample here: https://forums.swift.org/t/sending-an-http-post-request-to-an-api-using-swift/62457
Topic: Safari & Web SubTopic: General Tags:
Aug ’25
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:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Bugs custom 18.6
This is a question on the use of device, not a question about app development. So you should ask on the community forum (https://discussions.apple.com/welcome), or file a bug report.
Replies
Boosts
Views
Activity
Aug ’25
Reply to Bugs iOS 18.6
Just linking to another forum is not the proper way to use the forum. Please read this excellent thread on how to properly use the forum: https://developer.apple.com/forums/thread/706527
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Aug ’25
Reply to UISlider valueChanged has uninitialized UIEvent
So the question is: did the required signature for selector change in Xcode 26 ? I have noticed the same issue for other types of control.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Display segmented control in iOS 26 with the previous rounded rectangle style
I have not found a way to do this with existing API. Probably because it would break from liquid glass look and feel (which would be an issue for UI consistency). Looks like one need to create custom segmented control. I've found a lot of information here: https://focuspasta.substack.com/p/building-a-custom-segmented-control
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Aug ’25
Reply to App stuck in waiting for review for 12 days
If it waits for review, that means it is an automatic process, not a reviewer's. Did you have any review incident in the past ? Maybe some background check with your account ?
Replies
Boosts
Views
Activity
Aug ’25
Reply to Devices naming convention
My understanding was that OSs renaming was to align all the OS versions, and no more WatchOS 10, iOS 17, MacOS 15, TVOS 18, VisionOS 2… But there is no such need for the devices themselves. In addition, their update cycles are different, so that would be hard to manage.
Replies
Boosts
Views
Activity
Aug ’25
Reply to How to identify which UIControl.Event triggered a common selector for UIButton?
That cannot work, unfortunately. I tested for the event rawValue, to no avail, even after changing event type in the @objC: @objc func handleButtonEvent(_ sender: UIButton, forEvent event: UIControl.Event) { touchDown 1 touchDownRepeat 2 touchDragInside 4 touchDragOutside 8 touchDragEnter 16 touchDragExit 32 TouchUpInside 64 touchUpOutside 128 TouchCancel 256 PrimaryActionTriggered 8192 As explained here: https://stackoverflow.com/questions/31122418/in-swift-how-do-you-detect-which-uicontrolevents-triggered-the-action Curiously, none of the action selector parameters provide any way to learn which control event triggered the current action selector call! Thus, for example, to distinguish a Touch Up Inside control event from a Touch Up Outside control event, their corresponding target–action pairs must specify two different action handlers; if you dispatch them to the same action handler, that handler cannot discover which control event occurred. So you have to create a target action for each event.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Recommended way to detect double-tap on UIButton and scope of UIControl.Event
I recommend the simplest (that's what I use): UITapGestureRecognizer with numberOfTapsRequired = 2. The difference is that it is made specifically for the purpose of doublets. And impossible to detect any performance difference, if ever there were. If you want to have a different action for single and double tap on theObject, you should create 2 gestures (you could create the gestures in storyboard): let doubleTap = UITapGestureRecognizer(target: self, action : #selector(self.doubleTapped(tap:))) doubleTap.numberOfTapsRequired = 2 self.theObject.addGestureRecognizer(doubleTap) let singleTap = UITapGestureRecognizer(target: self, action: #selector(self.singleTapped(tap:))) singleTap.numberOfTapsRequired = 1 self.theObject.addGestureRecognizer(singleTap) // For doubleTap to be detected, avoid interception by single tap: singleTap will fire only if doubleTap has timedout. singleTap.require(toFail: doubleTap) And create the appropriate actions: @objc func singleTapped(tap: UIGestureRecognizer) { }   @objc func doubleTapped(tap: UIGestureRecognizer) { } I noticed that UIControl.Event defines a large set of events (like .editingChanged, .valueChanged, etc.). Can all these events be applied to any UIControl subclass such as UIButton No, for instance, editingChanged has no meaning for a button.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Toolbar button is clipped in iOS 26
Looks like a custom style requires frame size. Is it a feature or a bug, hard to say. You should file a bug report (and note the FB reference here). Don't forget to close the thread.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Aug ’25
Reply to Why do we need request.setvalue for a post request
That's to inform the server of what type of data request it is going to receive. And process it as a json content. https://stackoverflow.com/questions/4249609/form-content-type-for-a-json-http-post
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Is my POST method correct
@kevdoescode you ask if the post is correct. That probably means it does not work properly. If so, do you get and error message ? Is the result different from what you expected ? To use the forum properly, you have to provide this information, not just ask someone to correct your code. I advise also to read the very good post on how to properly use the forum: https://developer.apple.com/forums/thread/706527 A simple code sample here: https://forums.swift.org/t/sending-an-http-post-request-to-an-api-using-swift/62457
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’25