IBAction issue in Xcode StoryBoard

48 views Asked by At

I'm a newbie in coding and I'm learning Swift to develop my first application.

I'm following this YT tutorial trying to integrate a SideMenu : https://www.youtube.com/watch?v=iq-tWW45Vhk

The fact is that after I added the @IBAction func into my code like this:

ViewController code

I do not find the received action I create in the code like in the video at 4:47

Youtube Screenshot

I found out that this appears only in my first ViewController (the blue screen) of my StoryBoard but I want the function to appear on the top right view controller Storyboard

Can someone help me?

Thx

Julien

2

There are 2 answers

0
Ramesh Sanghar On BEST ANSWER

For all viewControllers in story board you have to create separate swift class files, and create it's IBAction outlet in it's class file.

add viewController class here : enter image description here

after this you will be able to create IBOutlet and IBActions in that class.

0
Caleb On

I found out that this appears only in my first ViewController (the blue screen) of my StoryBoard but I want the function to appear on the top right view controller Storyboard

You need to put the action in the view controller class where you want it to appear. If it's showing up somewhere else, it's in the wrong class.