"Embed in button" NOT SHOWING

I need to use the embed in button action but when use the shortcut Comand + Click all that i am presented with is



Show Swift UI Inspector

Extract Subview

Embed in HScack

Embed in VStack

MISSING - Embed in Button <------ This is the only one that is missing and I need to use it for my course

Embed in List

Group

Make Conditional

Repeat


if their are any other ways to get to and or use that action please let me know! anyway besides Commnd + Click

Which object did you select with the command-click ?

Do you do this in Live Preview ?

Could you show also the code ?


PS: you should move your question to SwiftUI section of the forum.

import SwiftUI


struct ContentView: View {

@State var alertIsVisible: Bool = false


var body: some View {

VStack {

// Target row

HStack {

Text("Put the bullseye as close as you can to:")

Text(/*@START_MENU_TOKEN@*/"100"/*@END_MENU_TOKEN@*/)

}

// Slider Row

HStack {

Text("1")

Slider(value: .constant(10))

Text("100")

}

// Button row

Button(action: {

print("Button pressed!")

self.alertIsVisible = true

}) {

Text("Hit me please!")

}

.alert(isPresented: $alertIsVisible) { () -> Alert in

return Alert(title: Text("Hello there!"), message: Text("This is my first pop-up."), dismissButton: .default(Text("Awesome!")))

}

// Score row

HStack {

Text("Start Over")


}

}

}

}

struct ContentView_Previews: PreviewProvider {

static var previews: some View {

ContentView() .previewLayout(PreviewLayout.fixed(width: 896, height: 414))

}

}




P.S where is says ("Start Over") is where I need to press Command + Click and use the action "Embed in button"

when I am on the canvas I click Comand + Click and all that i am presesnted wirht on the dropdown menu is


Show Swift UI Inspector

Extract Subview

Embed in HScack

Embed in VStack

MISSING - Embed in Button <------ This is the only one that is missing and I need to use it for my course

Embed in List

Group

Make Conditional

Repeat

If you try on another text, such as

Text("Put the bullseye as close as you can to:")


Does it work ?


Try also to do it in the code, by changing:

        HStack {
            Text("Start Over")
            }

into

     HStack {
            Button(action: {print("ok")}) {
            Text("Start Over")
            }
       }


Does it compile or do you get an error ? If so, which error ?

I could test on a Catalina Mac.


Effectively, looks like the embed in button is not available !


I could embed in a Button in ode, but not in Preview.


I effectively saw this in some tutorials: h ttps://blog.appsbymw.com/posts/how-to-make-a-button-with-swiftui-134b/

Did you see it in an Apple Tutorial ?


I will file a bug. FB15851398

Should do the same.


PS: Please, move the thread to SwiftUI, others may have found a solution.

I have same issue, any solution ??
Tested with Xcode 11.6. Still no embed in button.
My XCode version is Version 12.5 (12E262)
Big Sur Version is 11.3 (20E232)

Have the same issue

Your canvas needs to be open to display the embeds.

To open canvas hit Opt + Cmd + Return or Editor -> Canvas!

"Embed in button" NOT SHOWING
 
 
Q