• c kizerc kizer, almost 7 years ago

    I don't understand in a new project how to wire swift code up to ui elements like my edit field or buttons. I've tried to follow some objective-c tutorials to figure it out.

    Any tips? Is there a tutorial for swift yet that shows me how to take input from edit field into my swift code?

    0 points
    • Sri KadimisettySri Kadimisetty, almost 7 years ago (edited almost 7 years ago )

      Its not very different really.

      Take a look at this - Connected Properties in Swift

      I started a Swift Project and opened the View controller right next to the storyboard. Then I dropped a button on the Storyboard. You probably have it till this point. Now just Ctrl-Drag from the button to an appropriate location within the Class. The place you drop it will form a property or an action depending on whether you pick Attribute or Button Action just like in Objective C. You know how in Obj-C you would likely place these connected properties in between @interface and @end. In Swift you just place them inside the class, anywhere should work, but honestly its just good practice to put them somewhere at the top. Hope that helps !! :)

      1 point