Hello,
I am having the following code:
VStack{
Image()
HStack(alignment: .center) {
VStack(alignment: .leading{
Text("1")
Text("2")
}.border(Color.red, width: 4)
/* Spacer() */
Text("3").border(Color.red, width: 4)
}
}
I want that the VStack inside the HStack to take the maximum available width after taking in the account Text("3").
However, there is a large space between them when I use Spacer(), and using GeometryReader is not going to work as there might be different values for Text("3")
Am I using layouts wrong?
Thanks
Post
Replies
Boosts
Views
Activity
Hello,
I have created a Core Data application which contains Order and CartProduct entities.
Order has one-to-many relationship with CartProduct and the inverse is to-one.
I add the products to the order, but there is a page where I want to display the products but looks like there is displayed only the last product.
@FetchRequest(
		entity: Order.entity(),
sortDescriptors: [],
predicate:NSPredicate(format: "status == %@", "ongoing")
) var orders: FetchedResults<Order>
var body: some View {
if(!orders.isEmpty)
{
GeometryReader {geometry in
VStack(alignment: .leading){
Text("Ongoing order").padding().font(.largeTitle)
List(orders[0].products!.array as! [CartProduct]){product in
Text("\(product.quantity) * \(product.name!)")
}.onAppear(perform: printProducts)
}
}
}
}
In printProducts it prints the correct quantity of all the products, but in the list, only the quantity (and name) of the first product gets repeated (the number of products is correct)
Am I missing something on Core Data?
On a simulator I'm trying to add editMode to a list and it looks like it is not working.
@State private var editMode = EditMode.active
List {
ForEach (array) {
product in Text("\(product.quantity) x \(product.name)")
}
}.frame(maxHeight: geometry.size.height * 0.25)
.environment(\.editMode, $editMode)
Am I doing something wrong or is this a bug (or maybe not available) on ios 14?
Hello everybody.
I added in XCode as parameter XCAppClipURL to my url which is added also in associated domains as
appclips:example.com
I followed the instructions presented here - https://developer.apple.com/documentation/app_clips/responding_to_invocations#overview on scene(_:willConnectTo:options:) like this:
if let userActivity = scene.userActivity{
respondTo(userActivity)
}
And then placed the code provided for respondTo.
However, when going with the debugger I couldn't get to the end of the code because some parameters are null.
What am I doing wrong when trying to open the scene?
Thank you