Thread
#multiplatform
    Simonas Brazauskas

    Simonas Brazauskas

    1 year ago
    Hello, it seems abstract classes does not force subclassed classes to implement interface methods in swift. For example
    abstract class KotlinAbstractClass : KotlinInterface {
    
    }
    
    interface KotlinInterface {
        fun testFunction()
    }
    
    //Swift code
    class SwiftClass : KotlinAbstractClass {
        
    }
    XCode compiles
    SwiftClass
    successfully, but then fails with an exception at runtime if someone tries to call
    SwiftClass::testFunction
    . Is this a bug or works as intended? We are having some issues with ios devs, as sometimes they forget to implement all interface methods, which results in crashes. Also it would cause issues, when additional methods in interfaces are added.
    rnett

    rnett

    1 year ago
    Probably worth a youtrack issue, that does not seem intended
    Nicklas Jensen

    Nicklas Jensen

    1 year ago
    The concept of “abstract classes” doesn’t exist in Swift or Objective-C, and as such, Kotlin’s abstract classes are represented in Swift/Objective-C as a regular class, with method implementations stubbed to throw exceptions.