Post

Replies

Boosts

Views

Activity

Reply to How can I pass a function pointer in Swift?
An example, which I think it illustrates how Selector is different than a function pointer: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() makeButton(vControl: self, action: #selector(AnotherClass.buttonActionWithSender(_:))) //<- } @objc func buttonAction(sender: UIButton!) { print("Button tapped") } } func makeButton(vControl: ViewController, action aSelector: Selector) { let button = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50)) button.backgroundColor = .green button.setTitle("Test Button", for: .normal) button.addTarget(vControl, action: aSelector, for: .touchUpInside) vControl.view.addSubview(button) } class AnotherClass: NSObject { @objc func buttonActionWithSender(_ sender: UIButton) { print("\(type(of: self))-\(#function)") } } Please see what will happen with this code.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’21
Reply to How can I pass a function pointer in Swift?
I would have to pass a pointer to the function buttonAction Seems you may be mistaking something. In target-action pattern of UIKit, you need to pass a pair of target and action. And the action is not a function pointer, but is a selector. So, you can write something like this: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() makeButton(vControl: self, action: #selector(self.buttonAction(sender:))) } @objc func buttonAction(sender: UIButton!) { print("Button tapped") } } func makeButton(vControl: ViewController, action: Selector) { let button = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50)) button.backgroundColor = .green button.setTitle("Test Button", for: .normal) button.addTarget(vControl, action: action, for: .touchUpInside) vControl.view.addSubview(button) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’21
Reply to Xcode Build Alerts
Xcode 13 uses system notifications for events like Build Succeeds or Build Failed. You can customize the Notification through System Preferences: And Xcode Preferences: Though, I have not succeeded to show Notifications as Banners till now.
Oct ’21
Reply to Betting App
As far as I know, no one who are responsible about reviewing and approval process of App Store has never answered here in the dev forums. So, you may need to consider all the description in the App Store Review Guidelines. About gambling apps, it has a strict description about legality: 5.3 Gaming, Gambling, and Lotteries (There are other descriptions about gambling or real money, you may need to check all of them by yourself.) 5. Legal 5.3 Gaming, Gambling, and Lotteries Gaming, gambling, and lotteries can be tricky to manage and tend to be one of the most regulated offerings on the App Store. Only include this functionality if you’ve fully vetted your legal obligations everywhere you make your app available and are prepared for extra time during the review process. Some things to keep in mind: 5.3.1 Sweepstakes and contests must be sponsored by the developer of the app. 5.3.2 Official rules for sweepstakes, contests, and raffles must be presented in the app and make clear that Apple is not a sponsor or involved in the activity in any manner. 5.3.3 Apps may not use in-app purchase to purchase credit or currency for use in conjunction with real money gaming of any kind, and may not enable people to purchase lottery or raffle tickets or initiate fund transfers in the app. 5.3.4 Apps that offer real money gaming (e.g. sports betting, poker, casino games, horse racing) or lotteries must have necessary licensing and permissions in the locations where the app is used, must be geo-restricted to those locations, and must be free on the App Store. Illegal gambling aids, including card counters, are not permitted on the App Store.Lottery apps must have consideration, chance, and a prize. If you think you can fulfill all the requirements shown in the documentations or announcements of Apple's, there might be a chance your app would be approved for App Store.
Oct ’21
Reply to can I use the san francisco font in my company's logo?
If you open the Font Book app on your Mac and choose the font you want to use, you can see the license terms of the font: As far as I read the license of SF Pro Rounded, I could not find any statements you could use it in your company's logo. Instead, I could find this: You agree that you shall not use or incorporate the Symbols or any substantially or confusingly similar images into app icons, logos or make any other trademark use of the Symbols.  I'm not a legal expert, so you may contact to some legal or licensing expert and show all the terms in the license. But generally, you cannot use Apple's fonts other than using it in your apps.
Topic: Design SubTopic: General Tags:
Oct ’21
Reply to How can I pass a function pointer in Swift?
An example, which I think it illustrates how Selector is different than a function pointer: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() makeButton(vControl: self, action: #selector(AnotherClass.buttonActionWithSender(_:))) //<- } @objc func buttonAction(sender: UIButton!) { print("Button tapped") } } func makeButton(vControl: ViewController, action aSelector: Selector) { let button = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50)) button.backgroundColor = .green button.setTitle("Test Button", for: .normal) button.addTarget(vControl, action: aSelector, for: .touchUpInside) vControl.view.addSubview(button) } class AnotherClass: NSObject { @objc func buttonActionWithSender(_ sender: UIButton) { print("\(type(of: self))-\(#function)") } } Please see what will happen with this code.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to -[UTType conformsToType:] broken in iOS15?
As far as I tried your code, all three returned YES. How have you tested it?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to NSOSStatusErrorDomain Code=-54
Do you have any questions about the log? If you have any, you should better show the log formatted and clarify the context and environment you get it. First of all, you may need to clarify what you want to ask.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to How can I pass a function pointer in Swift?
I would have to pass a pointer to the function buttonAction Seems you may be mistaking something. In target-action pattern of UIKit, you need to pass a pair of target and action. And the action is not a function pointer, but is a selector. So, you can write something like this: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() makeButton(vControl: self, action: #selector(self.buttonAction(sender:))) } @objc func buttonAction(sender: UIButton!) { print("Button tapped") } } func makeButton(vControl: ViewController, action: Selector) { let button = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50)) button.backgroundColor = .green button.setTitle("Test Button", for: .normal) button.addTarget(vControl, action: action, for: .touchUpInside) vControl.view.addSubview(button) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to delete green (+) icon when onInsert
Can you show a complete code example and a sample image showing the green (+) icon?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Xcode Build Alerts
Xcode 13 uses system notifications for events like Build Succeeds or Build Failed. You can customize the Notification through System Preferences: And Xcode Preferences: Though, I have not succeeded to show Notifications as Banners till now.
Replies
Boosts
Views
Activity
Oct ’21
Reply to IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app
If you enclose it with a proper #if ... #endif, it does not cause error. #if os(macOS) import IOKit #endif Please do not forget, IOKit is Mac Catalyst 13.0+ compatible does not mean it is available for iOS/iPadOS apps, even if the project contains MacCatalyst target. MacCatalyst is for macOS, not iOS.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Betting App
As far as I know, no one who are responsible about reviewing and approval process of App Store has never answered here in the dev forums. So, you may need to consider all the description in the App Store Review Guidelines. About gambling apps, it has a strict description about legality: 5.3 Gaming, Gambling, and Lotteries (There are other descriptions about gambling or real money, you may need to check all of them by yourself.) 5. Legal 5.3 Gaming, Gambling, and Lotteries Gaming, gambling, and lotteries can be tricky to manage and tend to be one of the most regulated offerings on the App Store. Only include this functionality if you’ve fully vetted your legal obligations everywhere you make your app available and are prepared for extra time during the review process. Some things to keep in mind: 5.3.1 Sweepstakes and contests must be sponsored by the developer of the app. 5.3.2 Official rules for sweepstakes, contests, and raffles must be presented in the app and make clear that Apple is not a sponsor or involved in the activity in any manner. 5.3.3 Apps may not use in-app purchase to purchase credit or currency for use in conjunction with real money gaming of any kind, and may not enable people to purchase lottery or raffle tickets or initiate fund transfers in the app. 5.3.4 Apps that offer real money gaming (e.g. sports betting, poker, casino games, horse racing) or lotteries must have necessary licensing and permissions in the locations where the app is used, must be geo-restricted to those locations, and must be free on the App Store. Illegal gambling aids, including card counters, are not permitted on the App Store.Lottery apps must have consideration, chance, and a prize. If you think you can fulfill all the requirements shown in the documentations or announcements of Apple's, there might be a chance your app would be approved for App Store.
Replies
Boosts
Views
Activity
Oct ’21
Reply to can I use the san francisco font in my company's logo?
If you open the Font Book app on your Mac and choose the font you want to use, you can see the license terms of the font: As far as I read the license of SF Pro Rounded, I could not find any statements you could use it in your company's logo. Instead, I could find this: You agree that you shall not use or incorporate the Symbols or any substantially or confusingly similar images into app icons, logos or make any other trademark use of the Symbols.  I'm not a legal expert, so you may contact to some legal or licensing expert and show all the terms in the license. But generally, you cannot use Apple's fonts other than using it in your apps.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Run App on my physical device
If you have an Apple ID, you can run your app on your real device. (There are some restrictions.)
Replies
Boosts
Views
Activity
Oct ’21
Reply to “iPhone” is busy: Making the device ready for development
Do you have anything to ask about the message?
Replies
Boosts
Views
Activity
Oct ’21
Reply to Scanning QR code with color gradient
You should better use the Code Block feature properly. Even someone eager to help found this thread, they would not try to go further given this sort of unformatted code.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Xcode13-Version 13.0 (13A233)
It may be a temporary failure of the server of App Store Connect. When a big news about Apple is announced, Apple's servers show many, many, so many unexpected behaviors. Have you tried it several times with keeping a few hour intervals?
Replies
Boosts
Views
Activity
Oct ’21
Reply to Xcode could not open file
If you created the Xcode project through React Native, I guess it is the cause of the issue. React Native is not a framework of Apple's and you should better contact to the author of it or find a community site for it.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Are Button actions on the MainActor?
Seems you expect too much than documented.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21