Post

Replies

Boosts

Views

Activity

How to Add Inline Image Next to Text in SwiftUI
I am trying to add an image to the right of text to make the image appear inline. However when i do this with a HStack the image is to the right of the image for 1 line text but multi line text the image is just to the right of the frame of the view for the text and not Inline as i need eg. HStack { Text("Some Long Text") Image("info.circle") }
1
0
1.2k
Jun ’20
How to Save User Info to a Post using CloudKit?
1.What is the best way to link/store each User's info to a Post using CloudKit with CoreData? How can I make it that whenever the user changes their photo and I update the UserInfo record, have all the POST made by this user have the new updated photo? .xcdataModel file has a Post entity Post with the following attributes: caption: String, image: binary Data, postID: String, postText: String, userID: String, username: String I use the managedobjectContext method in SwiftUI to add Posts to the database like below.                 post.username = cloudkitManager.currentUser?.name                 post.userID = cloudkitManager.userDefaultsID                 post.postText = self.viewModel.serialNumber                 post.postID = UUID().uuidString                 post.timestamp = Date()                                  if self.viewModel.imageData() != nil {                     post.image  = self.viewModel.imageData()                 }                                  do {                     if viewContext.hasChanges {                         try viewContext.save()                         self.viewModel.isLoading = false                         self.presentationMode.wrappedValue.dismiss()                     }                 } catch {                     self.viewModel.isLoading = false                     let nsError = error as NSError                     self.viewModel.errorMessage = error.localizedDescription                     self.viewModel.showErrorAlert = true                     fatalError("Unresolved error \(nsError), \(nsError.userInfo)")                 } But when saving the UserInfo I use a normal CloudKit container.publicCloudDatabase.save method instead of using the managedObjectContext like above Any Advise please help :)
0
0
464
Jun ’21
Can I use CloudKit to make a Chat Messaging section in app
how can I use CloudKit to make a chat messaging section in my app. I want users to be able to have private conversations with another user without it being public to everyone. I don’t want to use public database cause then everyone would see the 2 users personal convo. I don’t want to use private database because I want both users to be able to see the messages sent to each other in convo. I normally would use Firebase with messagekit for this but I want to try with CloudKit . any help would be appreciated
0
1
759
Oct ’20
Toggle in SwitfUI TapGesture doesnt work when a ToggleStyle is Attached
When there is a toggleStyle added to my Toggle, the Toggle's TapGesture stops responding unless i remove the toggleStyle. However the Text inside the Toggle's closure Text("Some Text") still responds to tap but not the tapgesture on the Toggle itself with the print("Toggle Tapped") Toggle(isOn: $shouldToggle) {       Text("Some Text")         			.onTapGesture {          				 print("Some Text Tapped")       				 }     } 		.onTapGesture {          				 print("Toggle Tapped")       				 } 		.toggleStyle(MyCustomToggleStyle())
0
0
917
Jul ’20
How to have Multiline Text in HStack with Image Next to last line of text
I want to align a small image right next to multiline text at THE LAST WORD for the text in a HStack like below:   var body: some View {     HStack(alignment: .lastTextBaseline, spacing: 0) {       Text("Long Multine Line Text in List.adhjshdsjhdshdjshdjsbdjbdsajdbjbdajbdsajdbjasbdjadbajbdjabdjadbjadbjasdddfds")       Image(systemName: "pencil")     }   } } But when i do this the Image is at the same level of the last line in multine line text BUT there is spacing between them as if the image is outside of the Text's frame(not sure), How can i have the image right next to the Multiline Text?
1
0
1.2k
Jul ’20
MangedObjectContext data changes not showing in Cloudkit but Record Type was added successfully
I have a Post Model type that i made in .xcdatamodel, then switched Codegen to Manual/None and got two files Post+CoreDataClass & Post+CoreDataProperties In my AddPostView I am saving changes like below:             post.title = self.viewModel.postTitle             post.comment = self.viewModel.postComment             post.serialNumber = self.viewModel.postSerialNumber             do {               if self.managedObjectContext.hasChanges {                 try self.managedObjectContext.save()               }               self.isShown.toggle()             } catch {               self.showErrorAlert.toggle()               print(error.localizedDescription)             } When this executes i see the record type in CloudKit Dashboard Schema, Record Type but when i go to the Data section I dont see any data added. Anyone can help why this may. be happening?
0
0
375
Jul ’20
Why are my CloudKit Record Types showing "CD_" Prefix ?
I am adding some data in CloudKit with my record type called Post made in my .xcdatamodeld but all of my entry field names are adding the "CD_" below is the logic im using : add the environmentObject at the top of the view @Environment(\.managedObjectContext) var managedObjectContext saving to cloudkit using manageobjectcontext var post = Post(context: self.managedObjectContext)             post.title = self.viewModel.addPostTitle             post.comment = self.viewModel.aboutPostComment             post.serialNumber = 23             do {             try self.managedObjectContext.save()             } catch {             print(error)             } my records should be returning example: "comment" but is instead returning "CD_comment"
1
0
718
Jul ’20