ios - drawRect not called when subclassing UIView and adding it in the interface builder -


i trying subclass uiview. code so:

import uikit  class customview: uiview {       override func drawrect(rect: cgrect) {         // drawing code         let circlepath = uibezierpath(ovalinrect: rect)         uicolor.bluecolor().setfill()         circlepath.fill()     } 

}

i have dragged uiview onto uiviewcontroller , set class customview circle doesn't appear (i have set constraints correctly). ideas might doing wrong here? i'm not trying preview it. want see when run app. seems getting error in console too: unknown class _ttc9myproject15customview in interface builder file.

it target membership customview.swift file not set app.

in project navigator on far left, select file customview.swift. in file navigator on far right under target membership, make sure box left of app name checked.


Comments