Post

Replies

Boosts

Views

Activity

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 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 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 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 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 What am I doing wrong here with my StateObject & @ObservedObject
To show the right usage of @StateObject, the relationship of two views needs to be clarified. But generally, if there are two initializers in your code, there may be two or more different instances of the same class, which causes unexpected behavior. Assuming your SampleWeatherView is a subview of WeatherView in your view hierarchy, you can write something like this: WeatherView struct WeatherView: View { @AppStorage("userTempChoice") var userTempChoice = "Fahrenheit" //Use only 1 `@StateObject` where the only initializer exists @StateObject var weather = UserWeatherData() var body: some View { VStack { SampleWeatherView(weather: weather) Text("Tap Me") .onTapGesture { //I set my data //A simplified working example weather.currentDescription = "Sunny all day!!!" } } } } SampleWeatherView struct SampleWeatherView: View { //Do not put an initializer except `@StateObject` @ObservedObject var weather: UserWeatherData var body: some View { Text(weather.currentDescription) } } If you could show more context representing the view hierarchy of your app, there might be the right solution other than above code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to Want to know for loop parallel using swift 5.5
Seems you have read the Concurrency part of the Swift book, but it does not tell much about the current restrictions of async let. Does swift 5.5 support this case??? If you mean using async let inside a code block of looping statement such as for-in, the answer is no. In the accepted proposal SE-0317 async let bindings, you can find this description: Specifically, async let declarations are not able to express dynamic numbers of tasks executing in parallel, like this group showcases: func toyParallelMap<A, B>(_ items: [A], f: (A) async -> B) async -> [B] { return await withTaskGroup(of: (Int, B).self) { group in var bs = [B?](repeating: nil, count: items.count) // spawn off processing all `f` mapping functions in parallel // in reality, one might want to limit the "width" of these for i in items.indices { group.async { (i, await f(items[i])) } } // collect all results for await (i, mapped) in group { bs[i] = mapped } return bs.map { $0! } } } In the above toyParallelMap the number of child-tasks is dynamic because it depends on the count of elements in the items array at runtime. Such patterns are not possible to express using async let because we'd have to know how many async let declarations to create at compile time. I use TaskGroup already, but I want to know that swift supports it. Seems you need to go on with TaskGroup in cases such as described in your opening post.
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 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 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 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 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 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 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 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 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 -[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 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 why is my app just stopping how do I fix this
When you show your code, please show it as text using Code Block. And you should better properly respond to the comments and answers to your old post.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to What am I doing wrong here with my StateObject & @ObservedObject
To show the right usage of @StateObject, the relationship of two views needs to be clarified. But generally, if there are two initializers in your code, there may be two or more different instances of the same class, which causes unexpected behavior. Assuming your SampleWeatherView is a subview of WeatherView in your view hierarchy, you can write something like this: WeatherView struct WeatherView: View { @AppStorage("userTempChoice") var userTempChoice = "Fahrenheit" //Use only 1 `@StateObject` where the only initializer exists @StateObject var weather = UserWeatherData() var body: some View { VStack { SampleWeatherView(weather: weather) Text("Tap Me") .onTapGesture { //I set my data //A simplified working example weather.currentDescription = "Sunny all day!!!" } } } } SampleWeatherView struct SampleWeatherView: View { //Do not put an initializer except `@StateObject` @ObservedObject var weather: UserWeatherData var body: some View { Text(weather.currentDescription) } } If you could show more context representing the view hierarchy of your app, there might be the right solution other than above code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Checkmarks are not removed from the table cell
if foods were class, would that make a difference? YES. Is that right? Right.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Want to know for loop parallel using swift 5.5
Seems you have read the Concurrency part of the Swift book, but it does not tell much about the current restrictions of async let. Does swift 5.5 support this case??? If you mean using async let inside a code block of looping statement such as for-in, the answer is no. In the accepted proposal SE-0317 async let bindings, you can find this description: Specifically, async let declarations are not able to express dynamic numbers of tasks executing in parallel, like this group showcases: func toyParallelMap<A, B>(_ items: [A], f: (A) async -> B) async -> [B] { return await withTaskGroup(of: (Int, B).self) { group in var bs = [B?](repeating: nil, count: items.count) // spawn off processing all `f` mapping functions in parallel // in reality, one might want to limit the "width" of these for i in items.indices { group.async { (i, await f(items[i])) } } // collect all results for await (i, mapped) in group { bs[i] = mapped } return bs.map { $0! } } } In the above toyParallelMap the number of child-tasks is dynamic because it depends on the count of elements in the items array at runtime. Such patterns are not possible to express using async let because we'd have to know how many async let declarations to create at compile time. I use TaskGroup already, but I want to know that swift supports it. Seems you need to go on with TaskGroup in cases such as described in your opening post.
Replies
Boosts
Views
Activity
Oct ’21