diff --git a/ios/samples/KMSample1/KMSample1.xcodeproj/project.pbxproj b/ios/samples/KMSample1/KMSample1.xcodeproj/project.pbxproj index 86e6bc7d2db..7fd57faacce 100644 --- a/ios/samples/KMSample1/KMSample1.xcodeproj/project.pbxproj +++ b/ios/samples/KMSample1/KMSample1.xcodeproj/project.pbxproj @@ -228,7 +228,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/samples/KMSample1/KMSample1/ViewController.swift b/ios/samples/KMSample1/KMSample1/ViewController.swift index bd8c0c0e525..5ea19399608 100644 --- a/ios/samples/KMSample1/KMSample1/ViewController.swift +++ b/ios/samples/KMSample1/KMSample1/ViewController.swift @@ -19,10 +19,13 @@ class ViewController: UIViewController, TextViewDelegate { let keyboardID = FullKeyboardID(keyboardID: "ekwtamil99uni", languageID: "ta") do { - let package = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) as! KeyboardKeymanPackage - try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package) - - _ = Manager.shared.setKeyboard(withFullID: keyboardID) + let resource = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) + if let package = resource as? KeyboardKeymanPackage { + try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package) + _ = Manager.shared.setKeyboard(withFullID: keyboardID) + } else { + print("Error installing: \(keyboardID) is not a keyboard package") + } } catch { print("Error preloading: \(error)") } diff --git a/ios/samples/KMSample2/KMSample2.xcodeproj/project.pbxproj b/ios/samples/KMSample2/KMSample2.xcodeproj/project.pbxproj index 9b1620b2ad0..ba88d573ae1 100644 --- a/ios/samples/KMSample2/KMSample2.xcodeproj/project.pbxproj +++ b/ios/samples/KMSample2/KMSample2.xcodeproj/project.pbxproj @@ -369,7 +369,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; C0324B8B1F8726E500AF3785 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -382,7 +382,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/samples/KMSample2/KMSample2/ViewController.swift b/ios/samples/KMSample2/KMSample2/ViewController.swift index 9d0ba99914d..65a0f68ead2 100644 --- a/ios/samples/KMSample2/KMSample2/ViewController.swift +++ b/ios/samples/KMSample2/KMSample2/ViewController.swift @@ -20,10 +20,13 @@ class ViewController: UIViewController, TextViewDelegate { let keyboardID = FullKeyboardID(keyboardID: "ekwtamil99uni", languageID: "ta") do { - let package = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) as! KeyboardKeymanPackage - try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package) - - _ = Manager.shared.setKeyboard(withFullID: keyboardID) + let resource = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) + if let package = resource as? KeyboardKeymanPackage { + try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package) + _ = Manager.shared.setKeyboard(withFullID: keyboardID) + } else { + print("Error installing: \(keyboardID) is not a keyboard package") + } } catch { print("Error preloading: \(error)") } diff --git a/ios/tools/prepRelease.sh b/ios/tools/prepRelease.sh index 6488bbc87aa..ba1a3c91b0e 100755 --- a/ios/tools/prepRelease.sh +++ b/ios/tools/prepRelease.sh @@ -56,27 +56,55 @@ LC_ALL=UTF-8 sed -e "s/[$(printf $emoji)]//g" < "$CHANGELOG_PATH" > "$CHANGELOG_ mv -f "$CHANGELOG_PATH.1" "$CHANGELOG_PATH" assertFileExists "${CHANGELOG_PATH}" +KMEI_DST_NAME="keyman-engine-ios-${BUILD_NUMBER}.zip" +KMEI_DST="${WORK_DIR}/${UPLOAD_DIR}/${KMEI_DST_NAME}" + # -# Keyman Engine +# Copy xcframeworks from Carthage to upload directory and add to zip # -KMEI_DST_NAME="keyman-engine-ios-${BUILD_NUMBER}.zip" -KMEI_DST="${WORK_DIR}/${UPLOAD_DIR}/${KMEI_DST_NAME}" +CARTHAGE_DIR="Carthage" +KEYMAN_FRAMEWORKS="Carthage/Build/" +#KEYMAN_FRAMEWORK_BASE="Carthage" -KMEI_FRAMEWORK_BASE="build/Build/Products/Release/" -FRAMEWORK="KeymanEngine.xcframework" +cd "$UPLOAD_DIR" +mkdir -p "${CARTHAGE_DIR}" + +cd "$WORK_DIR" +echo "Copying frameworks into ${CARTHAGE_DIR} and adding to zip file..." +cp -rf "${KEYMAN_FRAMEWORKS}" "${UPLOAD_DIR}/${CARTHAGE_DIR}" +zip -qrX "${KMEI_DST}" "${KEYMAN_FRAMEWORKS}" +cd "$UPLOAD_DIR" +rm -rf "${CARTHAGE_DIR}" +cd "$WORK_DIR" + +# +# Samples - copy source to temporary folder +# KEYMAN_SAMPLES="samples" +echo "Copying Keyman Engine samples into ${UPLOAD_DIR}/${KMEI_DST_NAME}..." +cd "$WORK_DIR" +cp -rf "${KEYMAN_SAMPLES}" "${UPLOAD_DIR}/samples" + + +# +# Copy Keyman Engine xcframework to the root of each sample project +# + +KMEI_FRAMEWORK_BASE="build/Build/Products/Release/" +KEYMAN_ENGINE_FRAMEWORK="KeymanEngine.xcframework" echo "engine dest: $KMEI_DST" -echo "Zipping ${UNI_FRAMEWORK} => ${UPLOAD_DIR}/${KMEI_DST}..." -cd "${KMEI_FRAMEWORK_BASE}" -zip -qrX ${KMEI_DST} ${FRAMEWORK} -cd $WORK_DIR +echo "Copying ${UNI_FRAMEWORK} => ${UPLOAD_DIR}/samples..." +cd "$WORK_DIR" +cp -rf "${KMEI_FRAMEWORK_BASE}/${KEYMAN_ENGINE_FRAMEWORK}" "${UPLOAD_DIR}/samples/KMSample1/" +cp -rf "${KMEI_FRAMEWORK_BASE}/${KEYMAN_ENGINE_FRAMEWORK}" "${UPLOAD_DIR}/samples/KMSample2/" -echo "Copying Keyman Engine samples into ${UPLOAD_DIR}/${KMEI_DST_NAME}..." -cp -rf "${KEYMAN_SAMPLES}" "${UPLOAD_DIR}/samples" +# +# Add samples directory to zip and remove temporary folder +# cd "${UPLOAD_DIR}" zip -qr "${KMEI_DST_NAME}" "samples" rm -rf "samples"