Post

Replies

Boosts

Views

Activity

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 Title: App Rejected (4.3(a) - Design Spam)
It was effectively a bad idea to submit the app from a differentl account. Now, the app is viewed as belonging to it. Are you sure the spam is related to this former submission ? If so, did you explain in the notes to reviewer, with a written and signed statement from the junior engineer confirming what you say here ? If that's not enough, may be you should also have the letter certified by a legal officer.
Aug ’25
Reply to Toolbar button is clipped in iOS 26
Welcome to the forum. You place both buttons as topBarLeading. Is it on purpose ? No issue if this second button is topBarTrailing The same occurs if MyButtonStyle is first: it gets clipped. Idem if MyButtonStyle is the only button: And if image is removed, Text is truncated with ellipsis… But setting a frame width for the text (or even better, the HStack) solves the problem: struct MyButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { HStack { Image(systemName: "chevron.backward") Text("Back") .frame(width: 80) // <<-- ADDED } } } So looks like that without setting the frame, frame is considered zero (or very small), probably to optimise space ? You could file a bug report.
Topic: UI Frameworks SubTopic: SwiftUI
Aug ’25
Reply to Question about Xcode
Here is the structure of a project with a Watch companion app (it was created several years ago, with Xcode 9 or 10 probably and uses WatchKit and not SwiftUI): I have highlighted the 3 info.plist the first is the usual for iOS app, in iOS section (bundle display name is 'MyApp') Second in myApp Watch (bundle display name is 'MyApp'). The content is: third info.plist in myApp Watch Extension (bundle display name is 'MyApp Watch extension'). Its content is: Note also infoPlist, which contains some localizations, with keys as CFBundleName, NSCameraUsageDescription I don't remember how they were created (I think it was automatic when creating watch companion, but you can probably recreate manually). Hope that helps.
Aug ’25
Reply to Restricting App Installation to Devices Supporting Apple Intelligence Without Triggering Game Mode
Effectively, exploring what could be done with UIRequiredDeviceCapabilities in Info.plist appears the best option. https://stackoverflow.com/questions/10191657/restrict-to-certain-ios-target-devices-for-app-store-submission May be you can find a listed capability that matches approximately with support of Apple Intelligence. But unfortunately, gaming seems to be the only one to discriminate for A17 chip. https://developer.apple.com/support/required-device-capabilities/
Aug ’25