https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

mzgreen

01/03/2020, 9:54 AM
I’m trying to create a custom iOS
UIView
and override this function: https://developer.apple.com/documentation/uikit/uiview/1622529-draw but I don’t see it in Kotlin, what may be the reason?
k

Kurt Renzo Acosta

01/03/2020, 9:55 AM
Can you send your Gradle configuration?
m

mzgreen

01/03/2020, 10:00 AM
It’s based on this: https://github.com/bugsnag/kotlin-multiplatform-example/blob/master/common/build.gradle almost identical. I can see iOS classes like UIView and its methods. I can’t see this specific
draw
method
I wanted to do something like this but in Kotlin:
Copy code
override func draw(_ rect: CGRect) {
    if let context = UIGraphicsGetCurrentContext() {
        context.addEllipse(in: rect)
        context.setFillColor(UIColor.blue.cgColor)
        context.fillPath()
    }
}
First problem is that I don’t see this
draw
method so I can’t override it. Second problem is that even if I create this
UIGraphicsGetCurrentContext
object, I can’t see its
addEllipse
and other methods. Is it a limitation of Kotlin multiplatform or something is wrong with my config?