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")
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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 :)