Avatar
We’re happy to announce the release of Kotlin/Native v0.4, KotlinConf 2017 edition! This release adds support for accessing Objective-C APIs on iOS and macOS, WebAssembly target platform, as well a…
1:23 AM
fun readResource(resourceName: String): ByteArray { val filePath = NSBundle.mainBundle.pathForResource(resourceName, ofType = null) val fileData = NSData.dataWithContentsOfFile(filePath!!) ?: throw Error("failed reading resource $resourceName") return fileData.bytes!!.readBytes(fileData.length.toInt()) } (edited)
1:24 AM
?:throw 書けるのいいなぁ。 Nothing が bottom type なのが利いてる。 (edited)