Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rich1812

macrumors regular
Original poster
Oct 4, 2015
117
5
earth
Hello, it's been quite a while since I did an iOS app. right now I use xCode 10.1 I follow this tutorial https://medium.com/@rizwanm/https-medium-com-rizwanm-swift-camera-part-1-c38b8b773b2.
One of the most annoyiny things in xcode is linking the buton. In step 2 of the tutorial, it says "
Control + drag our preview vie to ViewController.swift and create an IBOutlet named previewView". How do I do that? It seems no matter how I control drag, it never create an IBOutlet.
 
You need to have the storyboard and ViewController.swift both visible side by side. Control click on the view in the list of views and drag into the ViewController.swift file inside the ViewController class. You should see a blue line appear indicating where the outlet will be placed. Release the mouse and a little window will appear. Type in the name and close the little window. It should insert the IBOutlet.

There are other ways to do this but that's probably the most convenient.
 
  • Like
Reactions: grandM
You can put the storyboard and ViewController.swift next to each other tapping on a button on the right hand top. If another file appears option click on ViewController.swift.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.