Add a sample for CocoaPods interop

This commit is contained in:
Ilya Matveev
2019-03-28 13:08:09 +07:00
committed by Ilya Matveev
parent 540fd65a28
commit bc0d85b160
29 changed files with 1221 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
ios-app/Pods
kotlin-library/kotlin_library.podspec
+24
View File
@@ -0,0 +1,24 @@
# Using CocoaPods
This sample demonstrates how to use a CocoaPods library from Kotlin/Native. It uses the the
[AFNetworking](https://cocoapods.org/pods/AFNetworking) library to retrieve a web-page by a
given URL.
## Configuring the project
1. [Install](https://guides.cocoapods.org/using/getting-started.html#installation) CocoaPods.
It's recommended to use CocoaPods 1.6.1 or higher.
2. Navigate to the [kotlin-library](kotlin-library) directory and run
```
./gradlew podspec
```
A [podspec](https://guides.cocoapods.org/syntax/podspec.html#specification) file for the
Kotlin/Native library will be generated.
3. Navigate to the [ios-app](ios-app) directory and install the dependencies. The generated
podspec is already added in the Podfile, so just run
```
pod install
```
4. Open [ios-app.xcworkspace](ios-app/ios-app.xcworkspace) in Xcode and run the build.
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )
KOTLIN_DIR="$DIR/kotlin-library"
IOS_DIR="$DIR/ios-app"
# Prepare Kotlin/Native project to be consumed by CocoaPods.
"$KOTLIN_DIR/gradlew" -p "$KOTLIN_DIR" podspec
# Run CocoaPods to configure the Xcode project.
pod --project-directory="$IOS_DIR" install
# Run Xcode to build the app.
xcodebuild -sdk iphonesimulator12.1 -configuration Release -workspace "$IOS_DIR/ios-app.xcworkspace" -scheme ios-app
+6
View File
@@ -0,0 +1,6 @@
# Either use_frameworks! or use_modular_headers! must be specified.
use_frameworks!
target 'ios-app' do
pod 'kotlin_library', :path => '../kotlin-library'
end
+37
View File
@@ -0,0 +1,37 @@
PODS:
- AFNetworking (3.2.1):
- AFNetworking/NSURLSession (= 3.2.1)
- AFNetworking/Reachability (= 3.2.1)
- AFNetworking/Security (= 3.2.1)
- AFNetworking/Serialization (= 3.2.1)
- AFNetworking/UIKit (= 3.2.1)
- AFNetworking/NSURLSession (3.2.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (3.2.1)
- AFNetworking/Security (3.2.1)
- AFNetworking/Serialization (3.2.1)
- AFNetworking/UIKit (3.2.1):
- AFNetworking/NSURLSession
- kotlin_library (1.0):
- AFNetworking (~> 3.2.0)
DEPENDENCIES:
- kotlin_library (from `../kotlin-library`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- AFNetworking
EXTERNAL SOURCES:
kotlin_library:
:path: "../kotlin-library"
SPEC CHECKSUMS:
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
kotlin_library: 8f1a944f60ef52dc0300d95269701846baaf153f
PODFILE CHECKSUM: 6d9fe10c2c0a5a7ce332795392e81cfa991627a6
COCOAPODS: 1.6.1
@@ -0,0 +1,417 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
2C11BACF224B4DCB00D1CC3C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C11BACE224B4DCB00D1CC3C /* AppDelegate.swift */; };
2C11BAD1224B4DCB00D1CC3C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C11BAD0224B4DCB00D1CC3C /* ViewController.swift */; };
2C11BAD4224B4DCB00D1CC3C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C11BAD2224B4DCB00D1CC3C /* Main.storyboard */; };
2C11BAD6224B4DCD00D1CC3C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C11BAD5224B4DCD00D1CC3C /* Assets.xcassets */; };
2C11BAD9224B4DCD00D1CC3C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C11BAD7224B4DCD00D1CC3C /* LaunchScreen.storyboard */; };
7AEB35573DF5ECC0B96C877C /* Pods_ios_app.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06FDB564DA981DADB5693C07 /* Pods_ios_app.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
06FDB564DA981DADB5693C07 /* Pods_ios_app.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ios_app.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2C11BACB224B4DCB00D1CC3C /* ios-app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-app.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2C11BACE224B4DCB00D1CC3C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2C11BAD0224B4DCB00D1CC3C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
2C11BAD3224B4DCB00D1CC3C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2C11BAD5224B4DCD00D1CC3C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2C11BAD8224B4DCD00D1CC3C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2C11BADA224B4DCD00D1CC3C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2C11BAE0224B65DE00D1CC3C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
44888DA7148EA4EB17DF765D /* Pods-ios-app.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-app.debug.xcconfig"; path = "Target Support Files/Pods-ios-app/Pods-ios-app.debug.xcconfig"; sourceTree = "<group>"; };
A063F818143EBBCD07EA19D4 /* Pods-ios-app.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-app.release.xcconfig"; path = "Target Support Files/Pods-ios-app/Pods-ios-app.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2C11BAC8224B4DCB00D1CC3C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7AEB35573DF5ECC0B96C877C /* Pods_ios_app.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2C11BAC2224B4DCB00D1CC3C = {
isa = PBXGroup;
children = (
2C11BACD224B4DCB00D1CC3C /* ios-app */,
2C11BACC224B4DCB00D1CC3C /* Products */,
9C1A5E5C1B80F794B7154EE0 /* Pods */,
B404E0DEAC80D8DB556F0E49 /* Frameworks */,
);
sourceTree = "<group>";
};
2C11BACC224B4DCB00D1CC3C /* Products */ = {
isa = PBXGroup;
children = (
2C11BACB224B4DCB00D1CC3C /* ios-app.app */,
);
name = Products;
sourceTree = "<group>";
};
2C11BACD224B4DCB00D1CC3C /* ios-app */ = {
isa = PBXGroup;
children = (
2C11BACE224B4DCB00D1CC3C /* AppDelegate.swift */,
2C11BAD0224B4DCB00D1CC3C /* ViewController.swift */,
2C11BAD2224B4DCB00D1CC3C /* Main.storyboard */,
2C11BAD5224B4DCD00D1CC3C /* Assets.xcassets */,
2C11BAD7224B4DCD00D1CC3C /* LaunchScreen.storyboard */,
2C11BADA224B4DCD00D1CC3C /* Info.plist */,
);
path = "ios-app";
sourceTree = "<group>";
};
9C1A5E5C1B80F794B7154EE0 /* Pods */ = {
isa = PBXGroup;
children = (
44888DA7148EA4EB17DF765D /* Pods-ios-app.debug.xcconfig */,
A063F818143EBBCD07EA19D4 /* Pods-ios-app.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
B404E0DEAC80D8DB556F0E49 /* Frameworks */ = {
isa = PBXGroup;
children = (
2C11BAE0224B65DE00D1CC3C /* WebKit.framework */,
06FDB564DA981DADB5693C07 /* Pods_ios_app.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2C11BACA224B4DCB00D1CC3C /* ios-app */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2C11BADD224B4DCD00D1CC3C /* Build configuration list for PBXNativeTarget "ios-app" */;
buildPhases = (
F305A4DC70C8B21755898707 /* [CP] Check Pods Manifest.lock */,
2C11BAC7224B4DCB00D1CC3C /* Sources */,
2C11BAC8224B4DCB00D1CC3C /* Frameworks */,
2C11BAC9224B4DCB00D1CC3C /* Resources */,
042B85E17AFECF20FF11D591 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "ios-app";
productName = "ios-app";
productReference = 2C11BACB224B4DCB00D1CC3C /* ios-app.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
2C11BAC3224B4DCB00D1CC3C /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
TargetAttributes = {
2C11BACA224B4DCB00D1CC3C = {
CreatedOnToolsVersion = 10.1;
};
};
};
buildConfigurationList = 2C11BAC6224B4DCB00D1CC3C /* Build configuration list for PBXProject "ios-app" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 2C11BAC2224B4DCB00D1CC3C;
productRefGroup = 2C11BACC224B4DCB00D1CC3C /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
2C11BACA224B4DCB00D1CC3C /* ios-app */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
2C11BAC9224B4DCB00D1CC3C /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2C11BAD9224B4DCD00D1CC3C /* LaunchScreen.storyboard in Resources */,
2C11BAD6224B4DCD00D1CC3C /* Assets.xcassets in Resources */,
2C11BAD4224B4DCB00D1CC3C /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
042B85E17AFECF20FF11D591 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ios-app/Pods-ios-app-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ios-app/Pods-ios-app-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
F305A4DC70C8B21755898707 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ios-app-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2C11BAC7224B4DCB00D1CC3C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2C11BAD1224B4DCB00D1CC3C /* ViewController.swift in Sources */,
2C11BACF224B4DCB00D1CC3C /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
2C11BAD2224B4DCB00D1CC3C /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
2C11BAD3224B4DCB00D1CC3C /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
2C11BAD7224B4DCD00D1CC3C /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
2C11BAD8224B4DCD00D1CC3C /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
2C11BADB224B4DCD00D1CC3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
2C11BADC224B4DCD00D1CC3C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
2C11BADE224B4DCD00D1CC3C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 44888DA7148EA4EB17DF765D /* Pods-ios-app.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "ios-app/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.jetbrains.konan.ios-app";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
2C11BADF224B4DCD00D1CC3C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A063F818143EBBCD07EA19D4 /* Pods-ios-app.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "ios-app/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.jetbrains.konan.ios-app";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2C11BAC6224B4DCB00D1CC3C /* Build configuration list for PBXProject "ios-app" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2C11BADB224B4DCD00D1CC3C /* Debug */,
2C11BADC224B4DCD00D1CC3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2C11BADD224B4DCD00D1CC3C /* Build configuration list for PBXNativeTarget "ios-app" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2C11BADE224B4DCD00D1CC3C /* Debug */,
2C11BADF224B4DCD00D1CC3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 2C11BAC3224B4DCB00D1CC3C /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ios-app.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>ios-app.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:ios-app.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,38 @@
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ios_app" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="fill" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="URL" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="yxG-KN-iVS">
<rect key="frame" x="20" y="20" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" textContentType="url"/>
</textField>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6po-pO-57H">
<rect key="frame" x="20" y="58" width="374" height="658"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Tmq-lB-SJh">
<rect key="frame" x="364" y="20" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="MLi-dL-yKe"/>
</constraints>
<state key="normal" title="Go!"/>
<connections>
<action selector="onGoTouch:" destination="BYZ-38-t0r" eventType="touchUpInside" id="TuI-9e-64N"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="yxG-KN-iVS" firstAttribute="top" secondItem="Tmq-lB-SJh" secondAttribute="top" id="8B4-D0-Bll"/>
<constraint firstAttribute="bottom" secondItem="6po-pO-57H" secondAttribute="bottom" constant="20" symbolic="YES" id="DQe-FX-RyI"/>
<constraint firstItem="yxG-KN-iVS" firstAttribute="leading" secondItem="6po-pO-57H" secondAttribute="leading" id="I3A-Fn-cSe"/>
<constraint firstItem="6po-pO-57H" firstAttribute="top" secondItem="yxG-KN-iVS" secondAttribute="bottom" constant="8" symbolic="YES" id="IxV-IA-Ss9"/>
<constraint firstItem="Tmq-lB-SJh" firstAttribute="leading" secondItem="yxG-KN-iVS" secondAttribute="trailing" constant="1" id="VAd-gQ-6n5"/>
<constraint firstItem="Tmq-lB-SJh" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="Yx2-Hv-HXr"/>
<constraint firstItem="yxG-KN-iVS" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="ZtB-cu-ry8"/>
<constraint firstItem="yxG-KN-iVS" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="cPt-02-UL5"/>
<constraint firstItem="Tmq-lB-SJh" firstAttribute="trailing" secondItem="6po-pO-57H" secondAttribute="trailing" id="mXC-8E-3J4"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="contentTextView" destination="6po-pO-57H" id="RyQ-WT-F4c"/>
<outlet property="goButton" destination="Tmq-lB-SJh" id="4Zy-vm-Zdm"/>
<outlet property="urlField" destination="yxG-KN-iVS" id="lON-5B-zW1"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="131.8840579710145" y="132.88043478260872"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1,21 @@
import UIKit
import kotlin_library
class ViewController: UIViewController {
@IBOutlet weak var goButton: UIButton!
@IBOutlet weak var urlField: UITextField!
@IBOutlet weak var contentTextView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func onGoTouch(_ sender: Any) {
let url = urlField.text!
KotlinLibKt.getAndShow(url: url, contentView: contentTextView)
}
}
@@ -0,0 +1,32 @@
plugins {
id("org.jetbrains.kotlin.multiplatform")
id("org.jetbrains.kotlin.native.cocoapods")
}
repositories {
jcenter()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
group = "org.jetbrains.kotlin.sample.native"
version = "1.0"
kotlin {
// Add a platform switching to have an IDE support.
val buildForDevice = System.getenv("SDK_NAME")?.startsWith("iphoneos") ?: false
if (buildForDevice) {
iosArm64("iOS")
} else {
iosX64("iOS")
}
cocoapods {
// Configure fields required by CocoaPods.
summary = "Working with AFNetworking from Kotlin/Native using CocoaPods"
homepage = "https://github.com/JetBrains/kotlin-native"
// Configure a dependency on AFNetworking. It will be added in all macOS and iOS targets.
pod("AFNetworking", "~> 3.2.0")
}
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.native.home=../../../dist
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
+84
View File
@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@@ -0,0 +1,41 @@
pluginManagement {
repositories {
jcenter()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
resolutionStrategy {
// Workaround to be able to read plugin version from the properties file.
// See: https://stackoverflow.com/questions/52800536/how-to-use-plugin-version-from-gradle-properties-in-gradle-kotlin-dsl.
val kotlinVersion = getRootProperties().getValue("kotlin_version") as String
eachPlugin {
when {
requested.id.id == "org.jetbrains.kotlin.native.cocoapods" ||
requested.id.id == "kotlin-native-cocoapods" ->
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
requested.id.id.startsWith("org.jetbrains.kotlin") ->
useVersion(kotlinVersion)
}
}
}
}
// Reuse Kotlin version and other properties from the root samples project.
fun getRootProperties() = java.util.Properties().apply {
val rootProjectGradlePropertiesFile = file("${rootProject.projectDir}/../../gradle.properties")
if (!rootProjectGradlePropertiesFile.isFile) {
throw Exception("File $rootProjectGradlePropertiesFile does not exist or is not a file")
}
rootProjectGradlePropertiesFile.inputStream().use { inputStream ->
load(inputStream)
}
}
gradle.beforeProject {
getRootProperties().forEach { key, value ->
if (!project.hasProperty(key as String))
project.extra[key] = value
}
}
@@ -0,0 +1,34 @@
import cocoapods.AFNetworking.AFHTTPResponseSerializer
import cocoapods.AFNetworking.AFHTTPSessionManager
import platform.Foundation.*
import platform.UIKit.NSDocumentTypeDocumentAttribute
import platform.UIKit.NSHTMLTextDocumentType
import platform.UIKit.UITextView
import platform.UIKit.create
import kotlin.Any
import kotlin.String
import kotlin.to
import kotlin.toString
/**
* Retrieves the content by the given URL and shows it at the given WebKitView
*/
fun getAndShow(url: String, contentView: UITextView) {
val manager = AFHTTPSessionManager()
manager.responseSerializer = AFHTTPResponseSerializer()
val onSuccess = { _: NSURLSessionDataTask?, response: Any? ->
val html = NSAttributedString.create(
data = response as NSData,
options = mapOf(NSDocumentTypeDocumentAttribute as Any? to NSHTMLTextDocumentType),
documentAttributes = null,
error = null
)!!
contentView.attributedText = html
}
val onError = { _: NSURLSessionDataTask?, error: NSError? ->
NSLog("Cannot get ${url}.")
NSLog(error.toString())
}
manager.GET(url, null, onSuccess, onError)
}
+1 -1
View File
@@ -2,7 +2,7 @@
org.gradle.parallel=true
# Pin Kotlin version:
kotlin_version=1.3.21
kotlin_version=1.3.30-eap-113
# Use custom Kotlin/Native home:
org.jetbrains.kotlin.native.home=../../dist