applications and packages. build - Assembles and tests this project. compileKonanKotlinSlideParserIphone - Build the Kotlin/Native framework \ 'compileKonanKotlinSlideParserIphone' for target 'IPHONE' compileKonanKotlinSlideParserIphone_sim - Build the Kotlin/Native framework 'compileKonanKotlinSlideParserIphone_sim' for target 'IPHONE_SIM'
to compile the same code to multiple targets: • JVM • JS • Native • Powerful DSL to define dependencies Coming in Kotlin/Native 0.6 3 https://kotlinlang.org/docs/reference/multiplatform.html
List<MarkdownEntity>): SlideEntity() } public sealed class MarkdownEntity { data class Header(val contents: List<MarkdownEntity>, val level: Int): MarkdownEntity() data class Plain(val contents: String): MarkdownEntity() } public class SlideParser { public fun parsePages(string: String): List<SlideEntity>? { val result = this.pageParser().process(string) return if (result.isEmpty()) { null } else { result[0].first } } }
guard let pages = parser.parsePages(string: myText) else { return } pages.first?.contents.forEach { entity in switch entity { case let header as KSPMarkdownEntityHeader: header.level // Level of the header case let plain as KSPMarkdownEntityPlain: plain.contents // Text of the entity default: break } }
val pages = parser.parsePages(myText) pages?.first()?.contents?.forEach { when(it) { is MarkdownEntity.Header -> it.level // Level of the header is MarkdownEntity.Plain -> it.contents // Text of the entity } }
• A number of known issues • Some everyday functions not available in K/N • Some types poorly translate to Swift (e.g. generics) • iOS bitcode not supported • ENABLE_BITCODE needs to be set to NO