Added BankingUiNativeIntegration to make Swift code setup more easier

This commit is contained in:
dankito 2020-07-15 22:34:25 +02:00
parent 23469c74ce
commit a327291757
3 changed files with 93 additions and 0 deletions

View File

@ -24,6 +24,8 @@ include ':BankingAndroidApp'
include ':BankingJavaFxControls'
include ':BankingJavaFxApp'
include ':BankingUiNativeIntegration'
project(':BankingUiCommon').projectDir = "$rootDir/ui/BankingUiCommon/" as File
@ -35,6 +37,8 @@ project(':BankingAndroidApp').projectDir = "$rootDir/ui/BankingAndroidApp/" as F
project(':BankingJavaFxControls').projectDir = "$rootDir/ui/BankingJavaFxControls/" as File
project(':BankingJavaFxApp').projectDir = "$rootDir/ui/BankingJavaFxApp/" as File
project(':BankingUiNativeIntegration').projectDir = "$rootDir/ui/BankingUiNativeIntegration/" as File
project(':BankingPersistenceJson').projectDir = "$rootDir/persistence/json/BankingPersistenceJson/" as File
project(':LuceneBankingPersistence').projectDir = "$rootDir/persistence/LuceneBankingPersistence/" as File

View File

@ -0,0 +1,69 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "maven-publish"
}
ext.artifactName = "banking-ui-native-integration"
kotlin {
targets {
// Select iOS target for real device or emulator.
final def iOSIsRealDevice = System.getenv('SDK_NAME')?.startsWith("iphoneos")
final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64
// iOS target.
fromPreset(iOSTarget, 'ios') {
binaries {
framework {
baseName = "BankingUiSwift"
}
}
}
}
sourceSets {
commonMain {
dependencies {
implementation project(":BankingUiCommon")
implementation project(":fints4kBankingClient")
}
}
iosMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
}
}
}
}
// Task to generate iOS framework for xcode projects.
task packForXCode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
final def framework = kotlin.targets.ios.binaries.getFramework("", mode)
inputs.property "mode", mode
dependsOn framework.linkTask
from { framework.outputFile.parentFile }
into frameworkDir
doLast {
new File(frameworkDir, 'gradlew').with {
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
setExecutable(true)
}
}
}
// Run packForXCode when building.
tasks.build.dependsOn packForXCode

View File

@ -0,0 +1,20 @@
package net.dankito.banking
import net.dankito.banking.fints.webclient.IWebClient
import net.dankito.banking.persistence.NoOpBankingPersistence
import net.dankito.banking.search.NoOpRemitteeSearcher
import net.dankito.banking.ui.IRouter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.banking.util.IAsyncRunner
import net.dankito.banking.util.NoOpBankIconFinder
import net.dankito.banking.util.NoOpSerializer
import net.dankito.banking.util.extraction.NoOpInvoiceDataExtractor
import net.dankito.banking.util.extraction.NoOpTextExtractorRegistry
import net.dankito.utils.multiplatform.File
class BankingPresenterSwift(dataFolder: File, router: IRouter, webClient: IWebClient, asyncRunner: IAsyncRunner)
: BankingPresenter(fints4kBankingClientCreator(NoOpSerializer(), webClient), BankFinder(), dataFolder, NoOpBankingPersistence(), router,
NoOpRemitteeSearcher(), NoOpBankIconFinder(), NoOpTextExtractorRegistry(), NoOpInvoiceDataExtractor(), NoOpSerializer(), asyncRunner) {
}