Yes, there are several posts about this problem, but none of these seem to answer my problem?
I created a custom view in a nib file and connected it to code, exactly like here:
Only differences:
- My class is named EditorSectionView not CustomView
- My outlet's name is customView, not contentView
Apart from the code, i did the following, as described in the gist:
- In Interface-Builder, click on "File's Owner" and make the File owner's custom class "EditorSectionView", NOT the View itself
- Drag and Drop the top level view (the "Custom view" named item from Interface Builder) to the EditorSectionView via Assistance Editor to create an outlet named customView.
Whenever i start the app and click on the button that should use this custom view, it crashes with the error:
"This class is not key value coding-compliant for the key customView".
However, when i have a look at the connections inspector, in my nib file, there is no "!" like some other posts pointed out and all seems to be fine.
I am using the nib file like that to instantiate it:
form +++ Section(field.name) {
let header = HeaderFooterView<EditorSectionView>(.nibFile(name: "EditorSectionView", bundle: nil))
}
This should create a new form section in Eureka, as described here: https://github.com/xmartlabs/Eureka/blob/master/README.md (Search for "You can use a Custom View from a .xib file:" in the readme).
I have tried to solve this for an hour now, but i don't know what else to do. All connections are set (the outlet, the class for the UI), the code itself copied from a gist, etc.
What am i doing wrong here?
Thanks.
EDIT:
If i set the custom class in the identity inspector as well to EditorSectionView, not only the File's Owner custom class to EditorSectionView, it doesn'T crash any more with "not coding compliant for key XY" but it crashes with EXC_BAD_ACCESS on the line i am calling loadNibNamed().
I found here the answer, that i should not set a custom class for the top level view, which will result again in "not coding compliant". So either way it still doesn't work...