Post

Replies

Boosts

Views

Activity

Reply to Passing C++ Types as Reference using SWIFT_IMMORTAL_REFERENCE.
Just a remark on the use of the forum. You may ask as many questions as needed, but you have to answer to replies you get to tell if that answers your question (and then close the thread) or if not explain in the same post what is the remaining issue. Otherwise, developers on this forum may get tired to answer your repeated posts on very similar questions if they never receive a feedback. Have a good day.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to Variable for DestinationView
When you post code, please post more so that we can better explain the solution. So, show how stasSigns is defined and how each zodiacSign is defined in this structure. A typical pattern would be: struct ContentView : View { @ViewBuilder func destination(name: String) -> some View { switch name { case "aries": AriesView() // other case here default: EmptyView() } } var body: some View { List { ForEach(starSigns) {zodiacSign in // zodiacSign should start with lowercase, as it is an instance NavigationLink(destination: destination(name: zodiacSign.name)) {// destinationView should start with lowercase, as it is a property HStack { Text(zodiacSign.Symbol) Text(zodiacSign.name) } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to Testflight issue: "Could not install <app_name>. The requested app is not available or doesn't exist."
But when I archive the build and distribute it to TestFlight via AppStore Connect, I always get this error message as shown below. Did you get a reply from Appstore, such as this one: Dear raahimkhan, The following build has completed processing: Platform: iOS App Name: SomeRandomApplication Build Number: 1000 Version Number: 1.0.0 App SKU: yyyyyyyyyyyyy App Apple ID: xxxxxxxx You can now use this build for TestFlight testing or submit it for distribution. If you have any questions regarding your app, click Contact Us in App Store Connect. Regards, Apple Developer Relations If you have received, have you submitted to TestFlight ? How did you do it ?
Sep ’24
Reply to Is case sensitivity the default for any Mac?
Mac and it was case sensitive by default without them taking any action. What do you mean exactly by Mac is case sensitive ? Do you mean Finder ? Which version of MacOS ? What problem does this cause in your app ? On a Mac with 14.6.1 (23G93), if I have 2 files names : A File and A file, they are considered the same name (not case sensitive). But when sorting files by name, upper / lower case is taken into account.
Topic: App & System Services SubTopic: Core OS Tags:
Sep ’24
Reply to Returning Reference from Swift Function
You seem to have a major concern with reference values. What is the main issue you have ? As a general comment, you should avoid trying to replicate exactly C++ patterns into Swift. Some logics (notably about types, memory management…) are pretty different and it may be risky with dangerous side effects. https://stackoverflow.com/questions/752658/is-the-practice-of-returning-a-c-reference-variable-evil In your example, what is the purpose of noexcept here ? Are you sure it is correct ? int & ReturnIntRef () It should be int& ReturnIntRef () Similar pattern in Swift would not work, as the var a would be deleted when exiting the function, unless you use an escaping closure, but that may be overkill. There are several ways to do what you want. A simple one, as I answered in another post is to call parameter as inout. you can also declare a class type that holds the parameter use pointers, at your own risks, as described in detail here: https://stackoverflow.com/questions/27539533/how-to-return-an-inout-reference-in-a-swift-function
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to How to make an updatable ForEach loop SwiftUI
When I start the app there's only one "hey" and no more will show up when I add more flags. No, you get 2 heys, as explained by @B347 What you want is not clear at all. what do you expect to get ? display text per child: where are the children defined ? where and how do you add flags ? In any case, if you want view to be updated, flags should be a State var. An advice: study an Apple tutorial on Swift and SwiftUI. It seems there are some basics you are still missing.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to Inserting array of model objects using modelContext
AFAIK, there is not. But it is really easy to build it (even as extension) by calling insert in a loop on all objects. Get some additional advice here for performance optimisation: https://stackoverflow.com/questions/77533881/how-do-you-insert-an-array-of-objects-into-the-swiftdata-modelcontext modelContext.transaction { for obj in objects { modelContext.insert(obj) } do { try modelContext.save() } catch { // Handle error } }
Topic: App & System Services SubTopic: iCloud Tags:
Sep ’24
Reply to Copy Creation when we pass primitive type such as Int to a Swift Function.
If you want to pass a reference, to be able to modify the parameter, you have to use inout. public func Test (_ pValue : inout Int) { print ("on call", pValue) pValue += 10 } var x : Int = 2 // Must be a var ; // with let, would get a compile error: // Cannot pass immutable value as inout argument: 'x' is a 'let' constant Test (&x) print ("after call", x) You get: on call 2 after call 12
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to Upload an application to appstore connect failed. (90022, 90713)
So, what is your question ? What are your target versions ? Did you include the required icon ? Note that known you can provide a single 1024*1024 icon to cover all sizes.
Replies
Boosts
Views
Activity
Sep ’24
Reply to Exclamation in App Review
Yes, it is normal, even though a bit stressful. As long as review has not been completed, status is effectively "rejected". Don't worry, it will clear once accepted.
Replies
Boosts
Views
Activity
Sep ’24
Reply to Passing C++ Types as Reference using SWIFT_IMMORTAL_REFERENCE.
Just a remark on the use of the forum. You may ask as many questions as needed, but you have to answer to replies you get to tell if that answers your question (and then close the thread) or if not explain in the same post what is the remaining issue. Otherwise, developers on this forum may get tired to answer your repeated posts on very similar questions if they never receive a feedback. Have a good day.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Need to remove a button image and use new xcode features
If I understand correctly what you want, you just have to clear (delete) the ext with the present image nam. That's equivalent to a 'none'.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Variable for DestinationView
When you post code, please post more so that we can better explain the solution. So, show how stasSigns is defined and how each zodiacSign is defined in this structure. A typical pattern would be: struct ContentView : View { @ViewBuilder func destination(name: String) -> some View { switch name { case "aries": AriesView() // other case here default: EmptyView() } } var body: some View { List { ForEach(starSigns) {zodiacSign in // zodiacSign should start with lowercase, as it is an instance NavigationLink(destination: destination(name: zodiacSign.name)) {// destinationView should start with lowercase, as it is a property HStack { Text(zodiacSign.Symbol) Text(zodiacSign.name) } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Testflight issue: "Could not install <app_name>. The requested app is not available or doesn't exist."
But when I archive the build and distribute it to TestFlight via AppStore Connect, I always get this error message as shown below. Did you get a reply from Appstore, such as this one: Dear raahimkhan, The following build has completed processing: Platform: iOS App Name: SomeRandomApplication Build Number: 1000 Version Number: 1.0.0 App SKU: yyyyyyyyyyyyy App Apple ID: xxxxxxxx You can now use this build for TestFlight testing or submit it for distribution. If you have any questions regarding your app, click Contact Us in App Store Connect. Regards, Apple Developer Relations If you have received, have you submitted to TestFlight ? How did you do it ?
Replies
Boosts
Views
Activity
Sep ’24
Reply to iPhone 16, Plus, Pro and Pro Max device identifiers/codes?
That seems a reasonable assumption, but just assumption. I wait for the list to be updated here: https://gist.github.com/adamawolf/3048717 Here is what they say, which is slightly different from you: "iPhone17,3": .iPhone16, "iPhone17,4": .iPhone16Plus, "iPhone17,1": .iPhone16Pro, "iPhone17,2": .iPhone16ProMax,
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Returning Typed Pointer From Swift to C++
Yes, UnsafeMutableRawPointer is a way to do it. But look at some other of your post for a discussion about the issues doing so.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Is case sensitivity the default for any Mac?
Mac and it was case sensitive by default without them taking any action. What do you mean exactly by Mac is case sensitive ? Do you mean Finder ? Which version of MacOS ? What problem does this cause in your app ? On a Mac with 14.6.1 (23G93), if I have 2 files names : A File and A file, they are considered the same name (not case sensitive). But when sorting files by name, upper / lower case is taken into account.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Returning Reference from Swift Function
You seem to have a major concern with reference values. What is the main issue you have ? As a general comment, you should avoid trying to replicate exactly C++ patterns into Swift. Some logics (notably about types, memory management…) are pretty different and it may be risky with dangerous side effects. https://stackoverflow.com/questions/752658/is-the-practice-of-returning-a-c-reference-variable-evil In your example, what is the purpose of noexcept here ? Are you sure it is correct ? int & ReturnIntRef () It should be int& ReturnIntRef () Similar pattern in Swift would not work, as the var a would be deleted when exiting the function, unless you use an escaping closure, but that may be overkill. There are several ways to do what you want. A simple one, as I answered in another post is to call parameter as inout. you can also declare a class type that holds the parameter use pointers, at your own risks, as described in detail here: https://stackoverflow.com/questions/27539533/how-to-return-an-inout-reference-in-a-swift-function
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to How to make an updatable ForEach loop SwiftUI
Thanks, but that's not enough to test code. We don't see var declarations, code to change the flags… So, no way to help with so limited code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to How to make an updatable ForEach loop SwiftUI
Thanks for the reply. What is needed is to see the complete code, to understand what you do and what is to be changed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to How to make an updatable ForEach loop SwiftUI
When I start the app there's only one "hey" and no more will show up when I add more flags. No, you get 2 heys, as explained by @B347 What you want is not clear at all. what do you expect to get ? display text per child: where are the children defined ? where and how do you add flags ? In any case, if you want view to be updated, flags should be a State var. An advice: study an Apple tutorial on Swift and SwiftUI. It seems there are some basics you are still missing.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Inserting array of model objects using modelContext
AFAIK, there is not. But it is really easy to build it (even as extension) by calling insert in a loop on all objects. Get some additional advice here for performance optimisation: https://stackoverflow.com/questions/77533881/how-do-you-insert-an-array-of-objects-into-the-swiftdata-modelcontext modelContext.transaction { for obj in objects { modelContext.insert(obj) } do { try modelContext.save() } catch { // Handle error } }
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Copy Creation when we pass primitive type such as Int to a Swift Function.
If you want to pass a reference, to be able to modify the parameter, you have to use inout. public func Test (_ pValue : inout Int) { print ("on call", pValue) pValue += 10 } var x : Int = 2 // Must be a var ; // with let, would get a compile error: // Cannot pass immutable value as inout argument: 'x' is a 'let' constant Test (&x) print ("after call", x) You get: on call 2 after call 12
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’24