Skip to content

Instantly share code, notes, and snippets.

@AlexGladkov
Last active December 16, 2020 08:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexGladkov/44c66210cbcf78ae232b536c8f1a8225 to your computer and use it in GitHub Desktop.
Save AlexGladkov/44c66210cbcf78ae232b536c8f1a8225 to your computer and use it in GitHub Desktop.
/// Pack For XCode
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
/// iOS Setup
private let configurationRepository = ConfigurationRepository(localDataSource: CommonConfigurationDataSource(),
remoteDataSource: MockConfigurationDataSource())
/// iOS Function
self.configurationRepository.fetchConfiguration { [weak self] (configuration, error) in
guard let self = self, let userConfiguration = configuration else { return }
if userConfiguration.currentQuestId >= 0 && userConfiguration.currentQuestPage >= 0 {
self.presenter?.present(action: .openQuestPage(Int(userConfiguration.currentQuestId),
Int(userConfiguration.currentQuestPage)))
} else {
self.presenter?.present(action: .openQuestList)
}
}
/// sh script
cd "$SRCROOT/.."
chmod +x gradlew
./gradlew :questShared:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}
Ссылка на доку - https://kotlinlang.org/docs/mobile/discover-kmm-project.html#ios-application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment