Last active
December 16, 2020 08:50
-
-
Save AlexGladkov/44c66210cbcf78ae232b536c8f1a8225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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