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

21 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
889
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
951
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
700
Nov ’21
Swift How do I change the button background color when the button is highlighted
How do I change the button background color when the button is highlighted with swift,then I also want to know . How can I make this background color last for a period of time instead of clicking it to disappear immediately? For example, I want it to disappear 2 seconds after clicking. I checked some information and couldn't find a way. All I can think of is to write a click event, then change the background color of the button and set a time to change it back
0
0
455
Oct ’21
saving picked image to coredata with MVVM SWIFTUI
I am trying to get a picked image and put it into my core data record... something like .sheet(isPresented: $isShowPicker,content: imagePickerSave(image: $image)       projectVM.projectImage = image! but something like this seems better but doesnt compile     imagePickerSave(image: $projectVM.projectImage) where projectVM is my coredata record So how do I assign the imagepicker value in the view to a projectimage field in the coredata record? I am using MVVM, what approach should i using please? Mark
0
0
526
Aug ’21
Convert Base64 to Zip file.
Hi, I am working on converting base 64 file format to zip file some of the zip files are getting converted successfully but some of them are not converting. Stetps: Getting base64 format from server. Converting into NSData.  NSData *dataEncoded = [[NSData alloc] initWithBase64EncodedString:output.base64Content options:0]; Writing this file into local memory and then accessing it. I am able to access some zip file like this way but some are getting corrupted. Please help me on this!
0
0
1.1k
Aug ’21
Api is not calling in ipad ios version 14.6
Hi Team, We are seeing a strange issue on the iPad device with iOS v14.6 where our backend API is not getting invoked. We have verified the same API calling code on multiple iPhone devices & simulators with different iOS versions ranging from v13.0-v14.6 and on iPad simulators with iOS versions ranging from v14.0-v14.5. It seems to be working fine on all except the real iPad device with v14.6. Any help in these is really appreciated.
0
0
992
Jul ’21
FirebaseFirestoreSwift Packaging Firebase with SwiftUI
How can I solve the following problem? : Cannot convert value of type 'Party' to expected argument type '[String : Any]' My Struct Party : import Foundation import FirebaseFirestoreSwift import FirebaseFirestore import Combine  struct Party:Identifiable,Decodable {     @DocumentID var id: String?     var UserHome:String     var HomeType:String     var Description:String     var Alcool:Bool     var Food:Bool     var day:String     var heure:String     var Price:Double     var image:[String]?     var locale:String     var placeRest:Int     @ServerTimestamp var createdTime:Timestamp? } I' use Firebase packaging import Foundation import FirebaseFirestore // (1) import FirebaseFirestoreSwift   func addParty(party:Party){         do{             let _ = try db.collection("party").addDocument(data: party) //Cannot convert value of type 'Party' to expected argument type '[String:Any]'         }         catch{             print("Il y a eu une erreur au moment de la sauvegarde de la Soirée")         }     }
1
0
818
Jul ’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
889
Activity
May ’22
Regarding Motion and fitness permission
when my app asks for motion and fitness permission to the user and the user denied that. If they go to setting and turn on that setting then my app forcefully restarts again. my question is why app restart again when we change motion and fitness settings?
Replies
0
Boosts
0
Views
909
Activity
Apr ’22
Core Data
Hi, please how can I save an array of Uiimages into core data as one of my attributes? And is it possible preload data into core data?
Replies
0
Boosts
0
Views
1.3k
Activity
Apr ’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
951
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
How do I change screens if you click on a VStack?
I know you can detect presses on a VStack with onTapGesture? But how do I change to a different view with it?
Replies
1
Boosts
0
Views
534
Activity
Jan ’22
list of dependencies of a swift project
Is there an equivalent file listing all dependencies of a Swift project like requirements.txt or environment.yml for python or package.json for javascript ?
Replies
1
Boosts
0
Views
879
Activity
Dec ’21
Write, Create and Read Excel Files in Swift without using third party library
Can anyone please guide me to create library which aid me to read and write app data in Excel file
Replies
2
Boosts
0
Views
2.3k
Activity
Dec ’21
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
700
Activity
Nov ’21
UILabel with superscript text
How can make a UILabel look this way in Xcode12?
Replies
2
Boosts
0
Views
2.7k
Activity
Nov ’21
Show Blank Appicon on iPhone12&iOS15
My colleague's phone is the iPhone 12, just upgraded to iOS 15, the app icon does not show. But other colleagues' cell phones are good, how to solve this problem?
Replies
2
Boosts
0
Views
762
Activity
Oct ’21
Swift How do I change the button background color when the button is highlighted
How do I change the button background color when the button is highlighted with swift,then I also want to know . How can I make this background color last for a period of time instead of clicking it to disappear immediately? For example, I want it to disappear 2 seconds after clicking. I checked some information and couldn't find a way. All I can think of is to write a click event, then change the background color of the button and set a time to change it back
Replies
0
Boosts
0
Views
455
Activity
Oct ’21
saving picked image to coredata with MVVM SWIFTUI
I am trying to get a picked image and put it into my core data record... something like .sheet(isPresented: $isShowPicker,content: imagePickerSave(image: $image)       projectVM.projectImage = image! but something like this seems better but doesnt compile     imagePickerSave(image: $projectVM.projectImage) where projectVM is my coredata record So how do I assign the imagepicker value in the view to a projectimage field in the coredata record? I am using MVVM, what approach should i using please? Mark
Replies
0
Boosts
0
Views
526
Activity
Aug ’21
Third-Party Subscribe for Swift Playgrounds
Is the Thrid-Party Subscribe free?
Replies
1
Boosts
0
Views
529
Activity
Aug ’21
wifi list in app
How to get wifi list in app with flutter?
Replies
0
Boosts
0
Views
458
Activity
Aug ’21
Convert Base64 to Zip file.
Hi, I am working on converting base 64 file format to zip file some of the zip files are getting converted successfully but some of them are not converting. Stetps: Getting base64 format from server. Converting into NSData.  NSData *dataEncoded = [[NSData alloc] initWithBase64EncodedString:output.base64Content options:0]; Writing this file into local memory and then accessing it. I am able to access some zip file like this way but some are getting corrupted. Please help me on this!
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’21
Api is not calling in ipad ios version 14.6
Hi Team, We are seeing a strange issue on the iPad device with iOS v14.6 where our backend API is not getting invoked. We have verified the same API calling code on multiple iPhone devices & simulators with different iOS versions ranging from v13.0-v14.6 and on iPad simulators with iOS versions ranging from v14.0-v14.5. It seems to be working fine on all except the real iPad device with v14.6. Any help in these is really appreciated.
Replies
0
Boosts
0
Views
992
Activity
Jul ’21
FirebaseFirestoreSwift Packaging Firebase with SwiftUI
How can I solve the following problem? : Cannot convert value of type 'Party' to expected argument type '[String : Any]' My Struct Party : import Foundation import FirebaseFirestoreSwift import FirebaseFirestore import Combine  struct Party:Identifiable,Decodable {     @DocumentID var id: String?     var UserHome:String     var HomeType:String     var Description:String     var Alcool:Bool     var Food:Bool     var day:String     var heure:String     var Price:Double     var image:[String]?     var locale:String     var placeRest:Int     @ServerTimestamp var createdTime:Timestamp? } I' use Firebase packaging import Foundation import FirebaseFirestore // (1) import FirebaseFirestoreSwift   func addParty(party:Party){         do{             let _ = try db.collection("party").addDocument(data: party) //Cannot convert value of type 'Party' to expected argument type '[String:Any]'         }         catch{             print("Il y a eu une erreur au moment de la sauvegarde de la Soirée")         }     }
Replies
1
Boosts
0
Views
818
Activity
Jul ’21