Meet the Swift Algorithms and Collections packages

RSS for tag

Discuss the WWDC21 session Meet the Swift Algorithms and Collections packages.

Posts under wwdc21-10256 tag

12 Posts

Post

Replies

Boosts

Views

Activity

Cryptographic Message Syntax Services for swift
In Swift, I need to create a CMS to input a web service. In Android we used 'spongycastle' https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html But I did not find a sample or solution for Swift or objective C. I also read Apple related documents https://developer.apple.com/documentation/security/cryptographic_message_syntax_services#1677736 , but still nothing special. Does anyone have experience working with a specific solution for Swift or objective C code to do this? thank you.
4
0
1.8k
Aug ’23
Uploading app using Swift Playground
Hi everyone, I really need help right now and feel really stuck. I created an app using Swift Playground on my ipad since i dont have a Mac. App store connect requires me to submit a build but i couldn'd find any way to do that without Xcode, altool or transporter, which are all apps for the MAC. One alternative I thought of was that I could find someone who has a MAC and use xcode to create a build. However, I am unsure whether the Swift app can be opened on xcode and if yes how to do it.
1
0
1.2k
May ’22
Expected declaration
Hello, I've been attempting to generate this code, but the last line returns an Expected declaration Error. class AboutMe { let firstName: String let lastName: String let age: Int init(firstName: String, lastName: String, age: Int){ self.firstName = firstName self.lastName = lastName self.age = age } var me: String { return "First Name: \(firstName), / Last Name: \(lastName), / Age: \(age)" } let myInfo = AboutMe(firstName: "NAME", lastName: "NAME", age: 10) print(myInfo) }
3
0
1.1k
May ’22
Why is it so hard to simply play an audio file in SwiftUI?
I'm building an app using SwiftUI, and am perplexed at why it seems so difficult to simply play an audio file that is in my assets. One would think it possible to write some code like: play(sound: "(name).m4a") but this seems unsupported. You must write elaborate, verbose code. Anyone comment on why it doesn't 'just work'? I understand that much more complex audio code requires more, but it seems that simply playing a file could be supported.
1
0
967
Mar ’22
M1 architecture issue
I have an M1 MacBook Air! I tried installing 'keras' and 'tensorflow' packages in Rstudio. However I got an error. Then, I tried creating a virtual env to work in it and my script did run for a couple of hours but then it's again back to the same error: Error in py_initialize(config$python, config$libpython, config$pythonhome, : /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib - dlopen(/Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib, 10): no suitable image found. Did find: /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib: mach-o, but wrong architecture /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib: mach-o, but wrong architecture How can this be resolved because I'm pretty sure it's an architecture problem!!
2
0
3.4k
Mar ’22
JSONDecoder().decode failing on struct containing array(s)
I am attempting to parse data received from my server. The data is defined by the struct PlayerList (A), and includes 3 arrays, one being the list of Player's ( B ), and the others, String's. When I try to parse the main Struct (PlayerList), I get the error, "typeMismatch(Swift.Array,Swift.DecodingError.Context(codingPath:..." when calling JSONDecoder().decode() (C). If I change the data to just be the array of Players, the main struct has no array fields, and JSON.decode() works just fine. An article I read suggested making that top level struct a 1 element array, which I did, but it didn't help. Suggestions are most welcome.
2
0
715
Nov ’21
Cryptographic Message Syntax Services for swift
In Swift, I need to create a CMS to input a web service. In Android we used 'spongycastle' https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html But I did not find a sample or solution for Swift or objective C. I also read Apple related documents https://developer.apple.com/documentation/security/cryptographic_message_syntax_services#1677736 , but still nothing special. Does anyone have experience working with a specific solution for Swift or objective C code to do this? thank you.
Replies
4
Boosts
0
Views
1.8k
Activity
Aug ’23
Uploading app using Swift Playground
Hi everyone, I really need help right now and feel really stuck. I created an app using Swift Playground on my ipad since i dont have a Mac. App store connect requires me to submit a build but i couldn'd find any way to do that without Xcode, altool or transporter, which are all apps for the MAC. One alternative I thought of was that I could find someone who has a MAC and use xcode to create a build. However, I am unsure whether the Swift app can be opened on xcode and if yes how to do it.
Replies
1
Boosts
0
Views
1.2k
Activity
May ’22
Expected declaration
Hello, I've been attempting to generate this code, but the last line returns an Expected declaration Error. class AboutMe { let firstName: String let lastName: String let age: Int init(firstName: String, lastName: String, age: Int){ self.firstName = firstName self.lastName = lastName self.age = age } var me: String { return "First Name: \(firstName), / Last Name: \(lastName), / Age: \(age)" } let myInfo = AboutMe(firstName: "NAME", lastName: "NAME", age: 10) print(myInfo) }
Replies
3
Boosts
0
Views
1.1k
Activity
May ’22
Why is it so hard to simply play an audio file in SwiftUI?
I'm building an app using SwiftUI, and am perplexed at why it seems so difficult to simply play an audio file that is in my assets. One would think it possible to write some code like: play(sound: "(name).m4a") but this seems unsupported. You must write elaborate, verbose code. Anyone comment on why it doesn't 'just work'? I understand that much more complex audio code requires more, but it seems that simply playing a file could be supported.
Replies
1
Boosts
0
Views
967
Activity
Mar ’22
M1 architecture issue
I have an M1 MacBook Air! I tried installing 'keras' and 'tensorflow' packages in Rstudio. However I got an error. Then, I tried creating a virtual env to work in it and my script did run for a couple of hours but then it's again back to the same error: Error in py_initialize(config$python, config$libpython, config$pythonhome, : /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib - dlopen(/Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib, 10): no suitable image found. Did find: /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib: mach-o, but wrong architecture /Users/mansichandra/mambaforge/envs/walnut/lib/libpython3.8.dylib: mach-o, but wrong architecture How can this be resolved because I'm pretty sure it's an architecture problem!!
Replies
2
Boosts
0
Views
3.4k
Activity
Mar ’22
JSONDecoder().decode failing on struct containing array(s)
I am attempting to parse data received from my server. The data is defined by the struct PlayerList (A), and includes 3 arrays, one being the list of Player's ( B ), and the others, String's. When I try to parse the main Struct (PlayerList), I get the error, "typeMismatch(Swift.Array,Swift.DecodingError.Context(codingPath:..." when calling JSONDecoder().decode() (C). If I change the data to just be the array of Players, the main struct has no array fields, and JSON.decode() works just fine. An article I read suggested making that top level struct a 1 element array, which I did, but it didn't help. Suggestions are most welcome.
Replies
2
Boosts
0
Views
715
Activity
Nov ’21