Actually need your help! I went through every possible post considering this issue and nothing works.
So, I use the .xib file to create a subview in ProfileFoldingCellView.swift, which works fine until I try to add an IBOutlet to the same class. Here is the code:
import Foundation
import UIKit
class ProfileFoldingCellView: UIView {
@IBOutlet var mainLabel: UILabel!
public var cellIndex: Int = 0
init(index: Int) {
super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
cellIndex = index
print("Index: \(cellIndex)")
setupContentView()
}
func setupContentView() {
let contentView = UINib(nibName: "ProfileFoldingCellView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIView
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(contentView)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupContentView()
}
}
As you can see, the IBOutlet shortcut is created without any problems, and there are no other outdated or unused roaming.
http://imgur.com/a/jb9CA
I also made sure that ProfileFoldingCellView.swift is the file owner class.
Everything works fine until I plug in the socket! Then I get this error:
http://imgur.com/a/6hHPG
Believe me, I tried everything. I probably again created the output a million times, nothing works. Any help would be greatly appreciated!