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