Sami Abera Sami Abera - 5 days ago 5
Swift Question

IOS link item in containerview to viewcontroller

I just started IOS development and I was trying to build a simple app where I place items (

views
) in a
container view
and show the right
container view
when needed. Whenever I try to create an outlet for my subviews in my
ViewController.swift
, Xcode does not let me do that.I have also tried writing the outlet code in my
ViewController.swift
and linking it back to the story board and failed.

Answer

Make sure the class property of your View Controller and subviews in the Storyboard under Identity Inspector (on the right side of your Xcode window) matches exactly the name of your classes, such as in the example below.

enter image description here enter image description here

Comments