fcosta
03/22/2020, 1:45 AMFoundation
... Any idea of what i'm doing wrong?
package sample
import platform.Foundation.NSString
actual class Sample {
actual fun checkMe() = 7
}
actual object Platform {
actual val name: String = "iOS"
}
actual fun formatString(source: String, vararg args: Any): String {
return ""
// return NSString.initWithFormat
}
russhwolf
03/22/2020, 1:49 AMbuild.gradle(.kts)
. Certain configurations don’t work well in the IDE (though they will build from Gradle)fcosta
03/22/2020, 1:50 AMfcosta
03/22/2020, 1:50 AMbuild.gradle
file
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
}
repositories {
google()
jcenter()
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId 'org.jetbrains.kotlin.mpp_app_android'
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName '1.0'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
}
}
packagingOptions {
exclude 'META-INF/kotlinx-coroutines-core.kotlin_module'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test:runner:1.2.0'
}
kotlin {
targets {
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
? presets.iosArm64 : presets.iosX64
fromPreset(iOSTarget, 'ios') {
binaries {
framework()
}
}
fromPreset(presets.android, 'android')
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.3"
implementation "com.soywiz.korlibs.klock:klock:1.8.4"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3"
}
}
androidTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
dependencies {
implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core-native') {
version {
strictly '1.3.3-native-mt'
}
}
}
}
iosTest {
}
}
}
// This task attaches native framework built from ios module to Xcode project
// (see iosApp directory). Don't run this task directly,
// Xcode runs this task itself during its build process.
// Before opening the project from iosApp directory in Xcode,
// make sure all Gradle infrastructure exists (gradle.wrapper, gradlew).
task copyFramework {
def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
def target = project.findProperty('kotlin.target') ?: 'ios'
dependsOn kotlin.targets."$target".binaries.getFramework(buildType).linkTask
doLast {
def srcFile = kotlin.targets."$target".binaries.getFramework(buildType).outputFile
def targetDir = getProperty('configuration.build.dir')
copy {
from srcFile.parent
into targetDir
include 'app.framework/**'
include 'app.framework.dSYM'
}
}
}
russhwolf
03/22/2020, 1:54 AMtargets
block (under kotlin
), try
android()
def isDevice = System.getenv("SDK_NAME")?.startsWith("iphoneos") == true
def iosTarget = if (isDevice) {
presets.getByName("iosArm64")
} else {
presets.getByName("iosX64")
}
targetFromPreset(iosTarget, "ios") { ... }
fcosta
03/22/2020, 2:04 AMfcosta
03/22/2020, 2:16 AMfcosta
03/22/2020, 2:16 AMfcosta
03/22/2020, 2:20 AMcoletz
03/22/2020, 3:23 PMfcosta
03/22/2020, 8:41 PMcoletz
03/22/2020, 10:13 PMrusshwolf
03/22/2020, 10:15 PMphldavies
04/02/2020, 12:36 PM1.3.61-release-IJ2019.3-1
which is apparently compatible with 2019.3 — 2020.1 (rc)
but on installing from disk and restarting, IntelliJ automatically updates to 1.3.71 again. Am I missing a trick?coletz
04/02/2020, 8:20 PM