CopyPastor

Detecting plagiarism made easy.

Score: 0.8001012206077576; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2023-02-04
by HunterLion

Original Post

Original - Posted on 2021-02-03
by cole



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Wrap the "fruit" `VStack` inside an `HStack`, then use a `Spacer()` to move the text to the left.
Like this:
``` ForEach(fruits, id: \.self) { fruit in HStack{ Image(systemName: "pencil.circle.fill") .frame(width: 65) .foregroundColor(.blue) .background(.yellow) // The VStack is inside an HStack HStack { VStack(alignment: .leading){ Text(fruit) .font(.title3) .foregroundColor(Color.blue) VStack(alignment: .leading) { Text("Some text") .foregroundColor(Color.gray) .font(.caption) Text("Some text:") .foregroundColor(Color.gray) .font(.caption) Text("Some Text:") .foregroundColor(Color.gray) .font(.caption) } }
// This Spacer() will push the VStack to the left Spacer() } .frame(maxWidth: .infinity) .background(.yellow) Button{ }label:{ Image( systemName: "circle.hexagongrid.circle") .padding() .background(Color.yellow) .foregroundColor( Color.blue) .cornerRadius(30) .overlay( Circle() .stroke( Color.gray, lineWidth: 0.5) ) } NavigationLink(destination: SomeView()){ } .frame(maxWidth: 10) } } // ForEach end ```
Hopefully this helps, let me know if it works for you. I believe you were looking for `.firstTextBaseline` to align with the first Text.
[![SwiftUI Widget][1]][1]

```swift struct Example_WidgetEntryView : View { var entry: Provider.Entry
var body: some View { VStack { HStack(alignment: .firstTextBaseline) { Image(systemName: "circle.fill") .resizable() .frame(width: 10, height:10) .foregroundColor(Color.orange) VStack (alignment: .leading){ Text("Wheat") .font(.subheadline) .fontWeight(.bold) .allowsTightening(true) Text("MATIF") .font(.footnote) .fontWeight(.bold) .foregroundColor(Color.secondary) .allowsTightening(true) } Spacer() Text("+1.75") .font(.footnote) .fontWeight(.bold) .foregroundColor(Color.green) .allowsTightening(true) } Spacer() HStack { Spacer() Text("168.02") .font(.title) .fontWeight(.bold) } } .padding(.all, 10) } } ```

[1]: https://i.stack.imgur.com/RZhu0.png

        
Present in both answers; Present only in the new answer; Present only in the old answer;