diff --git a/BindingSample/BindingSample.sln b/BindingSample/BindingSample.sln new file mode 100644 index 00000000..00f70c11 --- /dev/null +++ b/BindingSample/BindingSample.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMBindingLibrary", "XMBindingLibrary\XMBindingLibrary.csproj", "{A62E63ED-97A6-475B-8376-912F2C027FAB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMBindingLibrarySample", "XMBindingLibrarySample\XMBindingLibrarySample.csproj", "{0CDEA6B0-A495-48B0-ADC0-A6459F730571}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Release|iPhone = Release|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|Any CPU.Build.0 = Release|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Debug|iPhone.Build.0 = Debug|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|iPhone.ActiveCfg = Release|Any CPU + {A62E63ED-97A6-475B-8376-912F2C027FAB}.Release|iPhone.Build.0 = Release|Any CPU + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhone.ActiveCfg = Debug|iPhone + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhone.Build.0 = Debug|iPhone + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhone.ActiveCfg = Release|iPhone + {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhone.Build.0 = Release|iPhone + EndGlobalSection +EndGlobal diff --git a/BindingSample/Makefile b/BindingSample/Makefile index 40db46ce..e2336cc0 100755 --- a/BindingSample/Makefile +++ b/BindingSample/Makefile @@ -1,5 +1,7 @@ all: - (cd src/binding/; make) + (cd NativeProject/; make) + msbuild clean: - (cd src/binding; make clean) + (cd NativeProject/; make clean) + msbuild /t:clean diff --git a/BindingSample/NativeProject/.gitignore b/BindingSample/NativeProject/.gitignore new file mode 100755 index 00000000..59f48aae --- /dev/null +++ b/BindingSample/NativeProject/.gitignore @@ -0,0 +1,3 @@ +xcuserdata/ +build/ +*.a \ No newline at end of file diff --git a/BindingSample/NativeProject/Makefile b/BindingSample/NativeProject/Makefile new file mode 100755 index 00000000..2b58b43d --- /dev/null +++ b/BindingSample/NativeProject/Makefile @@ -0,0 +1,30 @@ +XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild +PROJECT=XMBindingLibrary.xcodeproj +TARGET=XMBindingLibrary + + +all: libXMBindingLibraryUniversal.a + + +libXMBindingLibrary-i386.a: + $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -arch i386 -configuration Release clean build + -mv build/Release-iphonesimulator/lib$(TARGET).a $@ + +libXMBindingLibrary-armv7.a: + $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build + -mv build/Release-iphoneos/lib$(TARGET).a $@ + +libXMBindingLibrary-x86_64.a: + $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -arch x86_64 -configuration Release clean build + -mv build/Release-iphonesimulator/lib$(TARGET).a $@ + +libXMBindingLibrary-arm64.a: + $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch arm64 -configuration Release clean build + -mv build/Release-iphoneos/lib$(TARGET).a $@ + +libXMBindingLibraryUniversal.a: libXMBindingLibrary-armv7.a libXMBindingLibrary-i386.a libXMBindingLibrary-arm64.a libXMBindingLibrary-x86_64.a + lipo -create -output $@ $^ + + +clean: + -rm -rf *.a build/ diff --git a/BindingSample/NativeProject/README.md b/BindingSample/NativeProject/README.md new file mode 100755 index 00000000..f858c9ec --- /dev/null +++ b/BindingSample/NativeProject/README.md @@ -0,0 +1,38 @@ +XMBindingLibrary Native Project +====================================== + +This project contains the following items: + +- XMBindingLibrary.xcodeproj + This is the Xcode project file. +- Makefile + The Makefile that will create a fat archive. + +## Building the Native Library + +To compile the Xcode Project and binding classes execute the `make` command from the root directory. + +The make command will: + +- Compile the Xcode Project for ARMv7, ARM64 (Devices), i386 and x86_64 (Simulators) using `xcodebuild` +- Create a multi-architecture binary using `lipo` + +## Creating a Universal Binary + +A "fat" or multi-architecture library is a compiled binary that is usable on multiple targets, for example: ARMv7, ARM64 (Devices), i386 and x86_64 (Simulators). In this sample we illustrate how to create a universal binary in two ways: + +### Using lipo + +Once we have built our library against the desired architectures we can create the universal binary via `lipo`. This will create a "universal" file from the architecture specific inputs we have provided. For instance: + + lipo -create libNative-armv7.a libNative-arm64.a libNative-i386.a libNative-x86_64.a -output libNative.a + + +Similarly, in our Makefile script we have `lipo -create -output $@ $^` which will take the libraries compiled for ARM64, ARMv7, i386 and x86_64 using `xcodebuild` and output them to the current directory with the name of our build target. + +### Using Xcode + +In our Xcode project we have created a separate `Build Target` that will execute a post build `Run Script` to output a +"universal" file. + +![screenshot](https://imgur.com/meVHNH4.png "Build Target - Run Script") diff --git a/BindingSample/NativeProject/RunScript.png b/BindingSample/NativeProject/RunScript.png new file mode 100644 index 00000000..afd4c0a7 Binary files /dev/null and b/BindingSample/NativeProject/RunScript.png differ diff --git a/BindingSample/src/binding/XMBindingLibrarySample/RunScript.sh b/BindingSample/NativeProject/RunScript.sh similarity index 65% rename from BindingSample/src/binding/XMBindingLibrarySample/RunScript.sh rename to BindingSample/NativeProject/RunScript.sh index c92b23a1..a392251f 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/RunScript.sh +++ b/BindingSample/NativeProject/RunScript.sh @@ -1,114 +1,123 @@ -# Version 2.0 (updated for Xcode 4, with some fixes) -# Changes: -# - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs) -# - Faster / better: only runs lipo once, instead of once per recursion -# - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to "true" -# - Fixed some typos -# -# Purpose: -# Create a static library for iPhone from within XCode -# Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!) -# ...no, I don't understand why they did this! -# -# Author: Adam Martin - http://twitter.com/redglassesapps -# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER) -# -# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 - -#################[ Tests: helps workaround any future bugs in Xcode ]######## -# -DEBUG_THIS_SCRIPT="false" - -if [ $DEBUG_THIS_SCRIPT = "true" ] -then -echo "########### TESTS #############" -echo "Use the following variables when debugging this script; note that they may change on recursions" -echo "BUILD_DIR = $BUILD_DIR" -echo "BUILD_ROOT = $BUILD_ROOT" -echo "CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR" -echo "BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR" -echo "CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR" -echo "TARGET_BUILD_DIR = $TARGET_BUILD_DIR" -fi - -#####################[ part 1 ]################## -# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it) -# (incidental: searching for substrings in sh is a nightmare! Sob) - -SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\{3\}$') - -# Next, work out if we're in SIM or DEVICE - -if [ ${PLATFORM_NAME} = "iphonesimulator" ] -then -OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION} -else -OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION} -fi - -echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})" -echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}" -# -#####################[ end of part 1 ]################## - -#####################[ part 2 ]################## -# -# IF this is the original invocation, invoke WHATEVER other builds are required -# -# Xcode is already building ONE target... -# -# ...but this is a LIBRARY, so Apple is wrong to set it to build just one. -# ...we need to build ALL targets -# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!) -# -# -# So: build ONLY the missing platforms/configurations. - -if [ "true" == ${ALREADYINVOKED:-false} ] -then -echo "RECURSION: I am NOT the root invocation, so I'm NOT going to recurse" -else -# CRITICAL: -# Prevent infinite recursion (Xcode sucks) -export ALREADYINVOKED="true" - -echo "RECURSION: I am the root ... recursing all missing build targets NOW..." -echo "RECURSION: ...about to invoke: xcodebuild -configuration \"${CONFIGURATION}\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO" -xcodebuild -configuration "${CONFIGURATION}" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" - -ACTION="build" - -#Merge all platform binaries as a fat binary for each configurations. - -# Calculate where the (multiple) built files are coming from: -CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos -CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator - -echo "Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}" -echo "Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}" - -CREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal -echo "...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}" - -# ... remove the products of previous runs of this script -# NB: this directory is ONLY created by this script - it should be safe to delete! - -rm -rf "${CREATING_UNIVERSAL_DIR}" -mkdir "${CREATING_UNIVERSAL_DIR}" - -# -echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" -lipo -create -output "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}" - -######### -# -# Added: StackOverflow suggestion to also copy "include" files -# (untested, but should work OK) -# -if [ -d "${CURRENTCONFIG_DEVICE_DIR}/usr/local/include" ] -then -mkdir -p "${CREATING_UNIVERSAL_DIR}/usr/local/include" -# * needs to be outside the double quotes? -cp "${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/"* "${CREATING_UNIVERSAL_DIR}/usr/local/include" -fi +########################################## +# +# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 +# +# Version 2.82 +# +# Latest Change: +# - MORE tweaks to get the iOS 10+ and 9- working +# - Support iOS 10+ +# - Corrected typo for iOS 1-10+ (thanks @stuikomma) +# +# Purpose: +# Automatically create a Universal static library for iPhone + iPad + iPhone Simulator from within XCode +# +# Author: Adam Martin - http://twitter.com/redglassesapps +# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER) +# + +set -e +set -o pipefail + +#################[ Tests: helps workaround any future bugs in Xcode ]######## +# +DEBUG_THIS_SCRIPT="false" + +if [ $DEBUG_THIS_SCRIPT = "true" ] +then +echo "########### TESTS #############" +echo "Use the following variables when debugging this script; note that they may change on recursions" +echo "BUILD_DIR = $BUILD_DIR" +echo "BUILD_ROOT = $BUILD_ROOT" +echo "CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR" +echo "BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR" +echo "CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR" +echo "TARGET_BUILD_DIR = $TARGET_BUILD_DIR" +fi + +#####################[ part 1 ]################## +# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it) +# (incidental: searching for substrings in sh is a nightmare! Sob) + +SDK_VERSION=$(echo ${SDK_NAME} | grep -o '\d\{1,2\}\.\d\{1,2\}$') + +# Next, work out if we're in SIM or DEVICE + +if [ ${PLATFORM_NAME} = "iphonesimulator" ] +then +OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION} +else +OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION} +fi + +echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})" +echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}" +# +#####################[ end of part 1 ]################## + +#####################[ part 2 ]################## +# +# IF this is the original invocation, invoke WHATEVER other builds are required +# +# Xcode is already building ONE target... +# +# ...but this is a LIBRARY, so Apple is wrong to set it to build just one. +# ...we need to build ALL targets +# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!) +# +# +# So: build ONLY the missing platforms/configurations. + +if [ "true" == ${ALREADYINVOKED:-false} ] +then +echo "RECURSION: I am NOT the root invocation, so I'm NOT going to recurse" +else +# CRITICAL: +# Prevent infinite recursion (Xcode sucks) +export ALREADYINVOKED="true" + +echo "RECURSION: I am the root ... recursing all missing build targets NOW..." +echo "RECURSION: ...about to invoke: xcodebuild -configuration \"${CONFIGURATION}\" -project \"${PROJECT_NAME}.xcodeproj\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO" BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" SYMROOT=\"${SYMROOT}\" + +xcodebuild -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}.xcodeproj" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" + +ACTION="build" + +#Merge all platform binaries as a fat binary for each configurations. + +# Calculate where the (multiple) built files are coming from: +CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos +CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator + +echo "Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}" +echo "Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}" + +CREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal +echo "...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}" + +# ... remove the products of previous runs of this script +# NB: this directory is ONLY created by this script - it should be safe to delete! + +rm -rf "${CREATING_UNIVERSAL_DIR}" +mkdir "${CREATING_UNIVERSAL_DIR}" + +# +echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" +xcrun -sdk iphoneos lipo -create -output "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}" + +######### +# +# Added: StackOverflow suggestion to also copy "include" files +# (untested, but should work OK) +# +echo "Fetching headers from ${PUBLIC_HEADERS_FOLDER_PATH}" +echo " (if you embed your library project in another project, you will need to add" +echo " a "User Search Headers" build setting of: (NB INCLUDE THE DOUBLE QUOTES BELOW!)" +echo ' "$(TARGET_BUILD_DIR)/usr/local/include/"' +if [ -d "${CURRENTCONFIG_DEVICE_DIR}${PUBLIC_HEADERS_FOLDER_PATH}" ] +then +mkdir -p "${CREATING_UNIVERSAL_DIR}${PUBLIC_HEADERS_FOLDER_PATH}" +# * needs to be outside the double quotes? +cp -r "${CURRENTCONFIG_DEVICE_DIR}${PUBLIC_HEADERS_FOLDER_PATH}"* "${CREATING_UNIVERSAL_DIR}${PUBLIC_HEADERS_FOLDER_PATH}" +fi fi \ No newline at end of file diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.pbxproj b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.pbxproj similarity index 59% rename from BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.pbxproj rename to BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.pbxproj index c0c9e834..61197aa8 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.pbxproj +++ b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.pbxproj @@ -8,13 +8,11 @@ /* Begin PBXBuildFile section */ 1D09B81014C87E5F00033666 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DE6535114C7C824007670AC /* Foundation.framework */; }; - 1D09B81614C87E5F00033666 /* XMBindingLibrarySampleUniversal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09B81514C87E5F00033666 /* XMBindingLibrarySampleUniversal.m */; }; 1D09B81B14C87E7700033666 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DE6535F14C7C8BA007670AC /* UIKit.framework */; }; 1D09B81C14C87E8200033666 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DE6536E14C7ECE5007670AC /* QuartzCore.framework */; }; 1D09B82514C87F8500033666 /* XMUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE6536214C7C8EF007670AC /* XMUtilities.m */; }; 1D09B82714C87F8500033666 /* XMCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE6536914C7D087007670AC /* XMCustomView.m */; }; 1DE6535214C7C824007670AC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DE6535114C7C824007670AC /* Foundation.framework */; }; - 1DE6535814C7C824007670AC /* XMBindingLibrarySample.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE6535714C7C824007670AC /* XMBindingLibrarySample.m */; }; 1DE6536014C7C8BA007670AC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DE6535F14C7C8BA007670AC /* UIKit.framework */; }; 1DE6536314C7C8EF007670AC /* XMUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DE6536114C7C8EF007670AC /* XMUtilities.h */; }; 1DE6536414C7C8EF007670AC /* XMUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE6536214C7C8EF007670AC /* XMUtilities.m */; }; @@ -28,16 +26,11 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 1D09B80F14C87E5F00033666 /* libXMBindingLibrarySampleUniversal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libXMBindingLibrarySampleUniversal.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 1D09B81314C87E5F00033666 /* XMBindingLibrarySampleUniversal-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XMBindingLibrarySampleUniversal-Prefix.pch"; sourceTree = ""; }; - 1D09B81414C87E5F00033666 /* XMBindingLibrarySampleUniversal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XMBindingLibrarySampleUniversal.h; sourceTree = ""; }; - 1D09B81514C87E5F00033666 /* XMBindingLibrarySampleUniversal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XMBindingLibrarySampleUniversal.m; sourceTree = ""; }; + 1D09B80F14C87E5F00033666 /* libXMBindingLibraryUniversal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libXMBindingLibraryUniversal.a; sourceTree = BUILT_PRODUCTS_DIR; }; 1D22C39B14CBA7A80000024A /* RunScript.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = RunScript.sh; sourceTree = ""; }; - 1D7D8A0214D9BFB90043495B /* XMBindingLibrarySample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "XMBindingLibrarySample-Prefix.pch"; path = "../../../../../../../projects/monotouch/work/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch"; sourceTree = ""; }; - 1DE6534E14C7C824007670AC /* libXMBindingLibrarySample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libXMBindingLibrarySample.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 1D7D8A0214D9BFB90043495B /* XMBindingLibrary-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "XMBindingLibrary-Prefix.pch"; path = "XMBindingLibrary/XMBindingLibrary-Prefix.pch"; sourceTree = ""; }; + 1DE6534E14C7C824007670AC /* libXMBindingLibrary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libXMBindingLibrary.a; sourceTree = BUILT_PRODUCTS_DIR; }; 1DE6535114C7C824007670AC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1DE6535614C7C824007670AC /* XMBindingLibrarySample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XMBindingLibrarySample.h; sourceTree = ""; }; - 1DE6535714C7C824007670AC /* XMBindingLibrarySample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XMBindingLibrarySample.m; sourceTree = ""; }; 1DE6535F14C7C8BA007670AC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 1DE6536114C7C8EF007670AC /* XMUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMUtilities.h; sourceTree = ""; }; 1DE6536214C7C8EF007670AC /* XMUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XMUtilities.m; sourceTree = ""; }; @@ -71,24 +64,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1D09B81114C87E5F00033666 /* XMBindingLibrarySampleUniversal */ = { - isa = PBXGroup; - children = ( - 1D09B81414C87E5F00033666 /* XMBindingLibrarySampleUniversal.h */, - 1D09B81514C87E5F00033666 /* XMBindingLibrarySampleUniversal.m */, - 1D09B81214C87E5F00033666 /* Supporting Files */, - ); - path = XMBindingLibrarySampleUniversal; - sourceTree = ""; - }; - 1D09B81214C87E5F00033666 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 1D09B81314C87E5F00033666 /* XMBindingLibrarySampleUniversal-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; 1D22C39914CBA7800000024A /* Post-Build Run Script */ = { isa = PBXGroup; children = ( @@ -102,8 +77,7 @@ children = ( 1D22C39914CBA7800000024A /* Post-Build Run Script */, 1DE6535E14C7C87F007670AC /* Classes */, - 1DE6535314C7C824007670AC /* XMBindingLibrarySample */, - 1D09B81114C87E5F00033666 /* XMBindingLibrarySampleUniversal */, + 1DE6535414C7C824007670AC /* Supporting Files */, 1DE6535014C7C824007670AC /* Frameworks */, 1DE6534F14C7C824007670AC /* Products */, ); @@ -112,8 +86,8 @@ 1DE6534F14C7C824007670AC /* Products */ = { isa = PBXGroup; children = ( - 1DE6534E14C7C824007670AC /* libXMBindingLibrarySample.a */, - 1D09B80F14C87E5F00033666 /* libXMBindingLibrarySampleUniversal.a */, + 1DE6534E14C7C824007670AC /* libXMBindingLibrary.a */, + 1D09B80F14C87E5F00033666 /* libXMBindingLibraryUniversal.a */, ); name = Products; sourceTree = ""; @@ -128,22 +102,13 @@ name = Frameworks; sourceTree = ""; }; - 1DE6535314C7C824007670AC /* XMBindingLibrarySample */ = { - isa = PBXGroup; - children = ( - 1DE6535614C7C824007670AC /* XMBindingLibrarySample.h */, - 1DE6535714C7C824007670AC /* XMBindingLibrarySample.m */, - 1DE6535414C7C824007670AC /* Supporting Files */, - ); - path = XMBindingLibrarySample; - sourceTree = ""; - }; 1DE6535414C7C824007670AC /* Supporting Files */ = { isa = PBXGroup; children = ( - 1D7D8A0214D9BFB90043495B /* XMBindingLibrarySample-Prefix.pch */, + 1D7D8A0214D9BFB90043495B /* XMBindingLibrary-Prefix.pch */, ); name = "Supporting Files"; + path = XMBindingLibrary; sourceTree = ""; }; 1DE6535E14C7C87F007670AC /* Classes */ = { @@ -184,9 +149,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 1D09B80E14C87E5F00033666 /* XMBindingLibrarySampleUniversal */ = { + 1D09B80E14C87E5F00033666 /* XMBindingLibraryUniversal */ = { isa = PBXNativeTarget; - buildConfigurationList = 1D09B81914C87E5F00033666 /* Build configuration list for PBXNativeTarget "XMBindingLibrarySampleUniversal" */; + buildConfigurationList = 1D09B81914C87E5F00033666 /* Build configuration list for PBXNativeTarget "XMBindingLibraryUniversal" */; buildPhases = ( 1D09B80B14C87E5F00033666 /* Sources */, 1D09B80C14C87E5F00033666 /* Frameworks */, @@ -197,14 +162,14 @@ ); dependencies = ( ); - name = XMBindingLibrarySampleUniversal; - productName = XMBindingLibrarySampleUniversal; - productReference = 1D09B80F14C87E5F00033666 /* libXMBindingLibrarySampleUniversal.a */; + name = XMBindingLibraryUniversal; + productName = XMBindingLibraryUniversal; + productReference = 1D09B80F14C87E5F00033666 /* libXMBindingLibraryUniversal.a */; productType = "com.apple.product-type.library.static"; }; - 1DE6534D14C7C824007670AC /* XMBindingLibrarySample */ = { + 1DE6534D14C7C824007670AC /* XMBindingLibrary */ = { isa = PBXNativeTarget; - buildConfigurationList = 1DE6535B14C7C824007670AC /* Build configuration list for PBXNativeTarget "XMBindingLibrarySample" */; + buildConfigurationList = 1DE6535B14C7C824007670AC /* Build configuration list for PBXNativeTarget "XMBindingLibrary" */; buildPhases = ( 1DE6534A14C7C824007670AC /* Sources */, 1DE6534B14C7C824007670AC /* Frameworks */, @@ -214,9 +179,9 @@ ); dependencies = ( ); - name = XMBindingLibrarySample; - productName = XMBindingLibrarySample; - productReference = 1DE6534E14C7C824007670AC /* libXMBindingLibrarySample.a */; + name = XMBindingLibrary; + productName = XMBindingLibrary; + productReference = 1DE6534E14C7C824007670AC /* libXMBindingLibrary.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ @@ -225,9 +190,9 @@ 1DE6534514C7C824007670AC /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 1010; }; - buildConfigurationList = 1DE6534814C7C824007670AC /* Build configuration list for PBXProject "XMBindingLibrarySample" */; + buildConfigurationList = 1DE6534814C7C824007670AC /* Build configuration list for PBXProject "XMBindingLibrary" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -239,8 +204,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 1DE6534D14C7C824007670AC /* XMBindingLibrarySample */, - 1D09B80E14C87E5F00033666 /* XMBindingLibrarySampleUniversal */, + 1DE6534D14C7C824007670AC /* XMBindingLibrary */, + 1D09B80E14C87E5F00033666 /* XMBindingLibraryUniversal */, ); }; /* End PBXProject section */ @@ -257,7 +222,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Version 2.0 (updated for Xcode 4, with some fixes)\n# Changes:\n# - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs)\n# - Faster / better: only runs lipo once, instead of once per recursion\n# - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to \"true\"\n# - Fixed some typos\n# \n# Purpose:\n# Create a static library for iPhone from within XCode\n# Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)\n# ...no, I don't understand why they did this!\n#\n# Author: Adam Martin - http://twitter.com/redglassesapps\n# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)\n#\n# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4\n\n#################[ Tests: helps workaround any future bugs in Xcode ]########\n#\nDEBUG_THIS_SCRIPT=\"false\"\n\nif [ $DEBUG_THIS_SCRIPT = \"true\" ]\nthen\necho \"########### TESTS #############\"\necho \"Use the following variables when debugging this script; note that they may change on recursions\"\necho \"BUILD_DIR = $BUILD_DIR\"\necho \"BUILD_ROOT = $BUILD_ROOT\"\necho \"CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR\"\necho \"BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR\"\necho \"CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR\"\necho \"TARGET_BUILD_DIR = $TARGET_BUILD_DIR\"\nfi\n\n#####################[ part 1 ]##################\n# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)\n# (incidental: searching for substrings in sh is a nightmare! Sob)\n\nSDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\\{3\\}$')\n\n# Next, work out if we're in SIM or DEVICE\n\nif [ ${PLATFORM_NAME} = \"iphonesimulator\" ]\nthen\nOTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}\nelse\nOTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}\nfi\n\necho \"XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})\"\necho \"...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}\"\n#\n#####################[ end of part 1 ]##################\n\n#####################[ part 2 ]##################\n#\n# IF this is the original invocation, invoke WHATEVER other builds are required\n#\n# Xcode is already building ONE target...\n#\n# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.\n# ...we need to build ALL targets\n# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)\n#\n#\n# So: build ONLY the missing platforms/configurations.\n\nif [ \"true\" == ${ALREADYINVOKED:-false} ]\nthen\necho \"RECURSION: I am NOT the root invocation, so I'm NOT going to recurse\"\nelse\n# CRITICAL:\n# Prevent infinite recursion (Xcode sucks)\nexport ALREADYINVOKED=\"true\"\n\necho \"RECURSION: I am the root ... recursing all missing build targets NOW...\"\necho \"RECURSION: ...about to invoke: xcodebuild -configuration \\\"${CONFIGURATION}\\\" -target \\\"${TARGET_NAME}\\\" -sdk \\\"${OTHER_SDK_TO_BUILD}\\\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO\"\nxcodebuild -configuration \"${CONFIGURATION}\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\"\n\nACTION=\"build\"\n\n#Merge all platform binaries as a fat binary for each configurations.\n\n# Calculate where the (multiple) built files are coming from:\nCURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos\nCURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator\n\necho \"Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}\"\necho \"Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}\"\n\nCREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal\necho \"...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}\"\n\n# ... remove the products of previous runs of this script\n# NB: this directory is ONLY created by this script - it should be safe to delete!\n\nrm -rf \"${CREATING_UNIVERSAL_DIR}\"\nmkdir \"${CREATING_UNIVERSAL_DIR}\"\n\n#\necho \"lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\"\nlipo -create -output \"${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}\" \"${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}\"\n\n#########\n#\n# Added: StackOverflow suggestion to also copy \"include\" files\n# (untested, but should work OK)\n#\nif [ -d \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include\" ]\nthen\nmkdir -p \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\n# * needs to be outside the double quotes?\ncp \"${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/\"* \"${CREATING_UNIVERSAL_DIR}/usr/local/include\"\nfi\nfi"; + shellScript = "$PROJECT_DIR/RunScript.sh\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -268,7 +233,6 @@ files = ( 1D09B82514C87F8500033666 /* XMUtilities.m in Sources */, 1D09B82714C87F8500033666 /* XMCustomView.m in Sources */, - 1D09B81614C87E5F00033666 /* XMBindingLibrarySampleUniversal.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -276,7 +240,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1DE6535814C7C824007670AC /* XMBindingLibrarySample.m in Sources */, 1DE6536414C7C8EF007670AC /* XMUtilities.m in Sources */, 1DE6536B14C7D087007670AC /* XMCustomView.m in Sources */, ); @@ -288,9 +251,9 @@ 1D09B81714C87E5F00033666 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DSTROOT = /tmp/XMBindingLibrarySampleUniversal.dst; + DSTROOT = /tmp/XMBindingLibraryUniversal.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal-Prefix.pch"; + GCC_PREFIX_HEADER = "XMBindingLibrary/XMBindingLibrary-Prefix.pch"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -300,9 +263,9 @@ 1D09B81814C87E5F00033666 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DSTROOT = /tmp/XMBindingLibrarySampleUniversal.dst; + DSTROOT = /tmp/XMBindingLibraryUniversal.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal-Prefix.pch"; + GCC_PREFIX_HEADER = "XMBindingLibrary/XMBindingLibrary-Prefix.pch"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -314,17 +277,29 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = 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_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_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -351,16 +326,27 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = 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_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_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -379,9 +365,9 @@ 1DE6535C14C7C824007670AC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - DSTROOT = /tmp/XMBindingLibrarySample.dst; + DSTROOT = /tmp/XMBindingLibrary.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch"; + GCC_PREFIX_HEADER = "XMBindingLibrary/XMBindingLibrary-Prefix.pch"; GCC_THUMB_SUPPORT = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -392,9 +378,9 @@ 1DE6535D14C7C824007670AC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - DSTROOT = /tmp/XMBindingLibrarySample.dst; + DSTROOT = /tmp/XMBindingLibrary.dst; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch"; + GCC_PREFIX_HEADER = "XMBindingLibrary/XMBindingLibrary-Prefix.pch"; GCC_THUMB_SUPPORT = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -405,7 +391,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 1D09B81914C87E5F00033666 /* Build configuration list for PBXNativeTarget "XMBindingLibrarySampleUniversal" */ = { + 1D09B81914C87E5F00033666 /* Build configuration list for PBXNativeTarget "XMBindingLibraryUniversal" */ = { isa = XCConfigurationList; buildConfigurations = ( 1D09B81714C87E5F00033666 /* Debug */, @@ -414,7 +400,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 1DE6534814C7C824007670AC /* Build configuration list for PBXProject "XMBindingLibrarySample" */ = { + 1DE6534814C7C824007670AC /* Build configuration list for PBXProject "XMBindingLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DE6535914C7C824007670AC /* Debug */, @@ -423,7 +409,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 1DE6535B14C7C824007670AC /* Build configuration list for PBXNativeTarget "XMBindingLibrarySample" */ = { + 1DE6535B14C7C824007670AC /* Build configuration list for PBXNativeTarget "XMBindingLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DE6535C14C7C824007670AC /* Debug */, diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 65% rename from BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 6e1fefb8..919434a6 100644 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/WorkspaceSettings.xcsettings b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 59% rename from BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/WorkspaceSettings.xcsettings rename to BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist index 659c8766..18d98100 100644 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/WorkspaceSettings.xcsettings +++ b/BindingSample/NativeProject/XMBindingLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -2,9 +2,7 @@ - HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges - - SnapshotAutomaticallyBeforeSignificantChanges + IDEDidComputeMac32BitWarning diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch b/BindingSample/NativeProject/XMBindingLibrary/XMBindingLibrary-Prefix.pch similarity index 51% rename from BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch rename to BindingSample/NativeProject/XMBindingLibrary/XMBindingLibrary-Prefix.pch index 63b164ed..cadce445 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample-Prefix.pch +++ b/BindingSample/NativeProject/XMBindingLibrary/XMBindingLibrary-Prefix.pch @@ -1,9 +1,9 @@ -// -// Prefix header for all source files of the 'XMBindingLibrarySample' target in the 'XMBindingLibrarySample' project -// - -#ifdef __OBJC__ - #import - #import - #import -#endif +// +// Prefix header for all source files of the 'XMBindingLibrary' target in the 'XMBindingLibrary' project +// + +#ifdef __OBJC__ + #import + #import + #import +#endif diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.h b/BindingSample/NativeProject/XMCustomView.h similarity index 58% rename from BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.h rename to BindingSample/NativeProject/XMCustomView.h index d67420a3..51ba3b88 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.h +++ b/BindingSample/NativeProject/XMCustomView.h @@ -1,24 +1,22 @@ -// -// XMCustomView.h -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMCustomViewDelegate.h" - -@interface XMCustomView : UIView -{ - -} - -@property (nonatomic, strong) NSString* name; -@property (nonatomic, assign) id delegate; - - --(void) customizeViewWithText:(NSString *)message; - - - -@end +// +// XMCustomView.h +// XMBindingLibrary +// +// Created by Anuj Bhatia on 1/18/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "XMCustomViewDelegate.h" + +@interface XMCustomView : UIView { +} + +@property (nonatomic, strong) NSString* name; +@property (nonatomic, assign) id delegate; + +-(void) customizeViewWithText:(NSString *)message; +-(void) doTouch:(id)delegate; + +-(void) layoutSubviews; + +@end diff --git a/BindingSample/NativeProject/XMCustomView.m b/BindingSample/NativeProject/XMCustomView.m new file mode 100755 index 00000000..e408878b --- /dev/null +++ b/BindingSample/NativeProject/XMCustomView.m @@ -0,0 +1,62 @@ +// +// XMCustomView.m +// XMBindingLibrary +// +// Created by Anuj Bhatia on 1/18/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "XMCustomView.h" + +@implementation XMCustomView { + UILabel *txtView; +} + +-(id) init { + if (self = [super init]) { + // create text box + txtView = [[UILabel alloc] init]; + txtView.textAlignment = NSTextAlignmentCenter; + txtView.textColor = [UIColor blueColor]; + txtView.lineBreakMode = NSLineBreakByWordWrapping; + txtView.adjustsFontSizeToFitWidth = NO; + txtView.numberOfLines = 0; + + [self addSubview:txtView]; + + self.backgroundColor = [UIColor whiteColor]; + + // set inner shadow + self.layer.cornerRadius = 8; + self.layer.shadowOffset = CGSizeMake(10, 10); + self.layer.shadowRadius = 5; + self.layer.shadowOpacity = 0.5; + self.layer.shadowColor = [[UIColor blackColor] CGColor]; + } + + return self; +} + +-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self.delegate viewWasTouched:self]; +} + +-(void) customizeViewWithText:(NSString *)message { + if ([message length] > 0) { + txtView.text = message; + } else { + txtView.text = @""; + } +} + +-(void) doTouch:(id)delegate { + [delegate viewWasTouched:self]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + txtView.frame = self.bounds; +} + +@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomViewDelegate.h b/BindingSample/NativeProject/XMCustomViewDelegate.h similarity index 85% rename from BindingSample/src/binding/XMBindingLibrarySample/XMCustomViewDelegate.h rename to BindingSample/NativeProject/XMCustomViewDelegate.h index dfe54f01..40253126 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomViewDelegate.h +++ b/BindingSample/NativeProject/XMCustomViewDelegate.h @@ -1,17 +1,16 @@ -// -// XMCustomViewDelegate.h -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMCustomView.h" - -@protocol XMCustomViewDelegate - -@required --(void)viewWasTouched:(UIView *)view; - - -@end +// +// XMCustomViewDelegate.h +// XMBindingLibrary +// +// Created by Anuj Bhatia on 1/18/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "XMCustomView.h" + +@protocol XMCustomViewDelegate + +@required +-(void)viewWasTouched:(UIView *)view; + +@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.h b/BindingSample/NativeProject/XMUtilities.h similarity index 78% rename from BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.h rename to BindingSample/NativeProject/XMUtilities.h index 7e3c90ac..9bb74a9a 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.h +++ b/BindingSample/NativeProject/XMUtilities.h @@ -1,26 +1,32 @@ -// -// XMUtilities.h -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import - -// This is how to define a block function prototype. -typedef void (^XMUtilityCallback) (NSString *message); - -@interface XMUtilities : NSObject { - XMUtilityCallback _callback; -} - --(id) init; -+(NSString *) echo:(NSString *)message; --(NSString *) hello:(NSString *)name; --(NSInteger) add:(NSInteger)operandUn and:(NSInteger) operandDeux; --(NSInteger) multiply:(NSInteger)operandUn and:(NSInteger)operandDeux; --(void) setCallback:(XMUtilityCallback) callback; --(void) invokeCallback:(NSString *) message; - -@end +// +// XMUtilities.h +// XMBindingLibrary +// +// Created by Anuj Bhatia on 1/18/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import + +// This is how to define a block function prototype. +typedef void (^XMUtilityCallback) (NSString *message); + +typedef NS_ENUM(NSInteger, XMGreeting) { + XMGreetingHello, + XMGreetingGoodbye, +}; + +@interface XMUtilities : NSObject { +} + +-(id) init; ++(NSString *) echo:(NSString *)message; +-(NSString *) speak; +-(NSString *) speak:(XMGreeting)greeting; +-(NSString *) hello:(NSString *)name; +-(NSInteger) add:(NSInteger)operandUn and:(NSInteger) operandDeux; +-(NSInteger) multiply:(NSInteger)operandUn and:(NSInteger)operandDeux; +-(void) setCallback:(XMUtilityCallback) callback; +-(void) invokeCallback:(NSString *) message; + +@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.m b/BindingSample/NativeProject/XMUtilities.m similarity index 53% rename from BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.m rename to BindingSample/NativeProject/XMUtilities.m index b7cd1ce0..34ec439a 100755 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMUtilities.m +++ b/BindingSample/NativeProject/XMUtilities.m @@ -1,74 +1,85 @@ -// -// XMUtilities.m -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMUtilities.h" - -@implementation XMUtilities - --(id) init -{ - if(self = [super init]) { - // do initialization here after super init nil check! - } - - return self; -} - --(void) dealloc -{ - // this is an ARC project so we don't have to dealloc - // we dont even have to call [super dealloc]; - // old habits die hard, Yippee-ki-yay! -} - -// This is an example of a class method. It will echo the message you give it. -// Obj-C class methods are like C# static methods, but different. - -+(NSString *) echo:(NSString *)message -{ - if([message length] == 0) { - return [NSString stringWithFormat:@"Dude %@, you didnt give me a message!", @"bro"]; - } - - return [NSString stringWithFormat:@"%@", message]; -} - -// This is an example of an instance method. - --(NSString *) hello:(NSString *)name -{ - if([name length] == 0) { - return [NSString stringWithFormat:@"Dude %@, you didnt give me a name!", @"bro"]; - } - - return [NSString stringWithFormat:@"*Waves* Hello %@! Welcome to the Xamarin binding sample!", name]; -} - --(NSInteger) add:(NSInteger)operandUn and:(NSInteger) operandDeux -{ - return operandUn + operandDeux; -} - --(NSInteger) multiply:(NSInteger)operandUn and:(NSInteger)operandDeux -{ - return operandUn * operandDeux; -} - -// This is an example of how to set a block function for later use. --(void) setCallback:(XMUtilityCallback) callback -{ - _callback = [callback copy]; -} - -// This is an example of how to invoke a block function. --(void) invokeCallback:(NSString *) message -{ - _callback (message); -} - -@end +// +// XMUtilities.m +// XMBindingLibrary +// +// Created by Anuj Bhatia on 1/18/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "XMUtilities.h" + +@implementation XMUtilities { + XMUtilityCallback _callback; +} + +-(id) init { + if (self = [super init]) { + // do initialization here after super init nil check! + } + + return self; +} + +-(void) dealloc { + // this is an ARC project so we don't have to dealloc + // we dont even have to call [super dealloc]; + // old habits die hard, Yippee-ki-yay! +} + +// This is an example of a class method. It will echo the message you give it. +// Obj-C class methods are like C# static methods, but different. + ++(NSString *) echo:(NSString *)message { + if ([message length] == 0) { + return @"Yo, you didn't give me a message!"; + } + + return [NSString stringWithFormat:@"%@", message]; +} + +// This is an example of an instance method. + +-(NSString *) speak { + return @"*Speaks* This is the Xamarin binding sample."; +} + +-(NSString *) speak:(XMGreeting)greeting { + switch (greeting) { + case XMGreetingHello: + return @"*Speaks* This is a big HELLO!"; + case XMGreetingGoodbye: + return @"*Speaks* This is a big GOODBYE!"; + default: + return @"Yo, you didn't give me valid greeting!"; + } +} + +// This is an example of an instance method with a parameter. + +-(NSString *) hello:(NSString *)name { + if ([name length] == 0) { + return @"Yo, you didn't give me a name!"; + } + + return [NSString stringWithFormat:@"*Waves* Hello %@! Welcome to the Xamarin binding sample!", name]; +} + +-(NSInteger) add:(NSInteger)operandUn and:(NSInteger) operandDeux { + return operandUn + operandDeux; +} + +-(NSInteger) multiply:(NSInteger)operandUn and:(NSInteger)operandDeux { + return operandUn * operandDeux; +} + +// This is an example of how to set a block function for later use. +-(void) setCallback:(XMUtilityCallback) callback { + _callback = [callback copy]; +} + +// This is an example of how to invoke a block function. +-(void) invokeCallback:(NSString *) message { + _callback (message); +} + +@end diff --git a/BindingSample/README.md b/BindingSample/README.md index 7c99b2be..1ad77af3 100755 --- a/BindingSample/README.md +++ b/BindingSample/README.md @@ -1,12 +1,10 @@ -MonoTouch BTouch Binding Sample +Xamarin.iOS Binding Sample =============================== -This example shows how we can utilize an existing Objective-C library and expose it for use in a MonoTouch project. For instance, you may have existing code written in Objective-C that you may want to bind to C# to consume in your MonoTouch project. This sample provides a basic template/overview of the steps involved, including: +This example shows how we can utilize an existing Objective-C library and expose it for use in a Xamarin.iOS project. For instance, you may have existing code written in Objective-C that you may want to bind to C# to consume in your Xamarin.iOS project. This sample provides a basic template/overview of the steps involved, including: - Creating a "fat" or multi-architecture library that can be target both the iOS simulator and device. - - Defining an API definition file in the form of a C# interface against the Objective-C API. - - Building a `*.dll` that contains both the binding and and the embedded native library. ## Understanding this Sample @@ -14,43 +12,7 @@ This example shows how we can utilize an existing Objective-C library and expose This sample consists of three distinct source projects: - Xcode Project in Objective-C -- MonoTouch Binding classes -- MonoTouch Sample Project +- Xamarin.iOS Binding classes +- Xamarin.iOS Sample Project Please see the README in each project folder for more details. - -## Building this Sample - -To compile the Xcode Project and binding classes execute the `make` command from the root directory. - -The make command will: - -- Compile the Xcode Project for ARMv7, ARM64, and i386 (Simulator) -- Create a multi-architecture binary using `lipo` -- Create a `*.dll` in the binding folder using `btouch-native` - -The resulting .dll is created using the [LinkWithAttribute](http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types#Linking_the_Dependencies) and will automatically embed the native library in your application. - -## Creating a Universal Binary - -A "fat" or multi-architecture library is a compiled binary that is usable on -multiple targets, for example: ARMv7, ARM64, and i386 (simulator). In -this sample we illustrate how to create a universal binary in two ways: - -### Using lipo - -Once we have built our library against the desired architectures we can create the universal binary via `lipo`. This will create a "universal" file from the architecture specific inputs we have provided. For instance: - - lipo -create libXMBindingLibrarySample-armv7.a libXMBindingLibrarySample-arm64.a libXMBindingLibrarySample-i386.a -output libXMBindingLibrarySampleUniversal.a - - -Similarly, in our Makefile script we have `lipo -create -output $@ $^` which will take the libraries compiled for ARM64, ARMv7, and i386 using xbuild and output them to the current directory with the name of our build target. - -### Using Xcode - -In our Xcode project we have created a separate `Build Target` that will execute a post build `Run Script` to output a -"universal" file. - -![screenshot](http://i.imgur.com/6SIsx.png "Build Target - Run Script") - -This Run Script is also available for reference in the "Post-Build Run Script" group of the Xcode project. diff --git a/BindingSample/Screenshots/01.png b/BindingSample/Screenshots/01.png old mode 100755 new mode 100644 index 2ee46986..9911bf47 Binary files a/BindingSample/Screenshots/01.png and b/BindingSample/Screenshots/01.png differ diff --git a/BindingSample/Screenshots/02.png b/BindingSample/Screenshots/02.png new file mode 100644 index 00000000..779e36e7 Binary files /dev/null and b/BindingSample/Screenshots/02.png differ diff --git a/BindingSample/XMBindingLibrary/ApiDefinition.cs b/BindingSample/XMBindingLibrary/ApiDefinition.cs new file mode 100644 index 00000000..c2525847 --- /dev/null +++ b/BindingSample/XMBindingLibrary/ApiDefinition.cs @@ -0,0 +1,131 @@ +using System; +using Foundation; +using ObjCRuntime; +using UIKit; + +namespace XMBindingLibrary +{ + // typedef void (^XMUtilityCallback) (NSString *message); + public delegate void XMUtilityCallback(NSString message); + + // @interface XMUtilities : NSObject + [BaseType(typeof(NSObject))] + interface XMUtilities + { + // NOTE: + // We DO NOT have to bind a constructor since the default/empty + // constructor will be automatically generated. + // + // -(id) init; + //[Export("init")] + //IntPtr Constructor(); + + // NOTE: + // This is attributed with static because it is a class/static method. + // + // +(NSString *) echo:(NSString *)message; + [Static] + [Export("echo:")] + string Echo(string message); + + // NOTE: + // Methods without a parameter do not need the trailing colon (":"). + // + // -(NSString *) speak; + [Export("speak")] + string Speak(); + + // -(NSString *) speak:(XMGreeting)greeting; + [Export("speak:")] + string Speak(XMGreeting greeting); + + // NOTE: + // Methods WITH a parameter must have a trailing colon (":"). + // + // -(NSString *) hello:(NSString *)name; + [Export("hello:")] + string Hello(string name); + + // NOTE: + // Here we have two parameters, and the method name + // and each argument are suffxed with a colon. + // + // -(NSInteger) add:(NSInteger)operandUn and:(NSInteger) operandDeux; + [Export("add:and:")] + nint Add(nint operandUn, nint operandDeux); + + // -(NSInteger) multiply:(NSInteger)operandUn and:(NSInteger)operandDeux; + [Export("multiply:and:")] + nint Multiply(nint operandUn, nint operandDeux); + + // -(void) setCallback:(XMUtilityCallback) callback; + [Export("setCallback:")] + void SetCallback(XMUtilityCallback callback); + + // -(void) invokeCallback:(NSString *) message; + [Export("invokeCallback:")] + void InvokeCallback(string message); + } + + // NOTE: + // We create a dummy I here so we can reference it from the + // delegate prperty and other members. + interface IXMCustomViewDelegate { } + + // @protocol XMCustomViewDelegate + [Protocol] + [Model(AutoGeneratedName = true)] + [BaseType(typeof(NSObject))] + interface XMCustomViewDelegate + { + // NOTE: + // The [Abstract] attribute is added since this is a required member. + // + // @required -(void)viewWasTouched:(UIView *)view; + [Abstract] + [Export("viewWasTouched:")] + void ViewWasTouched(XMCustomView view); + } + + // NOTE: + // We want to turn the delegate members into events, so we set the + // attribute's "Delegates" property to the delegate property name + // And, we set the attribute's "Events" property to the type of the + // delegate. + // + // @interface XMCustomView : UIView + [BaseType(typeof(UIView), + Delegates = new[] { "Delegate" }, + Events = new[] { typeof(XMCustomViewDelegate) })] + interface XMCustomView + { + // @property (nonatomic, strong) NSString* name; + [Export("name")] + string Name { get; [NullAllowed] set; } + + // NOTE: + // Instead of using the class type, we use the interface as this will + // be more flexible. + // + // @property (nonatomic, assign) id delegate; + [Export("delegate", ArgumentSemantic.Assign)] + [NullAllowed] + IXMCustomViewDelegate Delegate { get; set; } + + // NOTE: + // The C# method name does not have to match the Objective-C name + // because the attribute will be used to find it. + // + // -(void) customizeViewWithText:(NSString *)message; + [Export("customizeViewWithText:")] + void CustomizeView(string message); + + // NOTE: + // This method uses the dummy interface because it accepts a protocol + // and not a concrete type. + // + // -(void) doTouch:(id)delegate; + [Export("doTouch:")] + void DoTouch(IXMCustomViewDelegate del); + } +} diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/BindingActions.targets b/BindingSample/XMBindingLibrary/BindingActions.targets similarity index 74% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/BindingActions.targets rename to BindingSample/XMBindingLibrary/BindingActions.targets index caf26858..c89a9dbe 100644 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/BindingActions.targets +++ b/BindingSample/XMBindingLibrary/BindingActions.targets @@ -13,10 +13,11 @@ - + - + + \ No newline at end of file diff --git a/BindingSample/XMBindingLibrary/Extras.cs b/BindingSample/XMBindingLibrary/Extras.cs new file mode 100755 index 00000000..991fd67e --- /dev/null +++ b/BindingSample/XMBindingLibrary/Extras.cs @@ -0,0 +1,15 @@ +using System; + +namespace XMBindingLibrary +{ + partial class XMUtilities + { + // NOTE: + // We can add additional members in this file that were never in the + // original binding. + public nint Subtract(nint operandUn, nint operandDeux) + { + return Add(operandUn, -operandDeux); + } + } +} diff --git a/BindingSample/XMBindingLibrary/Properties/AssemblyInfo.cs b/BindingSample/XMBindingLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..364ba24e --- /dev/null +++ b/BindingSample/XMBindingLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +using Foundation; + +// This attribute allows you to mark your assemblies as “safe to link”. +// When the attribute is present, the linker—if enabled—will process the assembly +// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds. + +[assembly: LinkerSafe] + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("XMBindingLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright © Author 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/BindingSample/XMBindingLibrary/README.md b/BindingSample/XMBindingLibrary/README.md new file mode 100755 index 00000000..fc755dff --- /dev/null +++ b/BindingSample/XMBindingLibrary/README.md @@ -0,0 +1,17 @@ +XMBindingLibrary Binding Project +====================================== + +This project contains the following items: + +- Extras.cs + This is where we define the partial types for our interface definitions. +- ApiDefinition.cs + The API definition file which contains the interfaces which have been attributed to drive the binding. +- Structs.cs + The enumerations and structs file which contains any non Objective-C types. +- BindingActions.targets + The MSBuild targets file that will make sure the native library is built before trying to bind it. + +## Building the Binding Library + +The resulting assembly is created using [Native References](https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/native-references) and will automatically embed the native library in your application. diff --git a/BindingSample/XMBindingLibrary/Structs.cs b/BindingSample/XMBindingLibrary/Structs.cs new file mode 100644 index 00000000..89a7cc90 --- /dev/null +++ b/BindingSample/XMBindingLibrary/Structs.cs @@ -0,0 +1,8 @@ +namespace XMBindingLibrary +{ + public enum XMGreeting + { + Hello, + Goodbye, + } +} diff --git a/BindingSample/XMBindingLibrary/XMBindingLibrary.csproj b/BindingSample/XMBindingLibrary/XMBindingLibrary.csproj new file mode 100644 index 00000000..427edb63 --- /dev/null +++ b/BindingSample/XMBindingLibrary/XMBindingLibrary.csproj @@ -0,0 +1,55 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {A62E63ED-97A6-475B-8376-912F2C027FAB} + {8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + XMBindingLibrary + XMBindingLibrary + Resources + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + + prompt + 4 + true + + + + + + + + + + + + + + + + + + Static + True + + + + + \ No newline at end of file diff --git a/BindingSample/XMBindingLibrarySample/.gitignore b/BindingSample/XMBindingLibrarySample/.gitignore new file mode 100755 index 00000000..cd42ee34 --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/BindingSample/XMBindingLibrarySample/AppDelegate.cs b/BindingSample/XMBindingLibrarySample/AppDelegate.cs new file mode 100755 index 00000000..1e5c6afb --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/AppDelegate.cs @@ -0,0 +1,25 @@ +using Foundation; +using UIKit; + +namespace XMBindingLibrarySample +{ + [Register(nameof(AppDelegate))] + public partial class AppDelegate : UIApplicationDelegate + { + RootViewController rootViewController; + + public override UIWindow Window { get; set; } + + public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) + { + Window = new UIWindow(UIScreen.MainScreen.Bounds); + + rootViewController = new RootViewController(); + + Window.RootViewController = rootViewController; + Window.MakeKeyAndVisible(); + + return true; + } + } +} diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Info.plist b/BindingSample/XMBindingLibrarySample/Info.plist similarity index 86% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Info.plist rename to BindingSample/XMBindingLibrarySample/Info.plist index e73587f5..37cc01ba 100755 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Info.plist +++ b/BindingSample/XMBindingLibrarySample/Info.plist @@ -1,4 +1,4 @@ - + @@ -35,11 +35,15 @@ Binding Library Sample CFBundleIdentifier com.xamarin.bindinglibrarysample - CFBundleShortVersionString - 01.00 - CFBundleVersion - 01 MinimumOSVersion 9.0 + CFBundleName + Binding Library Sample + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + UILaunchStoryboardName + LaunchScreen diff --git a/BindingSample/XMBindingLibrarySample/Main.cs b/BindingSample/XMBindingLibrarySample/Main.cs new file mode 100755 index 00000000..6a975175 --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/Main.cs @@ -0,0 +1,13 @@ +using UIKit; + +namespace XMBindingLibrarySample +{ + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + UIApplication.Main(args, null, nameof(AppDelegate)); + } + } +} diff --git a/BindingSample/XMBindingLibrarySample/README.md b/BindingSample/XMBindingLibrarySample/README.md new file mode 100755 index 00000000..e8f5e75e --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/README.md @@ -0,0 +1,11 @@ +XMBindingLibrarySample Sample Application +================ + +This project contains our Xamarin.iOS sample. It has a reference to XMBindingLibrary.dll and makes calls to our native library written in Objective-C from C#. + +Example: + + var utility = new XMUtilities(); + var result = utility.Hello("Developer"); + + Console.WriteLine(result); diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default.png b/BindingSample/XMBindingLibrarySample/Resources/Default.png similarity index 100% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default.png rename to BindingSample/XMBindingLibrarySample/Resources/Default.png diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default@2x.png b/BindingSample/XMBindingLibrarySample/Resources/Default@2x.png similarity index 100% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default@2x.png rename to BindingSample/XMBindingLibrarySample/Resources/Default@2x.png diff --git a/BindingSample/XMBindingLibrarySample/Resources/LaunchScreen.storyboard b/BindingSample/XMBindingLibrarySample/Resources/LaunchScreen.storyboard new file mode 100644 index 00000000..881d526a --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/Resources/LaunchScreen.storyboard @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/iTunesArtwork.png b/BindingSample/XMBindingLibrarySample/Resources/iTunesArtwork.png similarity index 100% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/iTunesArtwork.png rename to BindingSample/XMBindingLibrarySample/Resources/iTunesArtwork.png diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/iTunesArtwork@2x.png b/BindingSample/XMBindingLibrarySample/Resources/iTunesArtwork@2x.png similarity index 100% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/iTunesArtwork@2x.png rename to BindingSample/XMBindingLibrarySample/Resources/iTunesArtwork@2x.png diff --git a/BindingSample/XMBindingLibrarySample/ViewControllers/CustomViewController.cs b/BindingSample/XMBindingLibrarySample/ViewControllers/CustomViewController.cs new file mode 100755 index 00000000..b0fdf915 --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/ViewControllers/CustomViewController.cs @@ -0,0 +1,120 @@ +using System; +using CoreGraphics; +using Foundation; +using MonoTouch.Dialog; +using UIKit; + +using XMBindingLibrary; + +namespace XMBindingLibrarySample +{ + public class CustomViewController : DialogViewController + { + XMCustomView customView; + + public CustomViewController() + : base(new RootElement("XMCustomView Binding") { UnevenRows = true }, true) + { + } + + public override void LoadView() + { + base.LoadView(); + + customView = new XMCustomView + { + // The XMCustomView Name Property + Name = "Xamarin User", + + // The instance method uses a frame calculation. + Frame = new CGRect(10, 10, View.Bounds.Width - 40, 150), + }; + + // This is the custom event we bound. + // This is sometimes preferable to specifying a delegate. + customView.ViewWasTouched += Handle_CustomViewViewWasTouched; + + // The XMCustomViewDelegate we bound + // If we specify this it will OVERRIDE the event handler we specified + // customView.Delegate = new CustomViewDelegate(); + + // The instance method we bound. + customView.CustomizeView($"Yo {customView.Name}, I heard you like bindings! Xamarin makes it super easy with binding projects. Try it out!"); + + Root.Add(new[] + { + new Section("Custom View") + { + new UIViewElement("", customView, true, new UIEdgeInsets(0, 0, 40, 40)), + }, + + new Section("Operations") + { + new StringElement("Use Event", Handle_UseEvent), + new StringElement("Use Delegate", Handle_UseDelegate), + new StringElement("Do Touch", Handle_DoTouchOperation), + } + }); + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + NavigationItem.HidesBackButton = false; + NavigationItem.BackBarButtonItem = new UIBarButtonItem("Utilities", UIBarButtonItemStyle.Plain, null); + } + + void Handle_UseEvent() + { + customView.Delegate = null; + + // attach the event + customView.ViewWasTouched += Handle_CustomViewViewWasTouched; + } + + void Handle_UseDelegate() + { + // set the delegate + customView.Delegate = new CustomViewDelegate(this); + } + + void Handle_DoTouchOperation() + { + using (var temp = new CustomViewDelegate(this)) + { + customView.DoTouch(temp); + } + } + + void Handle_CustomViewViewWasTouched(object sender, EventArgs e) + { + Handle_ViewTouched("EVENT"); + } + + void Handle_ViewTouched(string where) + { + NSThread.Current.BeginInvokeOnMainThread(() => + { + var vc = UIAlertController.Create("Touched", $"Our bound XMCustomView was touched from the {where}!", UIAlertControllerStyle.Alert); + vc.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); + PresentViewController(vc, true, null); + }); + } + + class CustomViewDelegate : XMCustomViewDelegate + { + CustomViewController viewController; + + public CustomViewDelegate(CustomViewController viewController) + { + this.viewController = viewController; + } + + public override void ViewWasTouched(XMCustomView view) + { + viewController.Handle_ViewTouched("DELEGATE"); + } + } + } +} diff --git a/BindingSample/XMBindingLibrarySample/ViewControllers/RootViewController.cs b/BindingSample/XMBindingLibrarySample/ViewControllers/RootViewController.cs new file mode 100755 index 00000000..a5c3f575 --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/ViewControllers/RootViewController.cs @@ -0,0 +1,23 @@ +using UIKit; + +namespace XMBindingLibrarySample +{ + public class RootViewController : UINavigationController + { + UtilitiesViewController utilViewController; + + public override void LoadView() + { + base.LoadView(); + + utilViewController = new UtilitiesViewController(); + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + PushViewController(utilViewController, true); + } + } +} diff --git a/BindingSample/XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs b/BindingSample/XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs new file mode 100755 index 00000000..9a8dccd5 --- /dev/null +++ b/BindingSample/XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs @@ -0,0 +1,138 @@ +using Foundation; +using MonoTouch.Dialog; + +using XMBindingLibrary; + +namespace XMBindingLibrarySample +{ + public class UtilitiesViewController : DialogViewController + { + XMUtilities utility; + + public UtilitiesViewController() + : base(new RootElement("XMUtilities Binding"), true) + { + } + + public override void LoadView() + { + base.LoadView(); + + utility = new XMUtilities(); + + utility.SetCallback(new XMUtilityCallback(message => + { + SetResultElementValue("Callback: " + message); + })); + + Root.Add(new[] + { + new Section("Operands") + { + new EntryElement("Name: ", "", ""), + new EntryElement("Operand One: ", "", ""), + new EntryElement("Operand Two: ", "", ""), + }, + + new Section("Result") + { + new StringElement("") + }, + + new Section("Operations") + { + new StringElement("Add", Handle_AddOperation), + new StringElement("Subtract", Handle_SubtractOperation), + new StringElement("Multiply", Handle_MultiplyOperation), + new StringElement("Echo", Handle_EchoOperation), + new StringElement("Speak", Handle_SpeakOperation), + new StringElement("Speak Greeting", Handle_SpeakGreetingOperation), + new StringElement("Hello", Handle_HelloOperation), + new StringElement("Invoke Callback", Handle_InvokeCallback), + }, + + new Section("More Bindings") + { + new StringElement("Go to CustomView!", () => + { + var c = new CustomViewController(); + NavigationController.PushViewController(c, true); + }) + } + }); + } + + void Handle_AddOperation() + { + var one = Root[0][1] as EntryElement; + var two = Root[0][2] as EntryElement; + + int.TryParse(one.Value, out var un); + int.TryParse(two.Value, out var deux); + + SetResultElementValue($"{utility.Add(un, deux)}"); + } + + void Handle_SubtractOperation() + { + var one = Root[0][1] as EntryElement; + var two = Root[0][2] as EntryElement; + + int.TryParse(one.Value, out var un); + int.TryParse(two.Value, out var deux); + + SetResultElementValue($"{utility.Subtract(un, deux)}"); + } + + void Handle_MultiplyOperation() + { + var one = Root[0][1] as EntryElement; + var two = Root[0][2] as EntryElement; + + int.TryParse(one.Value, out var un); + int.TryParse(two.Value, out var deux); + + SetResultElementValue($"{utility.Multiply(un, deux)}"); + } + + void Handle_EchoOperation() + { + var nameElement = Root[0][0] as EntryElement; + SetResultElementValue(XMUtilities.Echo(nameElement.Value)); + } + + void Handle_SpeakOperation() + { + SetResultElementValue(utility.Speak()); + } + + void Handle_SpeakGreetingOperation() + { + SetResultElementValue(utility.Speak(XMGreeting.Goodbye)); + } + + void Handle_HelloOperation() + { + var nameElement = Root[0][0] as EntryElement; + SetResultElementValue(utility.Hello(nameElement.Value)); + } + + void Handle_InvokeCallback() + { + utility.InvokeCallback("Callback invoked!"); + } + + void SetResultElementValue(string value) + { + NSThread.Current.BeginInvokeOnMainThread(() => + { + if (Root[1][0] is StringElement e) + { + e.Caption = value; + + TableView.ReloadData(); + } + }); + } + } +} diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.csproj b/BindingSample/XMBindingLibrarySample/XMBindingLibrarySample.csproj similarity index 78% rename from BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.csproj rename to BindingSample/XMBindingLibrarySample/XMBindingLibrarySample.csproj index 0f36a2be..15b7ec1f 100644 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.csproj +++ b/BindingSample/XMBindingLibrarySample/XMBindingLibrarySample.csproj @@ -8,8 +8,8 @@ {0CDEA6B0-A495-48B0-ADC0-A6459F730571} {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe - Xamarin.XMBindingLibrarySample - XamarinXMBindingLibrarySample + XMBindingLibrarySample + XMBindingLibrarySample Xamarin.iOS v1.0 @@ -75,12 +75,12 @@ - - ..\..\..\binding\XMBindingLibrary.dll - - + + {A62E63ED-97A6-475B-8376-912F2C027FAB} + XMBindingLibrary + @@ -90,31 +90,22 @@ - - - - - + + + - - - - - - - - - + + + - \ No newline at end of file diff --git a/BindingSample/src/binding/.gitignore b/BindingSample/src/binding/.gitignore deleted file mode 100755 index ec45cfff..00000000 --- a/BindingSample/src/binding/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.a -*.dll -*.mdb -XMBindingLibrarySample/build/ \ No newline at end of file diff --git a/BindingSample/src/binding/AssemblyInfo.cs b/BindingSample/src/binding/AssemblyInfo.cs deleted file mode 100755 index a472dbda..00000000 --- a/BindingSample/src/binding/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System; -using ObjCRuntime; - -[assembly: LinkWith ("libXMBindingLibrarySampleUniversal.a", LinkTarget.Simulator | LinkTarget.Arm64 | LinkTarget.ArmV7, ForceLoad = true)] diff --git a/BindingSample/src/binding/Makefile b/BindingSample/src/binding/Makefile deleted file mode 100755 index c1a41334..00000000 --- a/BindingSample/src/binding/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -BINDDIR=/src/binding -XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -PROJECT_ROOT=XMBindingLibrarySample -PROJECT=$(PROJECT_ROOT)/XMBindingLibrarySample.xcodeproj -TARGET=XMBindingLibrarySample -BTOUCH=/Developer/MonoTouch/usr/bin/btouch-native - - -all: XMBindingLibrary.dll - -libXMBindingLibrarySample-i386.a: - $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build - -mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(TARGET).a $@ - -libXMBindingLibrarySample-armv7.a: - $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build - -mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@ - -libXMBindingLibrarySample-arm64.a: - $(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch arm64 -configuration Release clean build - -mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@ - -libXMBindingLibrarySampleUniversal.a: libXMBindingLibrarySample-armv7.a libXMBindingLibrarySample-i386.a libXMBindingLibrarySample-arm64.a - lipo -create -output $@ $^ - -XMBindingLibrary.dll: AssemblyInfo.cs XMBindingLibrarySample.cs extras.cs libXMBindingLibrarySampleUniversal.a - $(BTOUCH) -unsafe --new-style -out:$@ XMBindingLibrarySample.cs -x=AssemblyInfo.cs -x=extras.cs --link-with=libXMBindingLibrarySampleUniversal.a,libXMBindingLibrarySampleUniversal.a - -clean: - -rm -f *.a *.dll diff --git a/BindingSample/src/binding/README.md b/BindingSample/src/binding/README.md deleted file mode 100755 index dbea3c3c..00000000 --- a/BindingSample/src/binding/README.md +++ /dev/null @@ -1,12 +0,0 @@ -XMBindingLibrarySample Binding Project -====================================== - -This project contains the following items: - -- AssemblyInfo.cs : This defines our output and [linking] (http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types#Linking_the_Dependencies) behavior - -- extras.cs : This is where we define the partial types for our interface definitions - -- XMBindingLibrarySample.cs : The API definition file which contains the interfaces which have been attributed to drive the binding. - -- XMBindingLibrarySample : The Xcode project for our sample Objective-C library diff --git a/BindingSample/src/binding/XMBindingLibrarySample.cs b/BindingSample/src/binding/XMBindingLibrarySample.cs deleted file mode 100755 index ce1c2079..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace XMBindingLibrarySample -{ - using System; - using System.Drawing; - using Foundation; - using UIKit; - using ObjCRuntime; - - public delegate void XMUtilityCallback (NSString message); - - [BaseType (typeof (NSObject))] - interface XMUtilities - { -// Note: that we DO NOT have to bind a constructor since -// BTOUCH will automatically create the default / empty constructor for us, cool! -// [Export("init")] -// IntPtr Constructor(); - - // Note that this is attributed with static because it is a class method - - [Static] - [Export("echo:")] - string Echo(string message); - - // Methods without a parameter do not need the trailing colon (":") - // But methods with parameters do! - - [Export("hello:")] - string Hello(string name); - - // Again, here we have two parameters, but the method name - // and each argument are suffxed with a colon. - - [Export("add:and:")] - nint Add(nint operandUn, nint operandDeux); - - [Export("multiply:and:")] - nint Multiply(nint operandUn, nint operandDeux); - - [Export("setCallback:")] - void SetCallback(XMUtilityCallback callback); - - [Export("invokeCallback:")] - void InvokeCallback(NSString message); - } - - [BaseType(typeof(UIView), Delegates = new string [] {"WeakDelegate"}, Events = new Type[] { (typeof(XMCustomViewDelegate)) })] - interface XMCustomView - { - [Export("name")] - string Name { get; [NullAllowed] set; } - - [Export("delegate", ArgumentSemantic.Assign)] - [NullAllowed] - NSObject WeakDelegate { get; set; } - - [Wrap("WeakDelegate")] - [NullAllowed] - XMCustomViewDelegate Delegate { get; set; } - - [Export("customizeViewWithText:")] - void CustomizeViewWithText(string message); - } - - [Model] - [BaseType(typeof (NSObject))] - interface XMCustomViewDelegate - { - // Notice the use of [Abstract] here since the -(void)viewWasTouched:(UIView *)view; method - // Was defined using the @required keyword in the native library. - [Abstract] - [Export ("viewWasTouched:")] - void ViewWasTouched(XMCustomView view); - } -} - diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcshareddata/XMBindingLibrarySample.xccheckout b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcshareddata/XMBindingLibrarySample.xccheckout deleted file mode 100644 index 6033017b..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcshareddata/XMBindingLibrarySample.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 0D9C6A08-A740-4A6D-8FFD-95D9C1E00EC0 - IDESourceControlProjectName - XMBindingLibrarySample - IDESourceControlProjectOriginsDictionary - - 0E68039F2209CEA6C5215FF8565B7310427923A7 - https://github.com/xamarin/monotouch-samples.git - - IDESourceControlProjectPath - BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - 0E68039F2209CEA6C5215FF8565B7310427923A7 - ../../../../../.. - - IDESourceControlProjectURL - https://github.com/xamarin/monotouch-samples.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - 0E68039F2209CEA6C5215FF8565B7310427923A7 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 0E68039F2209CEA6C5215FF8565B7310427923A7 - IDESourceControlWCCName - monotouch-samples - - - - diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/UserInterfaceState.xcuserstate b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 71c10ad9..00000000 Binary files a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/project.xcworkspace/xcuserdata/kmullins.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySample.xcscheme b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySample.xcscheme deleted file mode 100644 index 899ccf88..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySample.xcscheme +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySampleUniversal.xcscheme b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySampleUniversal.xcscheme deleted file mode 100644 index 182d1b30..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/XMBindingLibrarySampleUniversal.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/xcschememanagement.plist b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index ff0e687d..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample.xcodeproj/xcuserdata/kmullins.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - SchemeUserState - - XMBindingLibrarySample.xcscheme - - orderHint - 0 - - XMBindingLibrarySampleUniversal.xcscheme - - orderHint - 1 - - - SuppressBuildableAutocreation - - 1D09B80E14C87E5F00033666 - - primary - - - 1DE6534D14C7C824007670AC - - primary - - - - - diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.h b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.h deleted file mode 100755 index 477ed0ae..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// XMBindingLibrarySample.h -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import - -@interface XMBindingLibrarySample : NSObject - -@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.m b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.m deleted file mode 100755 index 894c81f0..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySample/XMBindingLibrarySample.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// XMBindingLibrarySample.m -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMBindingLibrarySample.h" - -@implementation XMBindingLibrarySample - -- (id)init -{ - self = [super init]; - if (self) { - // Initialization code here. - } - - return self; -} - -@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.h b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.h deleted file mode 100755 index 42054479..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// XMBindingLibrarySampleUniversal.h -// XMBindingLibrarySampleUniversal -// -// Created by Anuj Bhatia on 1/19/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import - -@interface XMBindingLibrarySampleUniversal : NSObject - -@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.m b/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.m deleted file mode 100755 index 7543f5cb..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMBindingLibrarySampleUniversal/XMBindingLibrarySampleUniversal.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// XMBindingLibrarySampleUniversal.m -// XMBindingLibrarySampleUniversal -// -// Created by Anuj Bhatia on 1/19/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMBindingLibrarySampleUniversal.h" - -@implementation XMBindingLibrarySampleUniversal - -- (id)init -{ - self = [super init]; - if (self) { - // Initialization code here. - } - - return self; -} - -@end diff --git a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.m b/BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.m deleted file mode 100755 index 8bb771ef..00000000 --- a/BindingSample/src/binding/XMBindingLibrarySample/XMCustomView.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// XMCustomView.m -// XMBindingLibrarySample -// -// Created by Anuj Bhatia on 1/18/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "XMCustomView.h" - -@interface XMCustomView () -@property (nonatomic, assign) BOOL isCustomized; -@end - - -@implementation XMCustomView - -@synthesize name = _name, delegate = _delegate, isCustomized = _isCustomized; - - --(id) init -{ - if(self = [super init]) { - // do initialization hurr - self.isCustomized = false; - } - - return self; -} - --(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [self.delegate viewWasTouched:self]; -} - --(void) customizeViewWithText:(NSString *)message -{ - if(self.isCustomized == false && [message length] > 0) { - - UITextView *txtView = [[UITextView alloc] init]; - txtView.textAlignment = NSTextAlignmentCenter; - txtView.textColor = [UIColor blueColor]; - txtView.frame = CGRectMake(self.frame.origin.x, ((self.frame.origin.y / 2) - 25), self.frame.size.width, 100); -// txtView.lineBreakMode = UILineBreakModeWordWrap; - - // set inner shadow - txtView.layer.masksToBounds = NO; - txtView.layer.cornerRadius = 8; - txtView.layer.shadowOffset = CGSizeMake(-15, 20); - txtView.layer.shadowRadius = 5; - txtView.layer.shadowOpacity = 0.5; - txtView.layer.shadowColor = [[UIColor blackColor] CGColor]; - - txtView.text = message; -// [txtView sizeToFit]; - - [self addSubview:txtView]; - } -} - -@end diff --git a/BindingSample/src/binding/extras.cs b/BindingSample/src/binding/extras.cs deleted file mode 100755 index 6ee3bd0d..00000000 --- a/BindingSample/src/binding/extras.cs +++ /dev/null @@ -1,35 +0,0 @@ - -using System; -using System.Drawing; -using System.Runtime.InteropServices; -using CoreFoundation; -using CoreMedia; -using CoreMotion; -using Foundation; -using ObjCRuntime; -using CoreAnimation; -using CoreLocation; -using MapKit; -using UIKit; -using CoreGraphics; -using NewsstandKit; -using GLKit; -using OpenTK; - -namespace XMBindingLibrarySample -{ - public partial class XMUtilities : NSObject - { - - } - - public partial class XMCustomView : UIView - { - - } - - public partial class XMCustomViewDelegate : NSObject - { - - } -} diff --git a/BindingSample/src/sample/README.md b/BindingSample/src/sample/README.md deleted file mode 100755 index 0145cec5..00000000 --- a/BindingSample/src/sample/README.md +++ /dev/null @@ -1,11 +0,0 @@ -XMBindingLibrarySample Sample Application -================ - -This project contains our MonoTouch sample. It has a reference to XMBindingLibrarySample.dll and makes calls to our native library written in Objective-C from C# - -Example: - - var utility = new XMUtilities(); - var result = utility.Hello("Anuj"); - - Console.WriteLine(result); \ No newline at end of file diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.sln b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.sln deleted file mode 100755 index b149885b..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.XMBindingLibrarySample", "Xamarin.XMBindingLibrarySample\Xamarin.XMBindingLibrarySample.csproj", "{0CDEA6B0-A495-48B0-ADC0-A6459F730571}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhone.ActiveCfg = Debug|iPhone - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhone.Build.0 = Debug|iPhone - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhone.ActiveCfg = Release|iPhone - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhone.Build.0 = Release|iPhone - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {0CDEA6B0-A495-48B0-ADC0-A6459F730571}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Xamarin.XMBindingLibrarySample\Xamarin.XMBindingLibrarySample.csproj - EndGlobalSection -EndGlobal diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/.gitignore b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/.gitignore deleted file mode 100755 index 01c1f5a9..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -obj diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/AppDelegate.cs b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/AppDelegate.cs deleted file mode 100755 index ba5b3057..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/AppDelegate.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -using System; -using System.Collections.Generic; -using System.Linq; -using Foundation; -using UIKit; - -namespace Xamarin.XMBindingLibrarySample -{ - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate - { - UIWindow _Window; - RootViewController _RootViewController; - - public override bool FinishedLaunching(UIApplication app, NSDictionary options) - { - _Window = new UIWindow(UIScreen.MainScreen.Bounds); - _RootViewController = new RootViewController(); - - _Window.RootViewController = _RootViewController; - _Window.MakeKeyAndVisible(); - return true; - } - } -} - diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Main.cs b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Main.cs deleted file mode 100755 index 5f86270f..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Main.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -using System; -using System.Collections.Generic; -using System.Linq; -using Foundation; -using UIKit; - -namespace Xamarin.XMBindingLibrarySample -{ - public class Application - { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, "AppDelegate"); - } - } -} diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-568h@2x.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-568h@2x.png deleted file mode 100755 index b3f66780..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-568h@2x.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape@2x~ipad.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape@2x~ipad.png deleted file mode 100755 index 13cd433d..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape@2x~ipad.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape~ipad.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape~ipad.png deleted file mode 100755 index 18532e3b..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Landscape~ipad.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait@2x~ipad.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait@2x~ipad.png deleted file mode 100755 index becc2fe1..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait@2x~ipad.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait~ipad.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait~ipad.png deleted file mode 100755 index 1bc6fa7f..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/Default-Portrait~ipad.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-100.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-100.png deleted file mode 100755 index 13a7b3c4..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-100.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-114.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-114.png deleted file mode 100755 index 7a29a374..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-114.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-144.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-144.png deleted file mode 100755 index 0e17a295..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-144.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-29.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-29.png deleted file mode 100755 index 9cbe1899..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-29.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-50.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-50.png deleted file mode 100755 index 7199467b..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-50.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-57.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-57.png deleted file mode 100755 index af8016cc..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-57.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-58.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-58.png deleted file mode 100755 index e33ac58c..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-58.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-72.png b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-72.png deleted file mode 100755 index 0efca071..00000000 Binary files a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/Resources/icon-72.png and /dev/null differ diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/CustomViewController.cs b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/CustomViewController.cs deleted file mode 100755 index fb40e925..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/CustomViewController.cs +++ /dev/null @@ -1,121 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -using System; -using MonoTouch.Dialog; -using XMBindingLibrarySample; -using UIKit; -using Foundation; -using CoreGraphics; - -namespace Xamarin.XMBindingLibrarySample -{ - public class CustomViewController : DialogViewController - { - XMCustomView _CustomView; - - public CustomViewController() - : base(new RootElement(@"XMCustomView Binding") { UnevenRows = true }, true) - { - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - - public override void LoadView() - { - base.LoadView(); - _CustomView = new XMCustomView(); - - // This is the custom event we bound. - // This is sometimes preferable to specifying a delegate. - _CustomView.ViewWasTouched += Handle_CustomViewViewWasTouched; - - // The XMCustomViewDelegate we bound - // If we specify this it will OVERRIDE the event handler we specified -// _CustomView.Delegate = new CustomViewDelegate(); - - // The XMCustomView Name Property - _CustomView.Name = @"Anuj"; - - // The instance method uses a frame calculation. - _CustomView.Frame = new CGRect(10, 25, 200, 200); - - // The instance method we bound. - _CustomView.CustomizeViewWithText(string.Format(@"Yo {0}, I hurd you like bindings! MonoTouch makes it super easy with BTOUCH. Try it out!", - _CustomView.Name ?? "Dawg")); - - var section = new Section("Custom View") { - new CustomViewElement(_CustomView), - }; - - this.Root.Add(section); - } - - public override void ViewDidLoad() - { - base.ViewDidLoad(); - this.NavigationItem.HidesBackButton = false; - this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Utilities", UIBarButtonItemStyle.Bordered, null); - } - - public override void ViewWillLayoutSubviews() - { - base.ViewWillLayoutSubviews(); - } - - private void Handle_CustomViewViewWasTouched (object sender, EventArgs e) - { - var customView = sender as XMCustomView; - - if(customView == null) { - return; - } - - // Remember, the block of this method is called on a Background Thread... - // In order to push a notification to the view we need to call within the scope of the main thread. - - using(var pool = new NSAutoreleasePool()) { - pool.BeginInvokeOnMainThread(() => { - using(var alert = new UIAlertView("View Was Touched", "Our bound XMCustomView was Touched!", null, "OK, Cool!", null)) { - alert.Show(); - } - }); - } - } - - class CustomViewDelegate : XMCustomViewDelegate - { - public override void ViewWasTouched(XMCustomView view) - { - Console.WriteLine("Hey! Our XMCustomView was touched with frame: {0}!", view.Frame); - } - } - - public class CustomViewElement : UIViewElement, IElementSizing - { - public CustomViewElement(UIView customView) - : base("", customView, true) - { - } - - public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) - { -// base.Selected(dvc, tableView, path); - } - } - } -} \ No newline at end of file diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/RootViewController.cs b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/RootViewController.cs deleted file mode 100755 index c48e87d8..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/RootViewController.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -using System; -using UIKit; - -namespace Xamarin.XMBindingLibrarySample -{ - public class RootViewController : UINavigationController - { - UtilitiesViewController _UtilViewController; - - public RootViewController() - : base() - { - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - - public override void LoadView() - { - base.LoadView(); - _UtilViewController = new UtilitiesViewController(); - } - - public override void ViewDidLoad() - { - base.ViewDidLoad(); - this.PushViewController(_UtilViewController, true); - } - - public override void ViewWillLayoutSubviews() - { - base.ViewWillLayoutSubviews(); - } - - } -} - diff --git a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs b/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs deleted file mode 100755 index f87d3e22..00000000 --- a/BindingSample/src/sample/Xamarin.XMBindingLibrarySample/Xamarin.XMBindingLibrarySample/ViewControllers/UtilitiesViewController.cs +++ /dev/null @@ -1,144 +0,0 @@ -// -// Copyright 2012 abhatia -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using System.Linq; -using MonoTouch.Dialog; -using Foundation; -using XMBindingLibrarySample; -using UIKit; - -namespace Xamarin.XMBindingLibrarySample -{ - public class UtilitiesViewController : DialogViewController - { - XMUtilities Utility; - - public UtilitiesViewController() - : base(new RootElement("XMUtilities Binding"), true) - { - - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - } - - public override void LoadView() - { - base.LoadView(); - - Utility = new XMUtilities(); - - Utility.SetCallback (new XMUtilityCallback (OurCallback)); - - var operandSection = new Section("Operands") { - new EntryElement("Name: ", "", ""), - new EntryElement("Operand One: ", "", ""), - new EntryElement("Operand Two: ", "", ""), - }; - - var operationSection = new Section("Operations") { - new StringElement("Add", Handle_AddOperation), - new StringElement("Multiply", Handle_MultiplyOperation), - new StringElement("Hello", Handle_HelloOperation), - new StringElement("Invoke Callback", Handle_InvokeCallback), - }; - - var resultSection = new Section("Result") { - new StringElement(@"") - }; - - var customViewSection = new Section("More Bindings") { - new StringElement("Go to CustomView!", () => { - var c = new CustomViewController(); - - this.NavigationController.PushViewController(c, true); - }) - }; - - this.Root.Add(new Section[] { operandSection, operationSection, resultSection, customViewSection }); - } - - public override void ViewDidLoad() - { - base.ViewDidLoad(); - - } - - public override void ViewWillLayoutSubviews() - { - base.ViewWillLayoutSubviews(); - } - - void OurCallback (NSString message) - { - SetResultElementValue(message); - } - - public void Handle_InvokeCallback () - { - using (NSString message = new NSString ("Callback invoked!")) { - Utility.InvokeCallback (message); - } - } - - public void Handle_AddOperation() - { - var one = Root[0][1] as EntryElement; - var two = Root[0][2] as EntryElement; - - int un; - int deux; - if(int.TryParse(one.Value, out un) && int.TryParse(two.Value, out deux)) { - SetResultElementValue(string.Format(@"{0}", un + deux)); - } - - } - - public void Handle_MultiplyOperation() - { - var one = Root[0][1] as EntryElement; - var two = Root[0][2] as EntryElement; - - int un; - int deux; - if(int.TryParse(one.Value, out un) && int.TryParse(two.Value, out deux)) { - SetResultElementValue(string.Format(@"{0}", un * deux)); - } - } - - public void Handle_HelloOperation() - { - var nameElement = Root[0][0] as EntryElement; - SetResultElementValue(Utility.Hello(nameElement.Value)); - } - - public void SetResultElementValue(string @value) - { - using(var pool = new NSAutoreleasePool()) { - pool.BeginInvokeOnMainThread(() => { - var e = Root[2][0] as StringElement; - if(e != null) { - e.Caption = value; - this.TableView.ReloadData(); - } - }); - } - } - } -} -