├── .gitignore
├── .swift-version
├── .travis.yml
├── Example
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Local Podspecs
│ │ └── Scale.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Scale.xcscheme
│ └── Target Support Files
│ │ ├── Pods-Scale_Example
│ │ ├── Info.plist
│ │ ├── Pods-Scale_Example-acknowledgements.markdown
│ │ ├── Pods-Scale_Example-acknowledgements.plist
│ │ ├── Pods-Scale_Example-dummy.m
│ │ ├── Pods-Scale_Example-frameworks.sh
│ │ ├── Pods-Scale_Example-resources.sh
│ │ ├── Pods-Scale_Example-umbrella.h
│ │ ├── Pods-Scale_Example.debug.xcconfig
│ │ ├── Pods-Scale_Example.modulemap
│ │ └── Pods-Scale_Example.release.xcconfig
│ │ ├── Pods-Scale_Tests
│ │ ├── Info.plist
│ │ ├── Pods-Scale_Tests-acknowledgements.markdown
│ │ ├── Pods-Scale_Tests-acknowledgements.plist
│ │ ├── Pods-Scale_Tests-dummy.m
│ │ ├── Pods-Scale_Tests-frameworks.sh
│ │ ├── Pods-Scale_Tests-resources.sh
│ │ ├── Pods-Scale_Tests-umbrella.h
│ │ ├── Pods-Scale_Tests.debug.xcconfig
│ │ ├── Pods-Scale_Tests.modulemap
│ │ └── Pods-Scale_Tests.release.xcconfig
│ │ └── Scale
│ │ ├── Info.plist
│ │ ├── Scale-dummy.m
│ │ ├── Scale-prefix.pch
│ │ ├── Scale-umbrella.h
│ │ ├── Scale.modulemap
│ │ └── Scale.xcconfig
├── Scale.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── Scale-Mac.xcscheme
│ │ └── Scale-iOS.xcscheme
├── Scale.xcworkspace
│ └── contents.xcworkspacedata
├── Scale
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ └── ViewController.swift
└── Tests
│ ├── Info.plist
│ └── Tests.swift
├── LICENSE
├── README.md
├── Scale.podspec
├── Scale.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ └── xcschemes
│ ├── Scale-Mac.xcscheme
│ └── Scale-iOS.xcscheme
├── Scale
├── Info-Mac.plist
└── Info-iOS.plist
├── ScaleTests
├── Info-Mac.plist
├── Info-iOS.plist
└── Tests.swift
├── Screenshots
└── Banner.png
├── Sources
├── Angle.swift
├── Area.swift
├── Energy.swift
├── Error.swift
├── Length.swift
├── Metric.swift
├── Power.swift
├── Temperature.swift
├── Time.swift
├── Volume.swift
└── Weight.swift
└── Support
├── Definitions
├── Angle.def
├── Area.def
├── Energy.def
├── Length.def
├── Metric.def
├── Power.def
├── Template.t
├── Time.def
├── Volume.def
└── Weight.def
└── Script
└── Script.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata
15 | *.xccheckout
16 | profile
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.ipa
21 |
22 | # Bundler
23 | .bundle
24 |
25 | Carthage
26 | # We recommend against adding the Pods directory to your .gitignore. However
27 | # you should judge for yourself, the pros and cons are mentioned at:
28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
29 | #
30 | # Note: if you ignore the Pods directory, make sure to uncomment
31 | # `pod install` in .travis.yml
32 | #
33 | # Pods/
34 |
--------------------------------------------------------------------------------
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.0
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * http://www.objc.io/issue-6/travis-ci.html
3 | # * https://github.com/supermarin/xcpretty#usage
4 |
5 | language: objective-c
6 | # cache: cocoapods
7 | # podfile: Example/Podfile
8 | # before_install:
9 | # - gem install cocoapods # Since Travis is not always on latest version
10 | # - pod install --project-directory=Example
11 | script:
12 | - set -o pipefail && xcodebuild test -workspace Example/Scale.xcworkspace -scheme Scale-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
13 | - pod lib lint
14 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | use_frameworks!
3 |
4 | target 'Scale_Example', :exclusive => true do
5 | pod "Scale", :path => "../"
6 | end
7 |
8 | target 'Scale_Tests', :exclusive => true do
9 | pod "Scale", :path => "../"
10 |
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Scale (0.1.0)
3 |
4 | DEPENDENCIES:
5 | - Scale (from `../`)
6 |
7 | EXTERNAL SOURCES:
8 | Scale:
9 | :path: ../
10 |
11 | SPEC CHECKSUMS:
12 | Scale: 4be55bcccde50a97ada700d17b50943b2503f79c
13 |
14 | COCOAPODS: 0.39.0
15 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/Scale.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Scale",
3 | "version": "0.1.0",
4 | "summary": "Unit converter in Swift",
5 | "homepage": "https://github.com/onmyway133/Scale",
6 | "license": "MIT",
7 | "authors": {
8 | "Khoa Pham": "onmyway133@gmail.com"
9 | },
10 | "source": {
11 | "git": "https://github.com/onmyway133/Scale.git",
12 | "tag": "0.1.0"
13 | },
14 | "social_media_url": "https://twitter.com/onmyway133",
15 | "platforms": {
16 | "ios": "8.0"
17 | },
18 | "requires_arc": true,
19 | "source_files": "Pod/Classes/Output/**/*",
20 | "resource_bundles": {
21 | "Scale": [
22 | "Pod/Assets/*.png"
23 | ]
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Scale (0.1.0)
3 |
4 | DEPENDENCIES:
5 | - Scale (from `../`)
6 |
7 | EXTERNAL SOURCES:
8 | Scale:
9 | :path: ../
10 |
11 | SPEC CHECKSUMS:
12 | Scale: 4be55bcccde50a97ada700d17b50943b2503f79c
13 |
14 | COCOAPODS: 0.39.0
15 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Scale.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## Scale
5 |
6 | Copyright (c) 2016 Khoa Pham
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 | Generated by CocoaPods - http://cocoapods.org
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2016 Khoa Pham <onmyway133@gmail.com>
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in
27 | all copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 | Title
38 | Scale
39 | Type
40 | PSGroupSpecifier
41 |
42 |
43 | FooterText
44 | Generated by CocoaPods - http://cocoapods.org
45 | Title
46 |
47 | Type
48 | PSGroupSpecifier
49 |
50 |
51 | StringsTable
52 | Acknowledgements
53 | Title
54 | Acknowledgements
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Scale_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Scale_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
86 | if [[ "$CONFIGURATION" == "Debug" ]]; then
87 | install_framework "Pods-Scale_Example/Scale.framework"
88 | fi
89 | if [[ "$CONFIGURATION" == "Release" ]]; then
90 | install_framework "Pods-Scale_Example/Scale.framework"
91 | fi
92 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | realpath() {
12 | DIRECTORY="$(cd "${1%/*}" && pwd)"
13 | FILENAME="${1##*/}"
14 | echo "$DIRECTORY/$FILENAME"
15 | }
16 |
17 | install_resource()
18 | {
19 | case $1 in
20 | *.storyboard)
21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
23 | ;;
24 | *.xib)
25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
27 | ;;
28 | *.framework)
29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
33 | ;;
34 | *.xcdatamodel)
35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\""
36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom"
37 | ;;
38 | *.xcdatamodeld)
39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
41 | ;;
42 | *.xcmappingmodel)
43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\""
44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
45 | ;;
46 | *.xcassets)
47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
49 | ;;
50 | /*)
51 | echo "$1"
52 | echo "$1" >> "$RESOURCES_TO_COPY"
53 | ;;
54 | *)
55 | echo "${PODS_ROOT}/$1"
56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
57 | ;;
58 | esac
59 | }
60 |
61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
66 | fi
67 | rm -f "$RESOURCES_TO_COPY"
68 |
69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
70 | then
71 | case "${TARGETED_DEVICE_FAMILY}" in
72 | 1,2)
73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
74 | ;;
75 | 1)
76 | TARGET_DEVICE_ARGS="--target-device iphone"
77 | ;;
78 | 2)
79 | TARGET_DEVICE_ARGS="--target-device ipad"
80 | ;;
81 | *)
82 | TARGET_DEVICE_ARGS="--target-device mac"
83 | ;;
84 | esac
85 |
86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
88 | while read line; do
89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
90 | XCASSET_FILES+=("$line")
91 | fi
92 | done <<<"$OTHER_XCASSETS"
93 |
94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
95 | fi
96 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double Pods_Scale_ExampleVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char Pods_Scale_ExampleVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Scale.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "Scale"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Scale_Example
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Scale_Example {
2 | umbrella header "Pods-Scale_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Example/Pods-Scale_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Scale.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "Scale"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Scale_Example
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## Scale
5 |
6 | Copyright (c) 2016 Khoa Pham
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 | Generated by CocoaPods - http://cocoapods.org
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2016 Khoa Pham <onmyway133@gmail.com>
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in
27 | all copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 | Title
38 | Scale
39 | Type
40 | PSGroupSpecifier
41 |
42 |
43 | FooterText
44 | Generated by CocoaPods - http://cocoapods.org
45 | Title
46 |
47 | Type
48 | PSGroupSpecifier
49 |
50 |
51 | StringsTable
52 | Acknowledgements
53 | Title
54 | Acknowledgements
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Scale_Tests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Scale_Tests
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
86 | if [[ "$CONFIGURATION" == "Debug" ]]; then
87 | install_framework "Pods-Scale_Tests/Scale.framework"
88 | fi
89 | if [[ "$CONFIGURATION" == "Release" ]]; then
90 | install_framework "Pods-Scale_Tests/Scale.framework"
91 | fi
92 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | realpath() {
12 | DIRECTORY="$(cd "${1%/*}" && pwd)"
13 | FILENAME="${1##*/}"
14 | echo "$DIRECTORY/$FILENAME"
15 | }
16 |
17 | install_resource()
18 | {
19 | case $1 in
20 | *.storyboard)
21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
23 | ;;
24 | *.xib)
25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
27 | ;;
28 | *.framework)
29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
33 | ;;
34 | *.xcdatamodel)
35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\""
36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom"
37 | ;;
38 | *.xcdatamodeld)
39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
41 | ;;
42 | *.xcmappingmodel)
43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\""
44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
45 | ;;
46 | *.xcassets)
47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
49 | ;;
50 | /*)
51 | echo "$1"
52 | echo "$1" >> "$RESOURCES_TO_COPY"
53 | ;;
54 | *)
55 | echo "${PODS_ROOT}/$1"
56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
57 | ;;
58 | esac
59 | }
60 |
61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
66 | fi
67 | rm -f "$RESOURCES_TO_COPY"
68 |
69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
70 | then
71 | case "${TARGETED_DEVICE_FAMILY}" in
72 | 1,2)
73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
74 | ;;
75 | 1)
76 | TARGET_DEVICE_ARGS="--target-device iphone"
77 | ;;
78 | 2)
79 | TARGET_DEVICE_ARGS="--target-device ipad"
80 | ;;
81 | *)
82 | TARGET_DEVICE_ARGS="--target-device mac"
83 | ;;
84 | esac
85 |
86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
88 | while read line; do
89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
90 | XCASSET_FILES+=("$line")
91 | fi
92 | done <<<"$OTHER_XCASSETS"
93 |
94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
95 | fi
96 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double Pods_Scale_TestsVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char Pods_Scale_TestsVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Scale.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "Scale"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Scale_Tests
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Scale_Tests {
2 | umbrella header "Pods-Scale_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Scale_Tests/Pods-Scale_Tests.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Scale.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "Scale"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Scale_Tests
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Scale-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Scale : NSObject
3 | @end
4 | @implementation PodsDummy_Scale
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Scale-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Scale-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double ScaleVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char ScaleVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Scale.modulemap:
--------------------------------------------------------------------------------
1 | framework module Scale {
2 | umbrella header "Scale-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Scale/Scale.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Scale" "${PODS_ROOT}/Headers/Public"
3 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
4 | PODS_ROOT = ${SRCROOT}
5 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/Example/Scale.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | D5B2E8AA1C3A780C00C0327D /* Scale.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5B2E89F1C3A780C00C0327D /* Scale.framework */; };
11 | D5C6294A1C3A7FAA007F7B7C /* Scale.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C629401C3A7FAA007F7B7C /* Scale.framework */; };
12 | D5C629771C3A878E007F7B7C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C629751C3A878E007F7B7C /* Quick.framework */; };
13 | D5C629781C3A878E007F7B7C /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C629761C3A878E007F7B7C /* Nimble.framework */; };
14 | D5C6297B1C3A879F007F7B7C /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C629791C3A879F007F7B7C /* Quick.framework */; };
15 | D5C6297C1C3A879F007F7B7C /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C6297A1C3A879F007F7B7C /* Nimble.framework */; };
16 | D5C629831C3A892A007F7B7C /* iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629821C3A892A007F7B7C /* iOS.swift */; };
17 | D5C629851C3A893F007F7B7C /* Mac.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629841C3A893F007F7B7C /* Mac.swift */; };
18 | D5C629871C3A89A8007F7B7C /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629861C3A89A8007F7B7C /* Shared.swift */; };
19 | D5C629881C3A89A8007F7B7C /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629861C3A89A8007F7B7C /* Shared.swift */; };
20 | D5C6299B1C3A8BDA007F7B7C /* MacSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629951C3A8BDA007F7B7C /* MacSpec.swift */; };
21 | D5C6299C1C3A8BDA007F7B7C /* SharedSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629971C3A8BDA007F7B7C /* SharedSpec.swift */; };
22 | D5C6299D1C3A8C6B007F7B7C /* iOSSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629931C3A8BDA007F7B7C /* iOSSpec.swift */; };
23 | D5C6299E1C3A8C75007F7B7C /* SharedSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5C629971C3A8BDA007F7B7C /* SharedSpec.swift */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXContainerItemProxy section */
27 | D5B2E8AB1C3A780C00C0327D /* PBXContainerItemProxy */ = {
28 | isa = PBXContainerItemProxy;
29 | containerPortal = D5B2E8961C3A780C00C0327D /* Project object */;
30 | proxyType = 1;
31 | remoteGlobalIDString = D5B2E89E1C3A780C00C0327D;
32 | remoteInfo = Scale;
33 | };
34 | D5C6294B1C3A7FAA007F7B7C /* PBXContainerItemProxy */ = {
35 | isa = PBXContainerItemProxy;
36 | containerPortal = D5B2E8961C3A780C00C0327D /* Project object */;
37 | proxyType = 1;
38 | remoteGlobalIDString = D5C6293F1C3A7FAA007F7B7C;
39 | remoteInfo = "Scale-Mac";
40 | };
41 | /* End PBXContainerItemProxy section */
42 |
43 | /* Begin PBXFileReference section */
44 | D500FD111C3AABED00782D78 /* Playground-iOS.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = "Playground-iOS.playground"; sourceTree = ""; };
45 | D500FD121C3AAC8E00782D78 /* Playground-Mac.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = "Playground-Mac.playground"; sourceTree = ""; };
46 | D5B2E89F1C3A780C00C0327D /* Scale.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scale.framework; sourceTree = BUILT_PRODUCTS_DIR; };
47 | D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Scale-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
48 | D5C629401C3A7FAA007F7B7C /* Scale.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scale.framework; sourceTree = BUILT_PRODUCTS_DIR; };
49 | D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Scale-Mac-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
50 | D5C629751C3A878E007F7B7C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = ""; };
51 | D5C629761C3A878E007F7B7C /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; };
52 | D5C629791C3A879F007F7B7C /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/Mac/Quick.framework; sourceTree = ""; };
53 | D5C6297A1C3A879F007F7B7C /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = ""; };
54 | D5C629821C3A892A007F7B7C /* iOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = iOS.swift; sourceTree = ""; };
55 | D5C629841C3A893F007F7B7C /* Mac.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mac.swift; sourceTree = ""; };
56 | D5C629861C3A89A8007F7B7C /* Shared.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Shared.swift; sourceTree = ""; };
57 | D5C6298B1C3A8BBD007F7B7C /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; };
58 | D5C6298C1C3A8BBD007F7B7C /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Mac.plist"; sourceTree = ""; };
59 | D5C629901C3A8BDA007F7B7C /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; };
60 | D5C629911C3A8BDA007F7B7C /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Mac.plist"; sourceTree = ""; };
61 | D5C629931C3A8BDA007F7B7C /* iOSSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = iOSSpec.swift; sourceTree = ""; };
62 | D5C629951C3A8BDA007F7B7C /* MacSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MacSpec.swift; sourceTree = ""; };
63 | D5C629971C3A8BDA007F7B7C /* SharedSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharedSpec.swift; sourceTree = ""; };
64 | /* End PBXFileReference section */
65 |
66 | /* Begin PBXFrameworksBuildPhase section */
67 | D5B2E89B1C3A780C00C0327D /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | );
72 | runOnlyForDeploymentPostprocessing = 0;
73 | };
74 | D5B2E8A61C3A780C00C0327D /* Frameworks */ = {
75 | isa = PBXFrameworksBuildPhase;
76 | buildActionMask = 2147483647;
77 | files = (
78 | D5C629771C3A878E007F7B7C /* Quick.framework in Frameworks */,
79 | D5C629781C3A878E007F7B7C /* Nimble.framework in Frameworks */,
80 | D5B2E8AA1C3A780C00C0327D /* Scale.framework in Frameworks */,
81 | );
82 | runOnlyForDeploymentPostprocessing = 0;
83 | };
84 | D5C6293C1C3A7FAA007F7B7C /* Frameworks */ = {
85 | isa = PBXFrameworksBuildPhase;
86 | buildActionMask = 2147483647;
87 | files = (
88 | );
89 | runOnlyForDeploymentPostprocessing = 0;
90 | };
91 | D5C629461C3A7FAA007F7B7C /* Frameworks */ = {
92 | isa = PBXFrameworksBuildPhase;
93 | buildActionMask = 2147483647;
94 | files = (
95 | D5C6297B1C3A879F007F7B7C /* Quick.framework in Frameworks */,
96 | D5C6297C1C3A879F007F7B7C /* Nimble.framework in Frameworks */,
97 | D5C6294A1C3A7FAA007F7B7C /* Scale.framework in Frameworks */,
98 | );
99 | runOnlyForDeploymentPostprocessing = 0;
100 | };
101 | /* End PBXFrameworksBuildPhase section */
102 |
103 | /* Begin PBXGroup section */
104 | D5B2E8951C3A780C00C0327D = {
105 | isa = PBXGroup;
106 | children = (
107 | D500FD111C3AABED00782D78 /* Playground-iOS.playground */,
108 | D500FD121C3AAC8E00782D78 /* Playground-Mac.playground */,
109 | D5C629791C3A879F007F7B7C /* Quick.framework */,
110 | D5C6297A1C3A879F007F7B7C /* Nimble.framework */,
111 | D5C629751C3A878E007F7B7C /* Quick.framework */,
112 | D5C629761C3A878E007F7B7C /* Nimble.framework */,
113 | D5C629691C3A809D007F7B7C /* Sources */,
114 | D5C6295C1C3A800E007F7B7C /* Scale */,
115 | D5C6298F1C3A8BDA007F7B7C /* ScaleTests */,
116 | D5B2E8A01C3A780C00C0327D /* Products */,
117 | );
118 | sourceTree = "";
119 | };
120 | D5B2E8A01C3A780C00C0327D /* Products */ = {
121 | isa = PBXGroup;
122 | children = (
123 | D5B2E89F1C3A780C00C0327D /* Scale.framework */,
124 | D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */,
125 | D5C629401C3A7FAA007F7B7C /* Scale.framework */,
126 | D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */,
127 | );
128 | name = Products;
129 | sourceTree = "";
130 | };
131 | D5C6295C1C3A800E007F7B7C /* Scale */ = {
132 | isa = PBXGroup;
133 | children = (
134 | D5C6298B1C3A8BBD007F7B7C /* Info-iOS.plist */,
135 | D5C6298C1C3A8BBD007F7B7C /* Info-Mac.plist */,
136 | );
137 | path = Scale;
138 | sourceTree = "";
139 | };
140 | D5C629691C3A809D007F7B7C /* Sources */ = {
141 | isa = PBXGroup;
142 | children = (
143 | D5C6296A1C3A809D007F7B7C /* iOS */,
144 | D5C6296C1C3A809D007F7B7C /* Mac */,
145 | D5C6296E1C3A809D007F7B7C /* Shared */,
146 | );
147 | path = Sources;
148 | sourceTree = "";
149 | };
150 | D5C6296A1C3A809D007F7B7C /* iOS */ = {
151 | isa = PBXGroup;
152 | children = (
153 | D5C629821C3A892A007F7B7C /* iOS.swift */,
154 | );
155 | path = iOS;
156 | sourceTree = "";
157 | };
158 | D5C6296C1C3A809D007F7B7C /* Mac */ = {
159 | isa = PBXGroup;
160 | children = (
161 | D5C629841C3A893F007F7B7C /* Mac.swift */,
162 | );
163 | path = Mac;
164 | sourceTree = "";
165 | };
166 | D5C6296E1C3A809D007F7B7C /* Shared */ = {
167 | isa = PBXGroup;
168 | children = (
169 | D5C629861C3A89A8007F7B7C /* Shared.swift */,
170 | );
171 | path = Shared;
172 | sourceTree = "";
173 | };
174 | D5C6298F1C3A8BDA007F7B7C /* ScaleTests */ = {
175 | isa = PBXGroup;
176 | children = (
177 | D5C629901C3A8BDA007F7B7C /* Info-iOS.plist */,
178 | D5C629911C3A8BDA007F7B7C /* Info-Mac.plist */,
179 | D5C629921C3A8BDA007F7B7C /* iOS */,
180 | D5C629941C3A8BDA007F7B7C /* Mac */,
181 | D5C629961C3A8BDA007F7B7C /* Shared */,
182 | );
183 | path = ScaleTests;
184 | sourceTree = "";
185 | };
186 | D5C629921C3A8BDA007F7B7C /* iOS */ = {
187 | isa = PBXGroup;
188 | children = (
189 | D5C629931C3A8BDA007F7B7C /* iOSSpec.swift */,
190 | );
191 | path = iOS;
192 | sourceTree = "";
193 | };
194 | D5C629941C3A8BDA007F7B7C /* Mac */ = {
195 | isa = PBXGroup;
196 | children = (
197 | D5C629951C3A8BDA007F7B7C /* MacSpec.swift */,
198 | );
199 | path = Mac;
200 | sourceTree = "";
201 | };
202 | D5C629961C3A8BDA007F7B7C /* Shared */ = {
203 | isa = PBXGroup;
204 | children = (
205 | D5C629971C3A8BDA007F7B7C /* SharedSpec.swift */,
206 | );
207 | path = Shared;
208 | sourceTree = "";
209 | };
210 | /* End PBXGroup section */
211 |
212 | /* Begin PBXHeadersBuildPhase section */
213 | D5B2E89C1C3A780C00C0327D /* Headers */ = {
214 | isa = PBXHeadersBuildPhase;
215 | buildActionMask = 2147483647;
216 | files = (
217 | );
218 | runOnlyForDeploymentPostprocessing = 0;
219 | };
220 | D5C6293D1C3A7FAA007F7B7C /* Headers */ = {
221 | isa = PBXHeadersBuildPhase;
222 | buildActionMask = 2147483647;
223 | files = (
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | };
227 | /* End PBXHeadersBuildPhase section */
228 |
229 | /* Begin PBXNativeTarget section */
230 | D5B2E89E1C3A780C00C0327D /* Scale-iOS */ = {
231 | isa = PBXNativeTarget;
232 | buildConfigurationList = D5B2E8B31C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS" */;
233 | buildPhases = (
234 | D5B2E89A1C3A780C00C0327D /* Sources */,
235 | D5B2E89B1C3A780C00C0327D /* Frameworks */,
236 | D5B2E89C1C3A780C00C0327D /* Headers */,
237 | D5B2E89D1C3A780C00C0327D /* Resources */,
238 | );
239 | buildRules = (
240 | );
241 | dependencies = (
242 | );
243 | name = "Scale-iOS";
244 | productName = Scale;
245 | productReference = D5B2E89F1C3A780C00C0327D /* Scale.framework */;
246 | productType = "com.apple.product-type.framework";
247 | };
248 | D5B2E8A81C3A780C00C0327D /* Scale-iOS-Tests */ = {
249 | isa = PBXNativeTarget;
250 | buildConfigurationList = D5B2E8B61C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS-Tests" */;
251 | buildPhases = (
252 | D5B2E8A51C3A780C00C0327D /* Sources */,
253 | D5B2E8A61C3A780C00C0327D /* Frameworks */,
254 | D5B2E8A71C3A780C00C0327D /* Resources */,
255 | D5C629731C3A86E3007F7B7C /* Copy frameworks with Carthage */,
256 | );
257 | buildRules = (
258 | );
259 | dependencies = (
260 | D5B2E8AC1C3A780C00C0327D /* PBXTargetDependency */,
261 | );
262 | name = "Scale-iOS-Tests";
263 | productName = ScaleTests;
264 | productReference = D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */;
265 | productType = "com.apple.product-type.bundle.unit-test";
266 | };
267 | D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */ = {
268 | isa = PBXNativeTarget;
269 | buildConfigurationList = D5C629511C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac" */;
270 | buildPhases = (
271 | D5C6293B1C3A7FAA007F7B7C /* Sources */,
272 | D5C6293C1C3A7FAA007F7B7C /* Frameworks */,
273 | D5C6293D1C3A7FAA007F7B7C /* Headers */,
274 | D5C6293E1C3A7FAA007F7B7C /* Resources */,
275 | );
276 | buildRules = (
277 | );
278 | dependencies = (
279 | );
280 | name = "Scale-Mac";
281 | productName = "Scale-Mac";
282 | productReference = D5C629401C3A7FAA007F7B7C /* Scale.framework */;
283 | productType = "com.apple.product-type.framework";
284 | };
285 | D5C629481C3A7FAA007F7B7C /* Scale-Mac-Tests */ = {
286 | isa = PBXNativeTarget;
287 | buildConfigurationList = D5C629541C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac-Tests" */;
288 | buildPhases = (
289 | D5C629451C3A7FAA007F7B7C /* Sources */,
290 | D5C629461C3A7FAA007F7B7C /* Frameworks */,
291 | D5C629471C3A7FAA007F7B7C /* Resources */,
292 | D5C629741C3A8717007F7B7C /* Copy frameworks with Carthage */,
293 | );
294 | buildRules = (
295 | );
296 | dependencies = (
297 | D5C6294C1C3A7FAA007F7B7C /* PBXTargetDependency */,
298 | );
299 | name = "Scale-Mac-Tests";
300 | productName = "Scale-MacTests";
301 | productReference = D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */;
302 | productType = "com.apple.product-type.bundle.unit-test";
303 | };
304 | /* End PBXNativeTarget section */
305 |
306 | /* Begin PBXProject section */
307 | D5B2E8961C3A780C00C0327D /* Project object */ = {
308 | isa = PBXProject;
309 | attributes = {
310 | LastSwiftUpdateCheck = 0720;
311 | LastUpgradeCheck = 0720;
312 | ORGANIZATIONNAME = "Khoa Pham";
313 | TargetAttributes = {
314 | D5B2E89E1C3A780C00C0327D = {
315 | CreatedOnToolsVersion = 7.2;
316 | };
317 | D5B2E8A81C3A780C00C0327D = {
318 | CreatedOnToolsVersion = 7.2;
319 | };
320 | D5C6293F1C3A7FAA007F7B7C = {
321 | CreatedOnToolsVersion = 7.2;
322 | };
323 | D5C629481C3A7FAA007F7B7C = {
324 | CreatedOnToolsVersion = 7.2;
325 | };
326 | };
327 | };
328 | buildConfigurationList = D5B2E8991C3A780C00C0327D /* Build configuration list for PBXProject "Scale" */;
329 | compatibilityVersion = "Xcode 3.2";
330 | developmentRegion = English;
331 | hasScannedForEncodings = 0;
332 | knownRegions = (
333 | en,
334 | );
335 | mainGroup = D5B2E8951C3A780C00C0327D;
336 | productRefGroup = D5B2E8A01C3A780C00C0327D /* Products */;
337 | projectDirPath = "";
338 | projectRoot = "";
339 | targets = (
340 | D5B2E89E1C3A780C00C0327D /* Scale-iOS */,
341 | D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */,
342 | D5B2E8A81C3A780C00C0327D /* Scale-iOS-Tests */,
343 | D5C629481C3A7FAA007F7B7C /* Scale-Mac-Tests */,
344 | );
345 | };
346 | /* End PBXProject section */
347 |
348 | /* Begin PBXResourcesBuildPhase section */
349 | D5B2E89D1C3A780C00C0327D /* Resources */ = {
350 | isa = PBXResourcesBuildPhase;
351 | buildActionMask = 2147483647;
352 | files = (
353 | );
354 | runOnlyForDeploymentPostprocessing = 0;
355 | };
356 | D5B2E8A71C3A780C00C0327D /* Resources */ = {
357 | isa = PBXResourcesBuildPhase;
358 | buildActionMask = 2147483647;
359 | files = (
360 | );
361 | runOnlyForDeploymentPostprocessing = 0;
362 | };
363 | D5C6293E1C3A7FAA007F7B7C /* Resources */ = {
364 | isa = PBXResourcesBuildPhase;
365 | buildActionMask = 2147483647;
366 | files = (
367 | );
368 | runOnlyForDeploymentPostprocessing = 0;
369 | };
370 | D5C629471C3A7FAA007F7B7C /* Resources */ = {
371 | isa = PBXResourcesBuildPhase;
372 | buildActionMask = 2147483647;
373 | files = (
374 | );
375 | runOnlyForDeploymentPostprocessing = 0;
376 | };
377 | /* End PBXResourcesBuildPhase section */
378 |
379 | /* Begin PBXShellScriptBuildPhase section */
380 | D5C629731C3A86E3007F7B7C /* Copy frameworks with Carthage */ = {
381 | isa = PBXShellScriptBuildPhase;
382 | buildActionMask = 2147483647;
383 | files = (
384 | );
385 | inputPaths = (
386 | "$(SRCROOT)/Carthage/Build/iOS/Quick.framework",
387 | "$(SRCROOT)/Carthage/Build/iOS/Nimble.framework",
388 | );
389 | name = "Copy frameworks with Carthage";
390 | outputPaths = (
391 | );
392 | runOnlyForDeploymentPostprocessing = 0;
393 | shellPath = /bin/sh;
394 | shellScript = "/usr/local/bin/carthage copy-frameworks";
395 | };
396 | D5C629741C3A8717007F7B7C /* Copy frameworks with Carthage */ = {
397 | isa = PBXShellScriptBuildPhase;
398 | buildActionMask = 2147483647;
399 | files = (
400 | );
401 | inputPaths = (
402 | "$(SRCROOT)/Carthage/Build/Mac/Quick.framework",
403 | "$(SRCROOT)/Carthage/Build/Mac/Nimble.framework",
404 | );
405 | name = "Copy frameworks with Carthage";
406 | outputPaths = (
407 | );
408 | runOnlyForDeploymentPostprocessing = 0;
409 | shellPath = /bin/sh;
410 | shellScript = "/usr/local/bin/carthage copy-frameworks";
411 | };
412 | /* End PBXShellScriptBuildPhase section */
413 |
414 | /* Begin PBXSourcesBuildPhase section */
415 | D5B2E89A1C3A780C00C0327D /* Sources */ = {
416 | isa = PBXSourcesBuildPhase;
417 | buildActionMask = 2147483647;
418 | files = (
419 | D5C629831C3A892A007F7B7C /* iOS.swift in Sources */,
420 | D5C629871C3A89A8007F7B7C /* Shared.swift in Sources */,
421 | );
422 | runOnlyForDeploymentPostprocessing = 0;
423 | };
424 | D5B2E8A51C3A780C00C0327D /* Sources */ = {
425 | isa = PBXSourcesBuildPhase;
426 | buildActionMask = 2147483647;
427 | files = (
428 | D5C6299E1C3A8C75007F7B7C /* SharedSpec.swift in Sources */,
429 | D5C6299D1C3A8C6B007F7B7C /* iOSSpec.swift in Sources */,
430 | );
431 | runOnlyForDeploymentPostprocessing = 0;
432 | };
433 | D5C6293B1C3A7FAA007F7B7C /* Sources */ = {
434 | isa = PBXSourcesBuildPhase;
435 | buildActionMask = 2147483647;
436 | files = (
437 | D5C629851C3A893F007F7B7C /* Mac.swift in Sources */,
438 | D5C629881C3A89A8007F7B7C /* Shared.swift in Sources */,
439 | );
440 | runOnlyForDeploymentPostprocessing = 0;
441 | };
442 | D5C629451C3A7FAA007F7B7C /* Sources */ = {
443 | isa = PBXSourcesBuildPhase;
444 | buildActionMask = 2147483647;
445 | files = (
446 | D5C6299C1C3A8BDA007F7B7C /* SharedSpec.swift in Sources */,
447 | D5C6299B1C3A8BDA007F7B7C /* MacSpec.swift in Sources */,
448 | );
449 | runOnlyForDeploymentPostprocessing = 0;
450 | };
451 | /* End PBXSourcesBuildPhase section */
452 |
453 | /* Begin PBXTargetDependency section */
454 | D5B2E8AC1C3A780C00C0327D /* PBXTargetDependency */ = {
455 | isa = PBXTargetDependency;
456 | target = D5B2E89E1C3A780C00C0327D /* Scale-iOS */;
457 | targetProxy = D5B2E8AB1C3A780C00C0327D /* PBXContainerItemProxy */;
458 | };
459 | D5C6294C1C3A7FAA007F7B7C /* PBXTargetDependency */ = {
460 | isa = PBXTargetDependency;
461 | target = D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */;
462 | targetProxy = D5C6294B1C3A7FAA007F7B7C /* PBXContainerItemProxy */;
463 | };
464 | /* End PBXTargetDependency section */
465 |
466 | /* Begin XCBuildConfiguration section */
467 | D5B2E8B11C3A780C00C0327D /* Debug */ = {
468 | isa = XCBuildConfiguration;
469 | buildSettings = {
470 | ALWAYS_SEARCH_USER_PATHS = NO;
471 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
472 | CLANG_CXX_LIBRARY = "libc++";
473 | CLANG_ENABLE_MODULES = YES;
474 | CLANG_ENABLE_OBJC_ARC = YES;
475 | CLANG_WARN_BOOL_CONVERSION = YES;
476 | CLANG_WARN_CONSTANT_CONVERSION = YES;
477 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
478 | CLANG_WARN_EMPTY_BODY = YES;
479 | CLANG_WARN_ENUM_CONVERSION = YES;
480 | CLANG_WARN_INT_CONVERSION = YES;
481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
482 | CLANG_WARN_UNREACHABLE_CODE = YES;
483 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
484 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
485 | COPY_PHASE_STRIP = NO;
486 | CURRENT_PROJECT_VERSION = 1;
487 | DEBUG_INFORMATION_FORMAT = dwarf;
488 | ENABLE_STRICT_OBJC_MSGSEND = YES;
489 | ENABLE_TESTABILITY = YES;
490 | GCC_C_LANGUAGE_STANDARD = gnu99;
491 | GCC_DYNAMIC_NO_PIC = NO;
492 | GCC_NO_COMMON_BLOCKS = YES;
493 | GCC_OPTIMIZATION_LEVEL = 0;
494 | GCC_PREPROCESSOR_DEFINITIONS = (
495 | "DEBUG=1",
496 | "$(inherited)",
497 | );
498 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
499 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
500 | GCC_WARN_UNDECLARED_SELECTOR = YES;
501 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
502 | GCC_WARN_UNUSED_FUNCTION = YES;
503 | GCC_WARN_UNUSED_VARIABLE = YES;
504 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
505 | MTL_ENABLE_DEBUG_INFO = YES;
506 | ONLY_ACTIVE_ARCH = YES;
507 | SDKROOT = iphoneos;
508 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
509 | TARGETED_DEVICE_FAMILY = "1,2";
510 | VERSIONING_SYSTEM = "apple-generic";
511 | VERSION_INFO_PREFIX = "";
512 | };
513 | name = Debug;
514 | };
515 | D5B2E8B21C3A780C00C0327D /* Release */ = {
516 | isa = XCBuildConfiguration;
517 | buildSettings = {
518 | ALWAYS_SEARCH_USER_PATHS = NO;
519 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
520 | CLANG_CXX_LIBRARY = "libc++";
521 | CLANG_ENABLE_MODULES = YES;
522 | CLANG_ENABLE_OBJC_ARC = YES;
523 | CLANG_WARN_BOOL_CONVERSION = YES;
524 | CLANG_WARN_CONSTANT_CONVERSION = YES;
525 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
526 | CLANG_WARN_EMPTY_BODY = YES;
527 | CLANG_WARN_ENUM_CONVERSION = YES;
528 | CLANG_WARN_INT_CONVERSION = YES;
529 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
530 | CLANG_WARN_UNREACHABLE_CODE = YES;
531 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
532 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
533 | COPY_PHASE_STRIP = NO;
534 | CURRENT_PROJECT_VERSION = 1;
535 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
536 | ENABLE_NS_ASSERTIONS = NO;
537 | ENABLE_STRICT_OBJC_MSGSEND = YES;
538 | GCC_C_LANGUAGE_STANDARD = gnu99;
539 | GCC_NO_COMMON_BLOCKS = YES;
540 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
541 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
542 | GCC_WARN_UNDECLARED_SELECTOR = YES;
543 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
544 | GCC_WARN_UNUSED_FUNCTION = YES;
545 | GCC_WARN_UNUSED_VARIABLE = YES;
546 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
547 | MTL_ENABLE_DEBUG_INFO = NO;
548 | SDKROOT = iphoneos;
549 | TARGETED_DEVICE_FAMILY = "1,2";
550 | VALIDATE_PRODUCT = YES;
551 | VERSIONING_SYSTEM = "apple-generic";
552 | VERSION_INFO_PREFIX = "";
553 | };
554 | name = Release;
555 | };
556 | D5B2E8B41C3A780C00C0327D /* Debug */ = {
557 | isa = XCBuildConfiguration;
558 | buildSettings = {
559 | CLANG_ENABLE_MODULES = YES;
560 | DEFINES_MODULE = YES;
561 | DYLIB_COMPATIBILITY_VERSION = 1;
562 | DYLIB_CURRENT_VERSION = 1;
563 | DYLIB_INSTALL_NAME_BASE = "@rpath";
564 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-iOS.plist";
565 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
566 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
567 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
568 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-iOS";
569 | PRODUCT_NAME = Scale;
570 | SKIP_INSTALL = YES;
571 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
572 | };
573 | name = Debug;
574 | };
575 | D5B2E8B51C3A780C00C0327D /* Release */ = {
576 | isa = XCBuildConfiguration;
577 | buildSettings = {
578 | CLANG_ENABLE_MODULES = YES;
579 | DEFINES_MODULE = YES;
580 | DYLIB_COMPATIBILITY_VERSION = 1;
581 | DYLIB_CURRENT_VERSION = 1;
582 | DYLIB_INSTALL_NAME_BASE = "@rpath";
583 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-iOS.plist";
584 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
585 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
586 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
587 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-iOS";
588 | PRODUCT_NAME = Scale;
589 | SKIP_INSTALL = YES;
590 | };
591 | name = Release;
592 | };
593 | D5B2E8B71C3A780C00C0327D /* Debug */ = {
594 | isa = XCBuildConfiguration;
595 | buildSettings = {
596 | CLANG_ENABLE_MODULES = YES;
597 | FRAMEWORK_SEARCH_PATHS = (
598 | "$(inherited)",
599 | "$(PROJECT_DIR)/Carthage/Build/iOS",
600 | );
601 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-iOS.plist";
602 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
603 | PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ScaleTests;
604 | PRODUCT_NAME = "$(TARGET_NAME)";
605 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
606 | };
607 | name = Debug;
608 | };
609 | D5B2E8B81C3A780C00C0327D /* Release */ = {
610 | isa = XCBuildConfiguration;
611 | buildSettings = {
612 | CLANG_ENABLE_MODULES = YES;
613 | FRAMEWORK_SEARCH_PATHS = (
614 | "$(inherited)",
615 | "$(PROJECT_DIR)/Carthage/Build/iOS",
616 | );
617 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-iOS.plist";
618 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
619 | PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ScaleTests;
620 | PRODUCT_NAME = "$(TARGET_NAME)";
621 | };
622 | name = Release;
623 | };
624 | D5C629521C3A7FAA007F7B7C /* Debug */ = {
625 | isa = XCBuildConfiguration;
626 | buildSettings = {
627 | CLANG_ENABLE_MODULES = YES;
628 | CODE_SIGN_IDENTITY = "-";
629 | COMBINE_HIDPI_IMAGES = YES;
630 | DEFINES_MODULE = YES;
631 | DYLIB_COMPATIBILITY_VERSION = 1;
632 | DYLIB_CURRENT_VERSION = 1;
633 | DYLIB_INSTALL_NAME_BASE = "@rpath";
634 | FRAMEWORK_VERSION = A;
635 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-Mac.plist";
636 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
637 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
638 | MACOSX_DEPLOYMENT_TARGET = 10.9;
639 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-Mac";
640 | PRODUCT_NAME = Scale;
641 | SDKROOT = macosx;
642 | SKIP_INSTALL = YES;
643 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
644 | };
645 | name = Debug;
646 | };
647 | D5C629531C3A7FAA007F7B7C /* Release */ = {
648 | isa = XCBuildConfiguration;
649 | buildSettings = {
650 | CLANG_ENABLE_MODULES = YES;
651 | CODE_SIGN_IDENTITY = "-";
652 | COMBINE_HIDPI_IMAGES = YES;
653 | DEFINES_MODULE = YES;
654 | DYLIB_COMPATIBILITY_VERSION = 1;
655 | DYLIB_CURRENT_VERSION = 1;
656 | DYLIB_INSTALL_NAME_BASE = "@rpath";
657 | FRAMEWORK_VERSION = A;
658 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-Mac.plist";
659 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
660 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
661 | MACOSX_DEPLOYMENT_TARGET = 10.9;
662 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-Mac";
663 | PRODUCT_NAME = Scale;
664 | SDKROOT = macosx;
665 | SKIP_INSTALL = YES;
666 | };
667 | name = Release;
668 | };
669 | D5C629551C3A7FAA007F7B7C /* Debug */ = {
670 | isa = XCBuildConfiguration;
671 | buildSettings = {
672 | CODE_SIGN_IDENTITY = "-";
673 | COMBINE_HIDPI_IMAGES = YES;
674 | FRAMEWORK_SEARCH_PATHS = (
675 | "$(inherited)",
676 | "$(PROJECT_DIR)/Carthage/Build/Mac",
677 | );
678 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-Mac.plist";
679 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
680 | MACOSX_DEPLOYMENT_TARGET = 10.11;
681 | PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Scale-MacTests";
682 | PRODUCT_NAME = "$(TARGET_NAME)";
683 | SDKROOT = macosx;
684 | };
685 | name = Debug;
686 | };
687 | D5C629561C3A7FAA007F7B7C /* Release */ = {
688 | isa = XCBuildConfiguration;
689 | buildSettings = {
690 | CODE_SIGN_IDENTITY = "-";
691 | COMBINE_HIDPI_IMAGES = YES;
692 | FRAMEWORK_SEARCH_PATHS = (
693 | "$(inherited)",
694 | "$(PROJECT_DIR)/Carthage/Build/Mac",
695 | );
696 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-Mac.plist";
697 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
698 | MACOSX_DEPLOYMENT_TARGET = 10.11;
699 | PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Scale-MacTests";
700 | PRODUCT_NAME = "$(TARGET_NAME)";
701 | SDKROOT = macosx;
702 | };
703 | name = Release;
704 | };
705 | /* End XCBuildConfiguration section */
706 |
707 | /* Begin XCConfigurationList section */
708 | D5B2E8991C3A780C00C0327D /* Build configuration list for PBXProject "Scale" */ = {
709 | isa = XCConfigurationList;
710 | buildConfigurations = (
711 | D5B2E8B11C3A780C00C0327D /* Debug */,
712 | D5B2E8B21C3A780C00C0327D /* Release */,
713 | );
714 | defaultConfigurationIsVisible = 0;
715 | defaultConfigurationName = Release;
716 | };
717 | D5B2E8B31C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS" */ = {
718 | isa = XCConfigurationList;
719 | buildConfigurations = (
720 | D5B2E8B41C3A780C00C0327D /* Debug */,
721 | D5B2E8B51C3A780C00C0327D /* Release */,
722 | );
723 | defaultConfigurationIsVisible = 0;
724 | defaultConfigurationName = Release;
725 | };
726 | D5B2E8B61C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS-Tests" */ = {
727 | isa = XCConfigurationList;
728 | buildConfigurations = (
729 | D5B2E8B71C3A780C00C0327D /* Debug */,
730 | D5B2E8B81C3A780C00C0327D /* Release */,
731 | );
732 | defaultConfigurationIsVisible = 0;
733 | defaultConfigurationName = Release;
734 | };
735 | D5C629511C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac" */ = {
736 | isa = XCConfigurationList;
737 | buildConfigurations = (
738 | D5C629521C3A7FAA007F7B7C /* Debug */,
739 | D5C629531C3A7FAA007F7B7C /* Release */,
740 | );
741 | defaultConfigurationIsVisible = 0;
742 | defaultConfigurationName = Release;
743 | };
744 | D5C629541C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac-Tests" */ = {
745 | isa = XCConfigurationList;
746 | buildConfigurations = (
747 | D5C629551C3A7FAA007F7B7C /* Debug */,
748 | D5C629561C3A7FAA007F7B7C /* Release */,
749 | );
750 | defaultConfigurationIsVisible = 0;
751 | defaultConfigurationName = Release;
752 | };
753 | /* End XCConfigurationList section */
754 | };
755 | rootObject = D5B2E8961C3A780C00C0327D /* Project object */;
756 | }
757 |
--------------------------------------------------------------------------------
/Example/Scale.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Scale.xcodeproj/xcshareddata/xcschemes/Scale-Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Example/Scale.xcodeproj/xcshareddata/xcschemes/Scale-iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Example/Scale.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/Scale/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham on 01/06/2016.
6 | // Copyright (c) 2016 Khoa Pham. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Example/Scale/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Example/Scale/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Example/Scale/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Example/Scale/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Example/Scale/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham on 01/06/2016.
6 | // Copyright (c) 2016 Khoa Pham. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Scale
11 |
12 | class ViewController: UIViewController {
13 |
14 | override func viewDidLoad() {
15 | super.viewDidLoad()
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 | }
22 |
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Example/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import XCTest
3 | import Scale
4 |
5 | class Tests: XCTestCase {
6 | func testOperation() {
7 | let angle = 5.degree + 2.radian
8 | XCTAssert(angle.unit == AngleUnit.degree)
9 | XCTAssertEqualWithAccuracy(angle.value, 119.591559, accuracy: 1)
10 |
11 | let area = 5.acre + 2.hectare
12 | XCTAssert(area.unit == AreaUnit.acre)
13 | XCTAssertEqualWithAccuracy(area.value, 9.94210763, accuracy: 1)
14 |
15 | let energy = 5.joule + 2.watthour
16 | XCTAssert(energy.unit == EnergyUnit.joule)
17 | XCTAssertEqualWithAccuracy(energy.value, 7205, accuracy: 0)
18 |
19 | let metric = 5.base + 2.kilo
20 | XCTAssert(metric.unit == MetricUnit.base)
21 | XCTAssertEqualWithAccuracy(metric.value, 2005, accuracy: 0)
22 |
23 | let volume = 5.liter + 2.gallon
24 | XCTAssert(volume.unit == VolumeUnit.liter)
25 | XCTAssertEqualWithAccuracy(volume.value, 12.5708236, accuracy: 1)
26 |
27 | let temperature = 5.fahrenheit + 2.celsius
28 | XCTAssert(temperature.unit == TemperatureUnit.fahrenheit)
29 | XCTAssertEqualWithAccuracy(temperature.value, 40.6, accuracy: 0.001)
30 |
31 | let time = 5.day + 2.hour
32 | XCTAssert(time.unit == TimeUnit.hour)
33 | XCTAssertEqualWithAccuracy(time.value, 122, accuracy: 0)
34 |
35 | let length = 5.yard + 2.meter
36 | XCTAssert(length.unit == LengthUnit.yard)
37 | XCTAssertEqualWithAccuracy(length.value, 7.1872266, accuracy: 1)
38 |
39 | let weight = 5.kilogram + 2.pound
40 | XCTAssert(weight.unit == WeightUnit.pound)
41 | XCTAssertEqualWithAccuracy(weight.value, 13.0231131, accuracy: 1)
42 | }
43 |
44 | func testConverting() {
45 | XCTAssertEqualWithAccuracy(2.hour.to(unit: .week).value, 0.0119048, accuracy: 0.001)
46 | XCTAssertEqualWithAccuracy(2.week.to(unit: .hour).value, 336, accuracy: 0)
47 | }
48 |
49 | func testTemperature() {
50 | XCTAssertEqualWithAccuracy(20.celsius.to(unit: .fahrenheit).value, 68, accuracy: 0)
51 | XCTAssertEqualWithAccuracy(10.celsius.to(unit: .kelvin).value, 283.15, accuracy: 0)
52 | XCTAssertEqualWithAccuracy(68.fahrenheit.to(unit: .celsius).value, 20, accuracy: 0)
53 | XCTAssertEqualWithAccuracy(60.fahrenheit.to(unit: .kelvin).value, 288.71, accuracy: 0.1)
54 | XCTAssertEqualWithAccuracy(300.kelvin.to(unit: .celsius).value, 26.85, accuracy: 0.1)
55 | XCTAssertEqualWithAccuracy(300.kelvin.to(unit: .fahrenheit).value, 80.33, accuracy: 0.1)
56 | XCTAssertEqualWithAccuracy(20.celsius.to(unit: .celsius).value, 20, accuracy: 0)
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Khoa Pham
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Scale
2 |
3 | ❤️ Support my app ❤️
4 |
5 | - [Push Hero - pure Swift native macOS application to test push notifications](https://www.producthunt.com/posts/push-hero-2)
6 | - [PastePal - Pasteboard, note and shortcut manager](https://www.producthunt.com/posts/pastepal)
7 | - [Frame recorder - Recorder gif and video with frame](https://www.producthunt.com/posts/frame-recorder)
8 | - [Alias - App and file shortcut manager](https://www.producthunt.com/posts/alias-shortcut-manager)
9 | - [Other apps](https://onmyway133.github.io/projects/)
10 |
11 | ❤️❤️😇😍🤘❤️❤️
12 |
13 | Unit converter in Swift
14 |
15 | [](https://travis-ci.org/Khoa Pham/Scale)
16 | [](http://cocoapods.org/pods/Scale)
17 | [](http://cocoapods.org/pods/Scale)
18 | [](http://cocoapods.org/pods/Scale)
19 | [](https://github.com/Carthage/Carthage)
20 |
21 |
22 | 
23 |
24 | ## Usage
25 |
26 | To run the example project, clone the repo, and run `pod install` from the Example directory first.
27 |
28 | ## Features
29 |
30 | ### Unit
31 |
32 | - Strongly typed unit
33 | - Division may throw error
34 | - Operation upon same type, the result is the smaller unit of the two
35 |
36 | ```swift
37 | let length = 5.kilometer + 7.meter // 5007 meter
38 | let weight = 10.0.kilogram * 5.gram // 50000 gram
39 | ```
40 |
41 | - Convert to any unit of the same type
42 |
43 | ```swift
44 | 2.week.to(unit: .hour) // 336 hour
45 | ```
46 |
47 | ### Support
48 |
49 | - Angle
50 | ```swift
51 | let angle = 5.degree + 2.radian
52 | ```
53 |
54 | - Area
55 | ```swift
56 | let area = 5.acre + 2.hectare
57 | ```
58 |
59 | - Energy
60 | ```swift
61 | let energy = 5.joule + 2.watthour
62 | ```
63 |
64 | - Metric
65 | ```swift
66 | let metric = 5.base + 2.kilo
67 | ```
68 |
69 | - Volume
70 | ```swift
71 | let volume = 5.liter + 2.gallon
72 | ```
73 |
74 | - Temperature
75 | ```swift
76 | let temperature = 5.fahrenheit + 2.celsius
77 | ```
78 |
79 | - Time
80 | ```swift
81 | let time = 5.day + 2.hour
82 | ```
83 |
84 | - Length
85 | ```swift
86 | let length = 5.yard + 2.meter
87 | ```
88 |
89 | - Weight
90 | ```swift
91 | let weight = 5.kilogram + 2.pound
92 | ```
93 |
94 | ### Add more
95 |
96 | - Add new definition file with extension `.def` inside `Definitions` group
97 | - Run `xcrun swift Script.swift` inside `Script` group
98 | - Add newly generated files into `Output` group, target Scale
99 | - Go into `Example` and `pod install`
100 |
101 | ## Notes
102 |
103 | Some unit types like `Temperature` must be converted manually
104 |
105 | ## Installation
106 |
107 | Scale is available through [CocoaPods](http://cocoapods.org). To install
108 | it, simply add the following line to your Podfile:
109 |
110 | ```ruby
111 | pod "Scale"
112 | ```
113 |
114 | ## Author
115 |
116 | Khoa Pham, onmyway133@gmail.com
117 |
118 | ## License
119 |
120 | Scale is available under the MIT license. See the LICENSE file for more info.
121 |
--------------------------------------------------------------------------------
/Scale.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "Scale"
3 | s.version = "1.1.0"
4 | s.summary = "Unit converter in Swift"
5 | s.homepage = "https://github.com/onmyway133/Scale"
6 | s.license = 'MIT'
7 | s.author = { "Khoa Pham" => "onmyway133@gmail.com" }
8 | s.source = { :git => "https://github.com/onmyway133/Scale.git", :tag => s.version.to_s }
9 | s.social_media_url = 'https://twitter.com/onmyway133'
10 |
11 | s.platform = :ios, '8.0'
12 | s.requires_arc = true
13 |
14 | s.source_files = 'Sources/**/*'
15 | end
16 |
--------------------------------------------------------------------------------
/Scale.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | D23BD8881D4774F300B64022 /* Info-iOS.plist in Resources */ = {isa = PBXBuildFile; fileRef = D23BD8851D4774F300B64022 /* Info-iOS.plist */; };
11 | D23BD8891D4774F300B64022 /* Info-Mac.plist in Resources */ = {isa = PBXBuildFile; fileRef = D23BD8861D4774F300B64022 /* Info-Mac.plist */; };
12 | D25A8C3B1D47748B0008D2F7 /* Angle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C301D47748B0008D2F7 /* Angle.swift */; };
13 | D25A8C3C1D47748B0008D2F7 /* Area.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C311D47748B0008D2F7 /* Area.swift */; };
14 | D25A8C3D1D47748B0008D2F7 /* Energy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C321D47748B0008D2F7 /* Energy.swift */; };
15 | D25A8C3E1D47748B0008D2F7 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C331D47748B0008D2F7 /* Error.swift */; };
16 | D25A8C3F1D47748B0008D2F7 /* Length.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C341D47748B0008D2F7 /* Length.swift */; };
17 | D25A8C401D47748B0008D2F7 /* Metric.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C351D47748B0008D2F7 /* Metric.swift */; };
18 | D25A8C411D47748B0008D2F7 /* Power.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C361D47748B0008D2F7 /* Power.swift */; };
19 | D25A8C421D47748B0008D2F7 /* Temperature.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C371D47748B0008D2F7 /* Temperature.swift */; };
20 | D25A8C431D47748B0008D2F7 /* Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C381D47748B0008D2F7 /* Time.swift */; };
21 | D25A8C441D47748B0008D2F7 /* Volume.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C391D47748B0008D2F7 /* Volume.swift */; };
22 | D25A8C451D47748B0008D2F7 /* Weight.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C3A1D47748B0008D2F7 /* Weight.swift */; };
23 | D25A8C481D4774940008D2F7 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C461D4774910008D2F7 /* Tests.swift */; };
24 | D25A8C491D4774970008D2F7 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C461D4774910008D2F7 /* Tests.swift */; };
25 | D25A8C4A1D47749A0008D2F7 /* Angle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C301D47748B0008D2F7 /* Angle.swift */; };
26 | D25A8C4B1D47749A0008D2F7 /* Area.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C311D47748B0008D2F7 /* Area.swift */; };
27 | D25A8C4C1D47749A0008D2F7 /* Energy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C321D47748B0008D2F7 /* Energy.swift */; };
28 | D25A8C4D1D47749A0008D2F7 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C331D47748B0008D2F7 /* Error.swift */; };
29 | D25A8C4E1D47749A0008D2F7 /* Length.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C341D47748B0008D2F7 /* Length.swift */; };
30 | D25A8C4F1D47749A0008D2F7 /* Metric.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C351D47748B0008D2F7 /* Metric.swift */; };
31 | D25A8C501D47749A0008D2F7 /* Power.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C361D47748B0008D2F7 /* Power.swift */; };
32 | D25A8C511D47749A0008D2F7 /* Temperature.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C371D47748B0008D2F7 /* Temperature.swift */; };
33 | D25A8C521D47749A0008D2F7 /* Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C381D47748B0008D2F7 /* Time.swift */; };
34 | D25A8C531D47749A0008D2F7 /* Volume.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C391D47748B0008D2F7 /* Volume.swift */; };
35 | D25A8C541D47749A0008D2F7 /* Weight.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25A8C3A1D47748B0008D2F7 /* Weight.swift */; };
36 | D5B2E8AA1C3A780C00C0327D /* Scale.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5B2E89F1C3A780C00C0327D /* Scale.framework */; };
37 | D5C6294A1C3A7FAA007F7B7C /* Scale.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5C629401C3A7FAA007F7B7C /* Scale.framework */; };
38 | /* End PBXBuildFile section */
39 |
40 | /* Begin PBXContainerItemProxy section */
41 | D5B2E8AB1C3A780C00C0327D /* PBXContainerItemProxy */ = {
42 | isa = PBXContainerItemProxy;
43 | containerPortal = D5B2E8961C3A780C00C0327D /* Project object */;
44 | proxyType = 1;
45 | remoteGlobalIDString = D5B2E89E1C3A780C00C0327D;
46 | remoteInfo = Scale;
47 | };
48 | D5C6294B1C3A7FAA007F7B7C /* PBXContainerItemProxy */ = {
49 | isa = PBXContainerItemProxy;
50 | containerPortal = D5B2E8961C3A780C00C0327D /* Project object */;
51 | proxyType = 1;
52 | remoteGlobalIDString = D5C6293F1C3A7FAA007F7B7C;
53 | remoteInfo = "Scale-Mac";
54 | };
55 | /* End PBXContainerItemProxy section */
56 |
57 | /* Begin PBXFileReference section */
58 | D23BD8851D4774F300B64022 /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; };
59 | D23BD8861D4774F300B64022 /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Mac.plist"; sourceTree = ""; };
60 | D25A8C301D47748B0008D2F7 /* Angle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Angle.swift; sourceTree = ""; };
61 | D25A8C311D47748B0008D2F7 /* Area.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Area.swift; sourceTree = ""; };
62 | D25A8C321D47748B0008D2F7 /* Energy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Energy.swift; sourceTree = ""; };
63 | D25A8C331D47748B0008D2F7 /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = ""; };
64 | D25A8C341D47748B0008D2F7 /* Length.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Length.swift; sourceTree = ""; };
65 | D25A8C351D47748B0008D2F7 /* Metric.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Metric.swift; sourceTree = ""; };
66 | D25A8C361D47748B0008D2F7 /* Power.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Power.swift; sourceTree = ""; };
67 | D25A8C371D47748B0008D2F7 /* Temperature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Temperature.swift; sourceTree = ""; };
68 | D25A8C381D47748B0008D2F7 /* Time.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Time.swift; sourceTree = ""; };
69 | D25A8C391D47748B0008D2F7 /* Volume.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Volume.swift; sourceTree = ""; };
70 | D25A8C3A1D47748B0008D2F7 /* Weight.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Weight.swift; sourceTree = ""; };
71 | D25A8C461D4774910008D2F7 /* Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; };
72 | D5B2E89F1C3A780C00C0327D /* Scale.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scale.framework; sourceTree = BUILT_PRODUCTS_DIR; };
73 | D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Scale-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
74 | D5C629401C3A7FAA007F7B7C /* Scale.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scale.framework; sourceTree = BUILT_PRODUCTS_DIR; };
75 | D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Scale-Mac-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
76 | D5C629901C3A8BDA007F7B7C /* Info-iOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = ""; };
77 | D5C629911C3A8BDA007F7B7C /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Mac.plist"; sourceTree = ""; };
78 | /* End PBXFileReference section */
79 |
80 | /* Begin PBXFrameworksBuildPhase section */
81 | D5B2E89B1C3A780C00C0327D /* Frameworks */ = {
82 | isa = PBXFrameworksBuildPhase;
83 | buildActionMask = 2147483647;
84 | files = (
85 | );
86 | runOnlyForDeploymentPostprocessing = 0;
87 | };
88 | D5B2E8A61C3A780C00C0327D /* Frameworks */ = {
89 | isa = PBXFrameworksBuildPhase;
90 | buildActionMask = 2147483647;
91 | files = (
92 | D5B2E8AA1C3A780C00C0327D /* Scale.framework in Frameworks */,
93 | );
94 | runOnlyForDeploymentPostprocessing = 0;
95 | };
96 | D5C6293C1C3A7FAA007F7B7C /* Frameworks */ = {
97 | isa = PBXFrameworksBuildPhase;
98 | buildActionMask = 2147483647;
99 | files = (
100 | );
101 | runOnlyForDeploymentPostprocessing = 0;
102 | };
103 | D5C629461C3A7FAA007F7B7C /* Frameworks */ = {
104 | isa = PBXFrameworksBuildPhase;
105 | buildActionMask = 2147483647;
106 | files = (
107 | D5C6294A1C3A7FAA007F7B7C /* Scale.framework in Frameworks */,
108 | );
109 | runOnlyForDeploymentPostprocessing = 0;
110 | };
111 | /* End PBXFrameworksBuildPhase section */
112 |
113 | /* Begin PBXGroup section */
114 | D23BD8841D4774F300B64022 /* Scale */ = {
115 | isa = PBXGroup;
116 | children = (
117 | D23BD8851D4774F300B64022 /* Info-iOS.plist */,
118 | D23BD8861D4774F300B64022 /* Info-Mac.plist */,
119 | );
120 | path = Scale;
121 | sourceTree = "";
122 | };
123 | D25A8C2F1D47748B0008D2F7 /* Sources */ = {
124 | isa = PBXGroup;
125 | children = (
126 | D25A8C301D47748B0008D2F7 /* Angle.swift */,
127 | D25A8C311D47748B0008D2F7 /* Area.swift */,
128 | D25A8C321D47748B0008D2F7 /* Energy.swift */,
129 | D25A8C331D47748B0008D2F7 /* Error.swift */,
130 | D25A8C341D47748B0008D2F7 /* Length.swift */,
131 | D25A8C351D47748B0008D2F7 /* Metric.swift */,
132 | D25A8C361D47748B0008D2F7 /* Power.swift */,
133 | D25A8C371D47748B0008D2F7 /* Temperature.swift */,
134 | D25A8C381D47748B0008D2F7 /* Time.swift */,
135 | D25A8C391D47748B0008D2F7 /* Volume.swift */,
136 | D25A8C3A1D47748B0008D2F7 /* Weight.swift */,
137 | );
138 | path = Sources;
139 | sourceTree = "";
140 | };
141 | D5B2E8951C3A780C00C0327D = {
142 | isa = PBXGroup;
143 | children = (
144 | D23BD8841D4774F300B64022 /* Scale */,
145 | D25A8C2F1D47748B0008D2F7 /* Sources */,
146 | D5C6298F1C3A8BDA007F7B7C /* ScaleTests */,
147 | D5B2E8A01C3A780C00C0327D /* Products */,
148 | );
149 | sourceTree = "";
150 | };
151 | D5B2E8A01C3A780C00C0327D /* Products */ = {
152 | isa = PBXGroup;
153 | children = (
154 | D5B2E89F1C3A780C00C0327D /* Scale.framework */,
155 | D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */,
156 | D5C629401C3A7FAA007F7B7C /* Scale.framework */,
157 | D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */,
158 | );
159 | name = Products;
160 | sourceTree = "";
161 | };
162 | D5C6298F1C3A8BDA007F7B7C /* ScaleTests */ = {
163 | isa = PBXGroup;
164 | children = (
165 | D25A8C461D4774910008D2F7 /* Tests.swift */,
166 | D5C629901C3A8BDA007F7B7C /* Info-iOS.plist */,
167 | D5C629911C3A8BDA007F7B7C /* Info-Mac.plist */,
168 | );
169 | path = ScaleTests;
170 | sourceTree = "";
171 | };
172 | /* End PBXGroup section */
173 |
174 | /* Begin PBXHeadersBuildPhase section */
175 | D5B2E89C1C3A780C00C0327D /* Headers */ = {
176 | isa = PBXHeadersBuildPhase;
177 | buildActionMask = 2147483647;
178 | files = (
179 | );
180 | runOnlyForDeploymentPostprocessing = 0;
181 | };
182 | D5C6293D1C3A7FAA007F7B7C /* Headers */ = {
183 | isa = PBXHeadersBuildPhase;
184 | buildActionMask = 2147483647;
185 | files = (
186 | );
187 | runOnlyForDeploymentPostprocessing = 0;
188 | };
189 | /* End PBXHeadersBuildPhase section */
190 |
191 | /* Begin PBXNativeTarget section */
192 | D5B2E89E1C3A780C00C0327D /* Scale-iOS */ = {
193 | isa = PBXNativeTarget;
194 | buildConfigurationList = D5B2E8B31C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS" */;
195 | buildPhases = (
196 | D5B2E89A1C3A780C00C0327D /* Sources */,
197 | D5B2E89B1C3A780C00C0327D /* Frameworks */,
198 | D5B2E89C1C3A780C00C0327D /* Headers */,
199 | D5B2E89D1C3A780C00C0327D /* Resources */,
200 | );
201 | buildRules = (
202 | );
203 | dependencies = (
204 | );
205 | name = "Scale-iOS";
206 | productName = Scale;
207 | productReference = D5B2E89F1C3A780C00C0327D /* Scale.framework */;
208 | productType = "com.apple.product-type.framework";
209 | };
210 | D5B2E8A81C3A780C00C0327D /* Scale-iOS-Tests */ = {
211 | isa = PBXNativeTarget;
212 | buildConfigurationList = D5B2E8B61C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS-Tests" */;
213 | buildPhases = (
214 | D5B2E8A51C3A780C00C0327D /* Sources */,
215 | D5B2E8A61C3A780C00C0327D /* Frameworks */,
216 | D5B2E8A71C3A780C00C0327D /* Resources */,
217 | );
218 | buildRules = (
219 | );
220 | dependencies = (
221 | D5B2E8AC1C3A780C00C0327D /* PBXTargetDependency */,
222 | );
223 | name = "Scale-iOS-Tests";
224 | productName = ScaleTests;
225 | productReference = D5B2E8A91C3A780C00C0327D /* Scale-iOS-Tests.xctest */;
226 | productType = "com.apple.product-type.bundle.unit-test";
227 | };
228 | D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */ = {
229 | isa = PBXNativeTarget;
230 | buildConfigurationList = D5C629511C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac" */;
231 | buildPhases = (
232 | D5C6293B1C3A7FAA007F7B7C /* Sources */,
233 | D5C6293C1C3A7FAA007F7B7C /* Frameworks */,
234 | D5C6293D1C3A7FAA007F7B7C /* Headers */,
235 | D5C6293E1C3A7FAA007F7B7C /* Resources */,
236 | );
237 | buildRules = (
238 | );
239 | dependencies = (
240 | );
241 | name = "Scale-Mac";
242 | productName = "Scale-Mac";
243 | productReference = D5C629401C3A7FAA007F7B7C /* Scale.framework */;
244 | productType = "com.apple.product-type.framework";
245 | };
246 | D5C629481C3A7FAA007F7B7C /* Scale-Mac-Tests */ = {
247 | isa = PBXNativeTarget;
248 | buildConfigurationList = D5C629541C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac-Tests" */;
249 | buildPhases = (
250 | D5C629451C3A7FAA007F7B7C /* Sources */,
251 | D5C629461C3A7FAA007F7B7C /* Frameworks */,
252 | D5C629471C3A7FAA007F7B7C /* Resources */,
253 | );
254 | buildRules = (
255 | );
256 | dependencies = (
257 | D5C6294C1C3A7FAA007F7B7C /* PBXTargetDependency */,
258 | );
259 | name = "Scale-Mac-Tests";
260 | productName = "Scale-MacTests";
261 | productReference = D5C629491C3A7FAA007F7B7C /* Scale-Mac-Tests.xctest */;
262 | productType = "com.apple.product-type.bundle.unit-test";
263 | };
264 | /* End PBXNativeTarget section */
265 |
266 | /* Begin PBXProject section */
267 | D5B2E8961C3A780C00C0327D /* Project object */ = {
268 | isa = PBXProject;
269 | attributes = {
270 | LastSwiftUpdateCheck = 0720;
271 | LastUpgradeCheck = 0800;
272 | ORGANIZATIONNAME = "Khoa Pham";
273 | TargetAttributes = {
274 | D5B2E89E1C3A780C00C0327D = {
275 | CreatedOnToolsVersion = 7.2;
276 | LastSwiftMigration = 0800;
277 | };
278 | D5B2E8A81C3A780C00C0327D = {
279 | CreatedOnToolsVersion = 7.2;
280 | LastSwiftMigration = 0800;
281 | };
282 | D5C6293F1C3A7FAA007F7B7C = {
283 | CreatedOnToolsVersion = 7.2;
284 | };
285 | D5C629481C3A7FAA007F7B7C = {
286 | CreatedOnToolsVersion = 7.2;
287 | };
288 | };
289 | };
290 | buildConfigurationList = D5B2E8991C3A780C00C0327D /* Build configuration list for PBXProject "Scale" */;
291 | compatibilityVersion = "Xcode 3.2";
292 | developmentRegion = English;
293 | hasScannedForEncodings = 0;
294 | knownRegions = (
295 | en,
296 | );
297 | mainGroup = D5B2E8951C3A780C00C0327D;
298 | productRefGroup = D5B2E8A01C3A780C00C0327D /* Products */;
299 | projectDirPath = "";
300 | projectRoot = "";
301 | targets = (
302 | D5B2E89E1C3A780C00C0327D /* Scale-iOS */,
303 | D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */,
304 | D5B2E8A81C3A780C00C0327D /* Scale-iOS-Tests */,
305 | D5C629481C3A7FAA007F7B7C /* Scale-Mac-Tests */,
306 | );
307 | };
308 | /* End PBXProject section */
309 |
310 | /* Begin PBXResourcesBuildPhase section */
311 | D5B2E89D1C3A780C00C0327D /* Resources */ = {
312 | isa = PBXResourcesBuildPhase;
313 | buildActionMask = 2147483647;
314 | files = (
315 | D23BD8891D4774F300B64022 /* Info-Mac.plist in Resources */,
316 | );
317 | runOnlyForDeploymentPostprocessing = 0;
318 | };
319 | D5B2E8A71C3A780C00C0327D /* Resources */ = {
320 | isa = PBXResourcesBuildPhase;
321 | buildActionMask = 2147483647;
322 | files = (
323 | );
324 | runOnlyForDeploymentPostprocessing = 0;
325 | };
326 | D5C6293E1C3A7FAA007F7B7C /* Resources */ = {
327 | isa = PBXResourcesBuildPhase;
328 | buildActionMask = 2147483647;
329 | files = (
330 | D23BD8881D4774F300B64022 /* Info-iOS.plist in Resources */,
331 | );
332 | runOnlyForDeploymentPostprocessing = 0;
333 | };
334 | D5C629471C3A7FAA007F7B7C /* Resources */ = {
335 | isa = PBXResourcesBuildPhase;
336 | buildActionMask = 2147483647;
337 | files = (
338 | );
339 | runOnlyForDeploymentPostprocessing = 0;
340 | };
341 | /* End PBXResourcesBuildPhase section */
342 |
343 | /* Begin PBXSourcesBuildPhase section */
344 | D5B2E89A1C3A780C00C0327D /* Sources */ = {
345 | isa = PBXSourcesBuildPhase;
346 | buildActionMask = 2147483647;
347 | files = (
348 | D25A8C3E1D47748B0008D2F7 /* Error.swift in Sources */,
349 | D25A8C451D47748B0008D2F7 /* Weight.swift in Sources */,
350 | D25A8C3C1D47748B0008D2F7 /* Area.swift in Sources */,
351 | D25A8C421D47748B0008D2F7 /* Temperature.swift in Sources */,
352 | D25A8C3F1D47748B0008D2F7 /* Length.swift in Sources */,
353 | D25A8C401D47748B0008D2F7 /* Metric.swift in Sources */,
354 | D25A8C441D47748B0008D2F7 /* Volume.swift in Sources */,
355 | D25A8C3D1D47748B0008D2F7 /* Energy.swift in Sources */,
356 | D25A8C431D47748B0008D2F7 /* Time.swift in Sources */,
357 | D25A8C411D47748B0008D2F7 /* Power.swift in Sources */,
358 | D25A8C3B1D47748B0008D2F7 /* Angle.swift in Sources */,
359 | );
360 | runOnlyForDeploymentPostprocessing = 0;
361 | };
362 | D5B2E8A51C3A780C00C0327D /* Sources */ = {
363 | isa = PBXSourcesBuildPhase;
364 | buildActionMask = 2147483647;
365 | files = (
366 | D25A8C481D4774940008D2F7 /* Tests.swift in Sources */,
367 | );
368 | runOnlyForDeploymentPostprocessing = 0;
369 | };
370 | D5C6293B1C3A7FAA007F7B7C /* Sources */ = {
371 | isa = PBXSourcesBuildPhase;
372 | buildActionMask = 2147483647;
373 | files = (
374 | D25A8C4D1D47749A0008D2F7 /* Error.swift in Sources */,
375 | D25A8C541D47749A0008D2F7 /* Weight.swift in Sources */,
376 | D25A8C4B1D47749A0008D2F7 /* Area.swift in Sources */,
377 | D25A8C511D47749A0008D2F7 /* Temperature.swift in Sources */,
378 | D25A8C4E1D47749A0008D2F7 /* Length.swift in Sources */,
379 | D25A8C4F1D47749A0008D2F7 /* Metric.swift in Sources */,
380 | D25A8C531D47749A0008D2F7 /* Volume.swift in Sources */,
381 | D25A8C4C1D47749A0008D2F7 /* Energy.swift in Sources */,
382 | D25A8C521D47749A0008D2F7 /* Time.swift in Sources */,
383 | D25A8C501D47749A0008D2F7 /* Power.swift in Sources */,
384 | D25A8C4A1D47749A0008D2F7 /* Angle.swift in Sources */,
385 | );
386 | runOnlyForDeploymentPostprocessing = 0;
387 | };
388 | D5C629451C3A7FAA007F7B7C /* Sources */ = {
389 | isa = PBXSourcesBuildPhase;
390 | buildActionMask = 2147483647;
391 | files = (
392 | D25A8C491D4774970008D2F7 /* Tests.swift in Sources */,
393 | );
394 | runOnlyForDeploymentPostprocessing = 0;
395 | };
396 | /* End PBXSourcesBuildPhase section */
397 |
398 | /* Begin PBXTargetDependency section */
399 | D5B2E8AC1C3A780C00C0327D /* PBXTargetDependency */ = {
400 | isa = PBXTargetDependency;
401 | target = D5B2E89E1C3A780C00C0327D /* Scale-iOS */;
402 | targetProxy = D5B2E8AB1C3A780C00C0327D /* PBXContainerItemProxy */;
403 | };
404 | D5C6294C1C3A7FAA007F7B7C /* PBXTargetDependency */ = {
405 | isa = PBXTargetDependency;
406 | target = D5C6293F1C3A7FAA007F7B7C /* Scale-Mac */;
407 | targetProxy = D5C6294B1C3A7FAA007F7B7C /* PBXContainerItemProxy */;
408 | };
409 | /* End PBXTargetDependency section */
410 |
411 | /* Begin XCBuildConfiguration section */
412 | D5B2E8B11C3A780C00C0327D /* Debug */ = {
413 | isa = XCBuildConfiguration;
414 | buildSettings = {
415 | ALWAYS_SEARCH_USER_PATHS = NO;
416 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
417 | CLANG_CXX_LIBRARY = "libc++";
418 | CLANG_ENABLE_MODULES = YES;
419 | CLANG_ENABLE_OBJC_ARC = YES;
420 | CLANG_WARN_BOOL_CONVERSION = YES;
421 | CLANG_WARN_CONSTANT_CONVERSION = YES;
422 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
423 | CLANG_WARN_EMPTY_BODY = YES;
424 | CLANG_WARN_ENUM_CONVERSION = YES;
425 | CLANG_WARN_INFINITE_RECURSION = YES;
426 | CLANG_WARN_INT_CONVERSION = YES;
427 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
428 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
429 | CLANG_WARN_UNREACHABLE_CODE = YES;
430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
432 | COPY_PHASE_STRIP = NO;
433 | CURRENT_PROJECT_VERSION = 1;
434 | DEBUG_INFORMATION_FORMAT = dwarf;
435 | ENABLE_STRICT_OBJC_MSGSEND = YES;
436 | ENABLE_TESTABILITY = YES;
437 | GCC_C_LANGUAGE_STANDARD = gnu99;
438 | GCC_DYNAMIC_NO_PIC = NO;
439 | GCC_NO_COMMON_BLOCKS = YES;
440 | GCC_OPTIMIZATION_LEVEL = 0;
441 | GCC_PREPROCESSOR_DEFINITIONS = (
442 | "DEBUG=1",
443 | "$(inherited)",
444 | );
445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
447 | GCC_WARN_UNDECLARED_SELECTOR = YES;
448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
449 | GCC_WARN_UNUSED_FUNCTION = YES;
450 | GCC_WARN_UNUSED_VARIABLE = YES;
451 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
452 | MTL_ENABLE_DEBUG_INFO = YES;
453 | ONLY_ACTIVE_ARCH = YES;
454 | SDKROOT = iphoneos;
455 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
456 | TARGETED_DEVICE_FAMILY = "1,2";
457 | VERSIONING_SYSTEM = "apple-generic";
458 | VERSION_INFO_PREFIX = "";
459 | };
460 | name = Debug;
461 | };
462 | D5B2E8B21C3A780C00C0327D /* Release */ = {
463 | isa = XCBuildConfiguration;
464 | buildSettings = {
465 | ALWAYS_SEARCH_USER_PATHS = NO;
466 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
467 | CLANG_CXX_LIBRARY = "libc++";
468 | CLANG_ENABLE_MODULES = YES;
469 | CLANG_ENABLE_OBJC_ARC = YES;
470 | CLANG_WARN_BOOL_CONVERSION = YES;
471 | CLANG_WARN_CONSTANT_CONVERSION = YES;
472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
473 | CLANG_WARN_EMPTY_BODY = YES;
474 | CLANG_WARN_ENUM_CONVERSION = YES;
475 | CLANG_WARN_INFINITE_RECURSION = YES;
476 | CLANG_WARN_INT_CONVERSION = YES;
477 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
478 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
479 | CLANG_WARN_UNREACHABLE_CODE = YES;
480 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
481 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
482 | COPY_PHASE_STRIP = NO;
483 | CURRENT_PROJECT_VERSION = 1;
484 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
485 | ENABLE_NS_ASSERTIONS = NO;
486 | ENABLE_STRICT_OBJC_MSGSEND = YES;
487 | GCC_C_LANGUAGE_STANDARD = gnu99;
488 | GCC_NO_COMMON_BLOCKS = YES;
489 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
490 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
491 | GCC_WARN_UNDECLARED_SELECTOR = YES;
492 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
493 | GCC_WARN_UNUSED_FUNCTION = YES;
494 | GCC_WARN_UNUSED_VARIABLE = YES;
495 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
496 | MTL_ENABLE_DEBUG_INFO = NO;
497 | SDKROOT = iphoneos;
498 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
499 | TARGETED_DEVICE_FAMILY = "1,2";
500 | VALIDATE_PRODUCT = YES;
501 | VERSIONING_SYSTEM = "apple-generic";
502 | VERSION_INFO_PREFIX = "";
503 | };
504 | name = Release;
505 | };
506 | D5B2E8B41C3A780C00C0327D /* Debug */ = {
507 | isa = XCBuildConfiguration;
508 | buildSettings = {
509 | CLANG_ENABLE_MODULES = YES;
510 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
511 | DEFINES_MODULE = YES;
512 | DYLIB_COMPATIBILITY_VERSION = 1;
513 | DYLIB_CURRENT_VERSION = 1;
514 | DYLIB_INSTALL_NAME_BASE = "@rpath";
515 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-iOS.plist";
516 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
517 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
519 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-iOS";
520 | PRODUCT_NAME = Scale;
521 | SKIP_INSTALL = YES;
522 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
523 | SWIFT_VERSION = 3.0;
524 | };
525 | name = Debug;
526 | };
527 | D5B2E8B51C3A780C00C0327D /* Release */ = {
528 | isa = XCBuildConfiguration;
529 | buildSettings = {
530 | CLANG_ENABLE_MODULES = YES;
531 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
532 | DEFINES_MODULE = YES;
533 | DYLIB_COMPATIBILITY_VERSION = 1;
534 | DYLIB_CURRENT_VERSION = 1;
535 | DYLIB_INSTALL_NAME_BASE = "@rpath";
536 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-iOS.plist";
537 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
538 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
539 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
540 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-iOS";
541 | PRODUCT_NAME = Scale;
542 | SKIP_INSTALL = YES;
543 | SWIFT_VERSION = 3.0;
544 | };
545 | name = Release;
546 | };
547 | D5B2E8B71C3A780C00C0327D /* Debug */ = {
548 | isa = XCBuildConfiguration;
549 | buildSettings = {
550 | CLANG_ENABLE_MODULES = YES;
551 | FRAMEWORK_SEARCH_PATHS = (
552 | "$(inherited)",
553 | "$(PROJECT_DIR)/Carthage/Build/iOS",
554 | );
555 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-iOS.plist";
556 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
557 | PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ScaleTests;
558 | PRODUCT_NAME = "$(TARGET_NAME)";
559 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
560 | SWIFT_VERSION = 3.0;
561 | };
562 | name = Debug;
563 | };
564 | D5B2E8B81C3A780C00C0327D /* Release */ = {
565 | isa = XCBuildConfiguration;
566 | buildSettings = {
567 | CLANG_ENABLE_MODULES = YES;
568 | FRAMEWORK_SEARCH_PATHS = (
569 | "$(inherited)",
570 | "$(PROJECT_DIR)/Carthage/Build/iOS",
571 | );
572 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-iOS.plist";
573 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
574 | PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ScaleTests;
575 | PRODUCT_NAME = "$(TARGET_NAME)";
576 | SWIFT_VERSION = 3.0;
577 | };
578 | name = Release;
579 | };
580 | D5C629521C3A7FAA007F7B7C /* Debug */ = {
581 | isa = XCBuildConfiguration;
582 | buildSettings = {
583 | CLANG_ENABLE_MODULES = YES;
584 | CODE_SIGN_IDENTITY = "";
585 | COMBINE_HIDPI_IMAGES = YES;
586 | DEFINES_MODULE = YES;
587 | DYLIB_COMPATIBILITY_VERSION = 1;
588 | DYLIB_CURRENT_VERSION = 1;
589 | DYLIB_INSTALL_NAME_BASE = "@rpath";
590 | FRAMEWORK_VERSION = A;
591 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-Mac.plist";
592 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
593 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
594 | MACOSX_DEPLOYMENT_TARGET = 10.9;
595 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-Mac";
596 | PRODUCT_NAME = Scale;
597 | SDKROOT = macosx;
598 | SKIP_INSTALL = YES;
599 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
600 | };
601 | name = Debug;
602 | };
603 | D5C629531C3A7FAA007F7B7C /* Release */ = {
604 | isa = XCBuildConfiguration;
605 | buildSettings = {
606 | CLANG_ENABLE_MODULES = YES;
607 | CODE_SIGN_IDENTITY = "";
608 | COMBINE_HIDPI_IMAGES = YES;
609 | DEFINES_MODULE = YES;
610 | DYLIB_COMPATIBILITY_VERSION = 1;
611 | DYLIB_CURRENT_VERSION = 1;
612 | DYLIB_INSTALL_NAME_BASE = "@rpath";
613 | FRAMEWORK_VERSION = A;
614 | INFOPLIST_FILE = "$(SRCROOT)/Scale/Info-Mac.plist";
615 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
616 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
617 | MACOSX_DEPLOYMENT_TARGET = 10.9;
618 | PRODUCT_BUNDLE_IDENTIFIER = "com.fantageek.Scale-Mac";
619 | PRODUCT_NAME = Scale;
620 | SDKROOT = macosx;
621 | SKIP_INSTALL = YES;
622 | };
623 | name = Release;
624 | };
625 | D5C629551C3A7FAA007F7B7C /* Debug */ = {
626 | isa = XCBuildConfiguration;
627 | buildSettings = {
628 | CODE_SIGN_IDENTITY = "-";
629 | COMBINE_HIDPI_IMAGES = YES;
630 | FRAMEWORK_SEARCH_PATHS = (
631 | "$(inherited)",
632 | "$(PROJECT_DIR)/Carthage/Build/Mac",
633 | );
634 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-Mac.plist";
635 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
636 | MACOSX_DEPLOYMENT_TARGET = 10.11;
637 | PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Scale-MacTests";
638 | PRODUCT_NAME = "$(TARGET_NAME)";
639 | SDKROOT = macosx;
640 | };
641 | name = Debug;
642 | };
643 | D5C629561C3A7FAA007F7B7C /* Release */ = {
644 | isa = XCBuildConfiguration;
645 | buildSettings = {
646 | CODE_SIGN_IDENTITY = "-";
647 | COMBINE_HIDPI_IMAGES = YES;
648 | FRAMEWORK_SEARCH_PATHS = (
649 | "$(inherited)",
650 | "$(PROJECT_DIR)/Carthage/Build/Mac",
651 | );
652 | INFOPLIST_FILE = "$(SRCROOT)/ScaleTests/Info-Mac.plist";
653 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
654 | MACOSX_DEPLOYMENT_TARGET = 10.11;
655 | PRODUCT_BUNDLE_IDENTIFIER = "no.hyper.Scale-MacTests";
656 | PRODUCT_NAME = "$(TARGET_NAME)";
657 | SDKROOT = macosx;
658 | };
659 | name = Release;
660 | };
661 | /* End XCBuildConfiguration section */
662 |
663 | /* Begin XCConfigurationList section */
664 | D5B2E8991C3A780C00C0327D /* Build configuration list for PBXProject "Scale" */ = {
665 | isa = XCConfigurationList;
666 | buildConfigurations = (
667 | D5B2E8B11C3A780C00C0327D /* Debug */,
668 | D5B2E8B21C3A780C00C0327D /* Release */,
669 | );
670 | defaultConfigurationIsVisible = 0;
671 | defaultConfigurationName = Release;
672 | };
673 | D5B2E8B31C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS" */ = {
674 | isa = XCConfigurationList;
675 | buildConfigurations = (
676 | D5B2E8B41C3A780C00C0327D /* Debug */,
677 | D5B2E8B51C3A780C00C0327D /* Release */,
678 | );
679 | defaultConfigurationIsVisible = 0;
680 | defaultConfigurationName = Release;
681 | };
682 | D5B2E8B61C3A780C00C0327D /* Build configuration list for PBXNativeTarget "Scale-iOS-Tests" */ = {
683 | isa = XCConfigurationList;
684 | buildConfigurations = (
685 | D5B2E8B71C3A780C00C0327D /* Debug */,
686 | D5B2E8B81C3A780C00C0327D /* Release */,
687 | );
688 | defaultConfigurationIsVisible = 0;
689 | defaultConfigurationName = Release;
690 | };
691 | D5C629511C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac" */ = {
692 | isa = XCConfigurationList;
693 | buildConfigurations = (
694 | D5C629521C3A7FAA007F7B7C /* Debug */,
695 | D5C629531C3A7FAA007F7B7C /* Release */,
696 | );
697 | defaultConfigurationIsVisible = 0;
698 | defaultConfigurationName = Release;
699 | };
700 | D5C629541C3A7FAA007F7B7C /* Build configuration list for PBXNativeTarget "Scale-Mac-Tests" */ = {
701 | isa = XCConfigurationList;
702 | buildConfigurations = (
703 | D5C629551C3A7FAA007F7B7C /* Debug */,
704 | D5C629561C3A7FAA007F7B7C /* Release */,
705 | );
706 | defaultConfigurationIsVisible = 0;
707 | defaultConfigurationName = Release;
708 | };
709 | /* End XCConfigurationList section */
710 | };
711 | rootObject = D5B2E8961C3A780C00C0327D /* Project object */;
712 | }
713 |
--------------------------------------------------------------------------------
/Scale.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Scale.xcodeproj/xcshareddata/xcschemes/Scale-Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Scale.xcodeproj/xcshareddata/xcschemes/Scale-iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Scale/Info-Mac.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2016 Hyper Interaktiv AS. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Scale/Info-iOS.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ScaleTests/Info-Mac.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ScaleTests/Info-iOS.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ScaleTests/Tests.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import XCTest
3 | import Scale
4 |
5 | class Tests: XCTestCase {
6 | func testOperation() {
7 | let angle = 5.degree + 2.radian
8 | XCTAssert(angle.unit == AngleUnit.degree)
9 | XCTAssertEqualWithAccuracy(angle.value, 119.591559, accuracy: 1)
10 |
11 | let area = 5.acre + 2.hectare
12 | XCTAssert(area.unit == AreaUnit.acre)
13 | XCTAssertEqualWithAccuracy(area.value, 9.94210763, accuracy: 1)
14 |
15 | let energy = 5.joule + 2.watthour
16 | XCTAssert(energy.unit == EnergyUnit.joule)
17 | XCTAssertEqualWithAccuracy(energy.value, 7205, accuracy: 0)
18 |
19 | let metric = 5.base + 2.kilo
20 | XCTAssert(metric.unit == MetricUnit.base)
21 | XCTAssertEqualWithAccuracy(metric.value, 2005, accuracy: 0)
22 |
23 | let volume = 5.liter + 2.gallon
24 | XCTAssert(volume.unit == VolumeUnit.liter)
25 | XCTAssertEqualWithAccuracy(volume.value, 12.5708236, accuracy: 1)
26 |
27 | let temperature = 5.fahrenheit + 2.celsius
28 | XCTAssert(temperature.unit == TemperatureUnit.fahrenheit)
29 | XCTAssertEqualWithAccuracy(temperature.value, 40.6, accuracy: 0.001)
30 |
31 | let time = 5.day + 2.hour
32 | XCTAssert(time.unit == TimeUnit.hour)
33 | XCTAssertEqualWithAccuracy(time.value, 122, accuracy: 0)
34 |
35 | let length = 5.yard + 2.meter
36 | XCTAssert(length.unit == LengthUnit.yard)
37 | XCTAssertEqualWithAccuracy(length.value, 7.1872266, accuracy: 1)
38 |
39 | let weight = 5.kilogram + 2.pound
40 | XCTAssert(weight.unit == WeightUnit.pound)
41 | XCTAssertEqualWithAccuracy(weight.value, 13.0231131, accuracy: 1)
42 | }
43 |
44 | func testConverting() {
45 | XCTAssertEqualWithAccuracy(2.hour.to(unit: .week).value, 0.0119048, accuracy: 0.001)
46 | XCTAssertEqualWithAccuracy(2.week.to(unit: .hour).value, 336, accuracy: 0)
47 | }
48 |
49 | func testTemperature() {
50 | XCTAssertEqualWithAccuracy(20.celsius.to(unit: .fahrenheit).value, 68, accuracy: 0)
51 | XCTAssertEqualWithAccuracy(10.celsius.to(unit: .kelvin).value, 283.15, accuracy: 0)
52 | XCTAssertEqualWithAccuracy(68.fahrenheit.to(unit: .celsius).value, 20, accuracy: 0)
53 | XCTAssertEqualWithAccuracy(60.fahrenheit.to(unit: .kelvin).value, 288.71, accuracy: 0.1)
54 | XCTAssertEqualWithAccuracy(300.kelvin.to(unit: .celsius).value, 26.85, accuracy: 0.1)
55 | XCTAssertEqualWithAccuracy(300.kelvin.to(unit: .fahrenheit).value, 80.33, accuracy: 0.1)
56 | XCTAssertEqualWithAccuracy(20.celsius.to(unit: .celsius).value, 20, accuracy: 0)
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Screenshots/Banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onmyway133/Scale/b8318762d79fb61af71b9577d52f9bd9474b1cab/Screenshots/Banner.png
--------------------------------------------------------------------------------
/Sources/Angle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Angle.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum AngleUnit: Double {
12 | case degree = 1
13 | case radian = 57.295_8
14 | case pi = 180
15 |
16 | static var defaultScale: Double {
17 | return AngleUnit.degree.rawValue
18 | }
19 | }
20 |
21 | public struct Angle {
22 | public let value: Double
23 | public let unit: AngleUnit
24 |
25 | public init(value: Double, unit: AngleUnit) {
26 | self.value = value
27 | self.unit = unit
28 | }
29 |
30 | public func to(unit: AngleUnit) -> Angle {
31 | return Angle(value: self.value * self.unit.rawValue * AngleUnit.degree.rawValue / unit.rawValue, unit: unit)
32 | }
33 | }
34 |
35 | public extension Double {
36 | public var degree: Angle {
37 | return Angle(value: self, unit: .degree)
38 | }
39 |
40 | public var radian: Angle {
41 | return Angle(value: self, unit: .radian)
42 | }
43 |
44 | public var pi: Angle {
45 | return Angle(value: self, unit: .pi)
46 | }
47 | }
48 |
49 | public func compute(_ left: Angle, right: Angle, operation: (Double, Double) -> Double) -> Angle {
50 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
51 | let result = operation(min.value, max.to(unit: min.unit).value)
52 |
53 | return Angle(value: result, unit: min.unit)
54 | }
55 |
56 | public func +(left: Angle, right: Angle) -> Angle {
57 | return compute(left, right: right, operation: +)
58 | }
59 |
60 | public func -(left: Angle, right: Angle) -> Angle {
61 | return compute(left, right: right, operation: -)
62 | }
63 |
64 | public func *(left: Angle, right: Angle) -> Angle {
65 | return compute(left, right: right, operation: *)
66 | }
67 |
68 | public func /(left: Angle, right: Angle) throws -> Angle {
69 | guard right.value != 0 else {
70 | throw ScaleError.dividedByZero
71 | }
72 |
73 | return compute(left, right: right, operation: /)
74 | }
75 |
--------------------------------------------------------------------------------
/Sources/Area.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Area.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum AreaUnit: Double {
12 | case squareFoot = 0.092_903
13 | case squareYard = 0.836_127
14 | case squareMeter = 1
15 | case squareKilometer = 1_000_000
16 | case squareMile = 2_589_988.11
17 | case acre = 4_046.86
18 | case hectare = 10_000
19 |
20 | static var defaultScale: Double {
21 | return AreaUnit.squareMeter.rawValue
22 | }
23 | }
24 |
25 | public struct Area {
26 | public let value: Double
27 | public let unit: AreaUnit
28 |
29 | public init(value: Double, unit: AreaUnit) {
30 | self.value = value
31 | self.unit = unit
32 | }
33 |
34 | public func to(unit: AreaUnit) -> Area {
35 | return Area(value: self.value * self.unit.rawValue * AreaUnit.squareMeter.rawValue / unit.rawValue, unit: unit)
36 | }
37 | }
38 |
39 | public extension Double {
40 | public var squareFoot: Area {
41 | return Area(value: self, unit: .squareFoot)
42 | }
43 |
44 | public var squareYard: Area {
45 | return Area(value: self, unit: .squareYard)
46 | }
47 |
48 | public var squareMeter: Area {
49 | return Area(value: self, unit: .squareMeter)
50 | }
51 |
52 | public var squareKilometer: Area {
53 | return Area(value: self, unit: .squareKilometer)
54 | }
55 |
56 | public var squareMile: Area {
57 | return Area(value: self, unit: .squareMile)
58 | }
59 |
60 | public var acre: Area {
61 | return Area(value: self, unit: .acre)
62 | }
63 |
64 | public var hectare: Area {
65 | return Area(value: self, unit: .hectare)
66 | }
67 | }
68 |
69 | public func compute(_ left: Area, right: Area, operation: (Double, Double) -> Double) -> Area {
70 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
71 | let result = operation(min.value, max.to(unit: min.unit).value)
72 |
73 | return Area(value: result, unit: min.unit)
74 | }
75 |
76 | public func +(left: Area, right: Area) -> Area {
77 | return compute(left, right: right, operation: +)
78 | }
79 |
80 | public func -(left: Area, right: Area) -> Area {
81 | return compute(left, right: right, operation: -)
82 | }
83 |
84 | public func *(left: Area, right: Area) -> Area {
85 | return compute(left, right: right, operation: *)
86 | }
87 |
88 | public func /(left: Area, right: Area) throws -> Area {
89 | guard right.value != 0 else {
90 | throw ScaleError.dividedByZero
91 | }
92 |
93 | return compute(left, right: right, operation: /)
94 | }
95 |
--------------------------------------------------------------------------------
/Sources/Energy.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Energy.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum EnergyUnit: Double {
12 | case joule = 1
13 | case kilojoule = 1_000
14 | case gramcalorie = 4.184
15 | case kilocalorie = 4_184
16 | case watthour = 3_600
17 |
18 | static var defaultScale: Double {
19 | return EnergyUnit.joule.rawValue
20 | }
21 | }
22 |
23 | public struct Energy {
24 | public let value: Double
25 | public let unit: EnergyUnit
26 |
27 | public init(value: Double, unit: EnergyUnit) {
28 | self.value = value
29 | self.unit = unit
30 | }
31 |
32 | public func to(unit: EnergyUnit) -> Energy {
33 | return Energy(value: self.value * self.unit.rawValue * EnergyUnit.joule.rawValue / unit.rawValue, unit: unit)
34 | }
35 | }
36 |
37 | public extension Double {
38 | public var joule: Energy {
39 | return Energy(value: self, unit: .joule)
40 | }
41 |
42 | public var kilojoule: Energy {
43 | return Energy(value: self, unit: .kilojoule)
44 | }
45 |
46 | public var gramcalorie: Energy {
47 | return Energy(value: self, unit: .gramcalorie)
48 | }
49 |
50 | public var kilocalorie: Energy {
51 | return Energy(value: self, unit: .kilocalorie)
52 | }
53 |
54 | public var watthour: Energy {
55 | return Energy(value: self, unit: .watthour)
56 | }
57 | }
58 |
59 | public func compute(_ left: Energy, right: Energy, operation: (Double, Double) -> Double) -> Energy {
60 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
61 | let result = operation(min.value, max.to(unit: min.unit).value)
62 |
63 | return Energy(value: result, unit: min.unit)
64 | }
65 |
66 | public func +(left: Energy, right: Energy) -> Energy {
67 | return compute(left, right: right, operation: +)
68 | }
69 |
70 | public func -(left: Energy, right: Energy) -> Energy {
71 | return compute(left, right: right, operation: -)
72 | }
73 |
74 | public func *(left: Energy, right: Energy) -> Energy {
75 | return compute(left, right: right, operation: *)
76 | }
77 |
78 | public func /(left: Energy, right: Energy) throws -> Energy {
79 | guard right.value != 0 else {
80 | throw ScaleError.dividedByZero
81 | }
82 |
83 | return compute(left, right: right, operation: /)
84 | }
85 |
--------------------------------------------------------------------------------
/Sources/Error.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Error.swift
3 | // Pods
4 | //
5 | // Created by Khoa Pham on 1/6/16.
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | enum ScaleError: Error {
12 | case dividedByZero
13 | }
14 |
--------------------------------------------------------------------------------
/Sources/Length.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Length.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum LengthUnit: Double {
12 | case millimeter = 0.001
13 | case centimeter = 0.01
14 | case decimeter = 0.1
15 | case meter = 1
16 | case dekameter = 10
17 | case hectometer = 100
18 | case kilometer = 1_000
19 | case yard = 0.914_4
20 | case parsec = 30_856_775_813_060_000
21 | case mile = 1_609.344
22 | case foot = 0.304_8
23 | case fathom = 1.828_8
24 | case inch = 0.025_4
25 | case league = 4_828.032
26 |
27 | static var defaultScale: Double {
28 | return LengthUnit.meter.rawValue
29 | }
30 | }
31 |
32 | public struct Length {
33 | public let value: Double
34 | public let unit: LengthUnit
35 |
36 | public init(value: Double, unit: LengthUnit) {
37 | self.value = value
38 | self.unit = unit
39 | }
40 |
41 | public func to(unit: LengthUnit) -> Length {
42 | return Length(value: self.value * self.unit.rawValue * LengthUnit.meter.rawValue / unit.rawValue, unit: unit)
43 | }
44 | }
45 |
46 | public extension Double {
47 | public var millimeter: Length {
48 | return Length(value: self, unit: .millimeter)
49 | }
50 |
51 | public var centimeter: Length {
52 | return Length(value: self, unit: .centimeter)
53 | }
54 |
55 | public var decimeter: Length {
56 | return Length(value: self, unit: .decimeter)
57 | }
58 |
59 | public var meter: Length {
60 | return Length(value: self, unit: .meter)
61 | }
62 |
63 | public var dekameter: Length {
64 | return Length(value: self, unit: .dekameter)
65 | }
66 |
67 | public var hectometer: Length {
68 | return Length(value: self, unit: .hectometer)
69 | }
70 |
71 | public var kilometer: Length {
72 | return Length(value: self, unit: .kilometer)
73 | }
74 |
75 | public var yard: Length {
76 | return Length(value: self, unit: .yard)
77 | }
78 |
79 | public var parsec: Length {
80 | return Length(value: self, unit: .parsec)
81 | }
82 |
83 | public var mile: Length {
84 | return Length(value: self, unit: .mile)
85 | }
86 |
87 | public var foot: Length {
88 | return Length(value: self, unit: .foot)
89 | }
90 |
91 | public var fathom: Length {
92 | return Length(value: self, unit: .fathom)
93 | }
94 |
95 | public var inch: Length {
96 | return Length(value: self, unit: .inch)
97 | }
98 |
99 | public var league: Length {
100 | return Length(value: self, unit: .league)
101 | }
102 | }
103 |
104 | public func compute(_ left: Length, right: Length, operation: (Double, Double) -> Double) -> Length {
105 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
106 | let result = operation(min.value, max.to(unit: min.unit).value)
107 |
108 | return Length(value: result, unit: min.unit)
109 | }
110 |
111 | public func +(left: Length, right: Length) -> Length {
112 | return compute(left, right: right, operation: +)
113 | }
114 |
115 | public func -(left: Length, right: Length) -> Length {
116 | return compute(left, right: right, operation: -)
117 | }
118 |
119 | public func *(left: Length, right: Length) -> Length {
120 | return compute(left, right: right, operation: *)
121 | }
122 |
123 | public func /(left: Length, right: Length) throws -> Length {
124 | guard right.value != 0 else {
125 | throw ScaleError.dividedByZero
126 | }
127 |
128 | return compute(left, right: right, operation: /)
129 | }
130 |
--------------------------------------------------------------------------------
/Sources/Metric.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Metric.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum MetricUnit: Double {
12 | case nano = 0.000_000_001
13 | case micro = 0.000_001
14 | case milli = 0.001
15 | case centi = 0.01
16 | case deci = 0.1
17 | case base = 1
18 | case deka = 10
19 | case hecto = 100
20 | case kilo = 1_000
21 | case mega = 1_000_000
22 | case giga = 1_000_000_000
23 | case tera = 1_000_000_000_000
24 | case peta = 1_000_000_000_000_000
25 |
26 | static var defaultScale: Double {
27 | return MetricUnit.base.rawValue
28 | }
29 | }
30 |
31 | public struct Metric {
32 | public let value: Double
33 | public let unit: MetricUnit
34 |
35 | public init(value: Double, unit: MetricUnit) {
36 | self.value = value
37 | self.unit = unit
38 | }
39 |
40 | public func to(unit: MetricUnit) -> Metric {
41 | return Metric(value: self.value * self.unit.rawValue * MetricUnit.base.rawValue / unit.rawValue, unit: unit)
42 | }
43 | }
44 |
45 | public extension Double {
46 | public var nano: Metric {
47 | return Metric(value: self, unit: .nano)
48 | }
49 |
50 | public var micro: Metric {
51 | return Metric(value: self, unit: .micro)
52 | }
53 |
54 | public var milli: Metric {
55 | return Metric(value: self, unit: .milli)
56 | }
57 |
58 | public var centi: Metric {
59 | return Metric(value: self, unit: .centi)
60 | }
61 |
62 | public var deci: Metric {
63 | return Metric(value: self, unit: .deci)
64 | }
65 |
66 | public var base: Metric {
67 | return Metric(value: self, unit: .base)
68 | }
69 |
70 | public var deka: Metric {
71 | return Metric(value: self, unit: .deka)
72 | }
73 |
74 | public var hecto: Metric {
75 | return Metric(value: self, unit: .hecto)
76 | }
77 |
78 | public var kilo: Metric {
79 | return Metric(value: self, unit: .kilo)
80 | }
81 |
82 | public var mega: Metric {
83 | return Metric(value: self, unit: .mega)
84 | }
85 |
86 | public var giga: Metric {
87 | return Metric(value: self, unit: .giga)
88 | }
89 |
90 | public var tera: Metric {
91 | return Metric(value: self, unit: .tera)
92 | }
93 |
94 | public var peta: Metric {
95 | return Metric(value: self, unit: .peta)
96 | }
97 | }
98 |
99 | public func compute(_ left: Metric, right: Metric, operation: (Double, Double) -> Double) -> Metric {
100 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
101 | let result = operation(min.value, max.to(unit: min.unit).value)
102 |
103 | return Metric(value: result, unit: min.unit)
104 | }
105 |
106 | public func +(left: Metric, right: Metric) -> Metric {
107 | return compute(left, right: right, operation: +)
108 | }
109 |
110 | public func -(left: Metric, right: Metric) -> Metric {
111 | return compute(left, right: right, operation: -)
112 | }
113 |
114 | public func *(left: Metric, right: Metric) -> Metric {
115 | return compute(left, right: right, operation: *)
116 | }
117 |
118 | public func /(left: Metric, right: Metric) throws -> Metric {
119 | guard right.value != 0 else {
120 | throw ScaleError.dividedByZero
121 | }
122 |
123 | return compute(left, right: right, operation: /)
124 | }
125 |
--------------------------------------------------------------------------------
/Sources/Power.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Power.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum PowerUnit: Double {
12 | case milliwatt = 0.001
13 | case watt = 1
14 | case kilowatt = 1_000
15 | case megawatt = 1_000_000
16 | case gigawatt = 1_000_000_000
17 | case horsepower = 745.699_871_582_3
18 |
19 | static var defaultScale: Double {
20 | return PowerUnit.watt.rawValue
21 | }
22 | }
23 |
24 | public struct Power {
25 | public let value: Double
26 | public let unit: PowerUnit
27 |
28 | public init(value: Double, unit: PowerUnit) {
29 | self.value = value
30 | self.unit = unit
31 | }
32 |
33 | public func to(unit: PowerUnit) -> Power {
34 | return Power(value: self.value * self.unit.rawValue * PowerUnit.watt.rawValue / unit.rawValue, unit: unit)
35 | }
36 | }
37 |
38 | public extension Double {
39 | public var milliwatt: Power {
40 | return Power(value: self, unit: .milliwatt)
41 | }
42 |
43 | public var watt: Power {
44 | return Power(value: self, unit: .watt)
45 | }
46 |
47 | public var kilowatt: Power {
48 | return Power(value: self, unit: .kilowatt)
49 | }
50 |
51 | public var megawatt: Power {
52 | return Power(value: self, unit: .megawatt)
53 | }
54 |
55 | public var gigawatt: Power {
56 | return Power(value: self, unit: .gigawatt)
57 | }
58 |
59 | public var horsepower: Power {
60 | return Power(value: self, unit: .horsepower)
61 | }
62 | }
63 |
64 | public func compute(_ left: Power, right: Power, operation: (Double, Double) -> Double) -> Power {
65 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
66 | let result = operation(min.value, max.to(unit: min.unit).value)
67 |
68 | return Power(value: result, unit: min.unit)
69 | }
70 |
71 | public func +(left: Power, right: Power) -> Power {
72 | return compute(left, right: right, operation: +)
73 | }
74 |
75 | public func -(left: Power, right: Power) -> Power {
76 | return compute(left, right: right, operation: -)
77 | }
78 |
79 | public func *(left: Power, right: Power) -> Power {
80 | return compute(left, right: right, operation: *)
81 | }
82 |
83 | public func /(left: Power, right: Power) throws -> Power {
84 | guard right.value != 0 else {
85 | throw ScaleError.dividedByZero
86 | }
87 |
88 | return compute(left, right: right, operation: /)
89 | }
90 |
--------------------------------------------------------------------------------
/Sources/Temperature.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Temperature.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum TemperatureUnit: Double {
12 | case kelvin = 1
13 | case celsius = 274.15
14 | case fahrenheit = 255.9277777778
15 |
16 | static var defaultScale: Double {
17 | return TemperatureUnit.kelvin.rawValue
18 | }
19 | }
20 |
21 | public struct Temperature {
22 | public let value: Double
23 | public let unit: TemperatureUnit
24 |
25 | public init(value: Double, unit: TemperatureUnit) {
26 | self.value = value
27 | self.unit = unit
28 | }
29 |
30 | public func to(unit: TemperatureUnit) -> Temperature {
31 | switch (self.unit, unit) {
32 | case (.celsius, .fahrenheit):
33 | return Temperature(value: self.value * 1.8 + 32, unit: unit)
34 | case (.celsius, .kelvin):
35 | return Temperature(value: self.value + 273.15, unit: unit)
36 | case (.fahrenheit, .celsius):
37 | return Temperature(value: (self.value - 32) / 1.8, unit: unit)
38 | case (.fahrenheit, .kelvin):
39 | return Temperature(value: (self.value + 459.67) / 1.8, unit: unit)
40 | case (.kelvin, .celsius):
41 | return Temperature(value: self.value - 273.15, unit: unit)
42 | case (.kelvin, .fahrenheit):
43 | return Temperature(value: self.value * 1.8 - 459.67, unit: unit)
44 | case (_, _):
45 | return self
46 | }
47 | }
48 | }
49 |
50 | public extension Double {
51 | public var kelvin: Temperature {
52 | return Temperature(value: self, unit: .kelvin)
53 | }
54 |
55 | public var celsius: Temperature {
56 | return Temperature(value: self, unit: .celsius)
57 | }
58 |
59 | public var fahrenheit: Temperature {
60 | return Temperature(value: self, unit: .fahrenheit)
61 | }
62 | }
63 |
64 | public func compute(_ left: Temperature, right: Temperature, operation: (Double, Double) -> Double) -> Temperature {
65 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
66 | let result = operation(min.value, max.to(unit: min.unit).value)
67 |
68 | return Temperature(value: result, unit: min.unit)
69 | }
70 |
71 | public func +(left: Temperature, right: Temperature) -> Temperature {
72 | return compute(left, right: right, operation: +)
73 | }
74 |
75 | public func -(left: Temperature, right: Temperature) -> Temperature {
76 | return compute(left, right: right, operation: -)
77 | }
78 |
79 | public func *(left: Temperature, right: Temperature) -> Temperature {
80 | return compute(left, right: right, operation: *)
81 | }
82 |
83 | public func /(left: Temperature, right: Temperature) throws -> Temperature {
84 | guard right.value != 0 else {
85 | throw ScaleError.dividedByZero
86 | }
87 |
88 | return compute(left, right: right, operation: /)
89 | }
90 |
--------------------------------------------------------------------------------
/Sources/Time.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Time.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum TimeUnit: Double {
12 | case nanosecond = 0.000_000_001
13 | case microsecond = 0.000_001
14 | case millisecond = 0.001
15 | case centisecond = 0.01
16 | case second = 1
17 | case minute = 60
18 | case hour = 3_600
19 | case day = 86_400
20 | case week = 604_800
21 | case fortnight = 1_209_600
22 | case month = 2_629_822.965_84
23 | case year = 31_536_000
24 | case decade = 315_360_000
25 | case century = 3_153_600_000
26 | case millennium = 31_536_000_000
27 |
28 | static var defaultScale: Double {
29 | return TimeUnit.second.rawValue
30 | }
31 | }
32 |
33 | public struct Time {
34 | public let value: Double
35 | public let unit: TimeUnit
36 |
37 | public init(value: Double, unit: TimeUnit) {
38 | self.value = value
39 | self.unit = unit
40 | }
41 |
42 | public func to(unit: TimeUnit) -> Time {
43 | return Time(value: self.value * self.unit.rawValue * TimeUnit.second.rawValue / unit.rawValue, unit: unit)
44 | }
45 | }
46 |
47 | public extension Double {
48 | public var nanosecond: Time {
49 | return Time(value: self, unit: .nanosecond)
50 | }
51 |
52 | public var microsecond: Time {
53 | return Time(value: self, unit: .microsecond)
54 | }
55 |
56 | public var millisecond: Time {
57 | return Time(value: self, unit: .millisecond)
58 | }
59 |
60 | public var centisecond: Time {
61 | return Time(value: self, unit: .centisecond)
62 | }
63 |
64 | public var second: Time {
65 | return Time(value: self, unit: .second)
66 | }
67 |
68 | public var minute: Time {
69 | return Time(value: self, unit: .minute)
70 | }
71 |
72 | public var hour: Time {
73 | return Time(value: self, unit: .hour)
74 | }
75 |
76 | public var day: Time {
77 | return Time(value: self, unit: .day)
78 | }
79 |
80 | public var week: Time {
81 | return Time(value: self, unit: .week)
82 | }
83 |
84 | public var fortnight: Time {
85 | return Time(value: self, unit: .fortnight)
86 | }
87 |
88 | public var month: Time {
89 | return Time(value: self, unit: .month)
90 | }
91 |
92 | public var year: Time {
93 | return Time(value: self, unit: .year)
94 | }
95 |
96 | public var decade: Time {
97 | return Time(value: self, unit: .decade)
98 | }
99 |
100 | public var century: Time {
101 | return Time(value: self, unit: .century)
102 | }
103 |
104 | public var millennium: Time {
105 | return Time(value: self, unit: .millennium)
106 | }
107 | }
108 |
109 | public func compute(_ left: Time, right: Time, operation: (Double, Double) -> Double) -> Time {
110 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
111 | let result = operation(min.value, max.to(unit: min.unit).value)
112 |
113 | return Time(value: result, unit: min.unit)
114 | }
115 |
116 | public func +(left: Time, right: Time) -> Time {
117 | return compute(left, right: right, operation: +)
118 | }
119 |
120 | public func -(left: Time, right: Time) -> Time {
121 | return compute(left, right: right, operation: -)
122 | }
123 |
124 | public func *(left: Time, right: Time) -> Time {
125 | return compute(left, right: right, operation: *)
126 | }
127 |
128 | public func /(left: Time, right: Time) throws -> Time {
129 | guard right.value != 0 else {
130 | throw ScaleError.dividedByZero
131 | }
132 |
133 | return compute(left, right: right, operation: /)
134 | }
135 |
--------------------------------------------------------------------------------
/Sources/Volume.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Volume.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum VolumeUnit: Double {
12 | case microliter = 0.000_001
13 | case milliliter = 0.001
14 | case centiliter = 0.01
15 | case liter = 1
16 | case dekaliter = 10
17 | case hectoliter = 100
18 | case kiloliter = 1_000
19 | case gill = 0.118_294_118_25
20 | case gallon = 3.785_41
21 | case pint = 0.473_176_473
22 | case quart = 1.136_522_5
23 |
24 | static var defaultScale: Double {
25 | return VolumeUnit.liter.rawValue
26 | }
27 | }
28 |
29 | public struct Volume {
30 | public let value: Double
31 | public let unit: VolumeUnit
32 |
33 | public init(value: Double, unit: VolumeUnit) {
34 | self.value = value
35 | self.unit = unit
36 | }
37 |
38 | public func to(unit: VolumeUnit) -> Volume {
39 | return Volume(value: self.value * self.unit.rawValue * VolumeUnit.liter.rawValue / unit.rawValue, unit: unit)
40 | }
41 | }
42 |
43 | public extension Double {
44 | public var microliter: Volume {
45 | return Volume(value: self, unit: .microliter)
46 | }
47 |
48 | public var milliliter: Volume {
49 | return Volume(value: self, unit: .milliliter)
50 | }
51 |
52 | public var centiliter: Volume {
53 | return Volume(value: self, unit: .centiliter)
54 | }
55 |
56 | public var liter: Volume {
57 | return Volume(value: self, unit: .liter)
58 | }
59 |
60 | public var dekaliter: Volume {
61 | return Volume(value: self, unit: .dekaliter)
62 | }
63 |
64 | public var hectoliter: Volume {
65 | return Volume(value: self, unit: .hectoliter)
66 | }
67 |
68 | public var kiloliter: Volume {
69 | return Volume(value: self, unit: .kiloliter)
70 | }
71 |
72 | public var gill: Volume {
73 | return Volume(value: self, unit: .gill)
74 | }
75 |
76 | public var gallon: Volume {
77 | return Volume(value: self, unit: .gallon)
78 | }
79 |
80 | public var pint: Volume {
81 | return Volume(value: self, unit: .pint)
82 | }
83 |
84 | public var quart: Volume {
85 | return Volume(value: self, unit: .quart)
86 | }
87 | }
88 |
89 | public func compute(_ left: Volume, right: Volume, operation: (Double, Double) -> Double) -> Volume {
90 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
91 | let result = operation(min.value, max.to(unit: min.unit).value)
92 |
93 | return Volume(value: result, unit: min.unit)
94 | }
95 |
96 | public func +(left: Volume, right: Volume) -> Volume {
97 | return compute(left, right: right, operation: +)
98 | }
99 |
100 | public func -(left: Volume, right: Volume) -> Volume {
101 | return compute(left, right: right, operation: -)
102 | }
103 |
104 | public func *(left: Volume, right: Volume) -> Volume {
105 | return compute(left, right: right, operation: *)
106 | }
107 |
108 | public func /(left: Volume, right: Volume) throws -> Volume {
109 | guard right.value != 0 else {
110 | throw ScaleError.dividedByZero
111 | }
112 |
113 | return compute(left, right: right, operation: /)
114 | }
115 |
--------------------------------------------------------------------------------
/Sources/Weight.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Weight.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum WeightUnit: Double {
12 | case milligram = 0.001
13 | case centigram = 0.01
14 | case decigram = 0.1
15 | case gram = 1
16 | case dekagram = 10
17 | case hectogram = 100
18 | case kilogram = 1_000
19 | case ton = 1_000_000
20 | case carat = 0.2
21 | case newton = 101.971_621_297_8
22 | case ounce = 28.349_523_125
23 | case pound = 453.592_37
24 | case stone = 6_350.293_18
25 |
26 | static var defaultScale: Double {
27 | return WeightUnit.gram.rawValue
28 | }
29 | }
30 |
31 | public struct Weight {
32 | public let value: Double
33 | public let unit: WeightUnit
34 |
35 | public init(value: Double, unit: WeightUnit) {
36 | self.value = value
37 | self.unit = unit
38 | }
39 |
40 | public func to(unit: WeightUnit) -> Weight {
41 | return Weight(value: self.value * self.unit.rawValue * WeightUnit.gram.rawValue / unit.rawValue, unit: unit)
42 | }
43 | }
44 |
45 | public extension Double {
46 | public var milligram: Weight {
47 | return Weight(value: self, unit: .milligram)
48 | }
49 |
50 | public var centigram: Weight {
51 | return Weight(value: self, unit: .centigram)
52 | }
53 |
54 | public var decigram: Weight {
55 | return Weight(value: self, unit: .decigram)
56 | }
57 |
58 | public var gram: Weight {
59 | return Weight(value: self, unit: .gram)
60 | }
61 |
62 | public var dekagram: Weight {
63 | return Weight(value: self, unit: .dekagram)
64 | }
65 |
66 | public var hectogram: Weight {
67 | return Weight(value: self, unit: .hectogram)
68 | }
69 |
70 | public var kilogram: Weight {
71 | return Weight(value: self, unit: .kilogram)
72 | }
73 |
74 | public var ton: Weight {
75 | return Weight(value: self, unit: .ton)
76 | }
77 |
78 | public var carat: Weight {
79 | return Weight(value: self, unit: .carat)
80 | }
81 |
82 | public var newton: Weight {
83 | return Weight(value: self, unit: .newton)
84 | }
85 |
86 | public var ounce: Weight {
87 | return Weight(value: self, unit: .ounce)
88 | }
89 |
90 | public var pound: Weight {
91 | return Weight(value: self, unit: .pound)
92 | }
93 |
94 | public var stone: Weight {
95 | return Weight(value: self, unit: .stone)
96 | }
97 | }
98 |
99 | public func compute(_ left: Weight, right: Weight, operation: (Double, Double) -> Double) -> Weight {
100 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
101 | let result = operation(min.value, max.to(unit: min.unit).value)
102 |
103 | return Weight(value: result, unit: min.unit)
104 | }
105 |
106 | public func +(left: Weight, right: Weight) -> Weight {
107 | return compute(left, right: right, operation: +)
108 | }
109 |
110 | public func -(left: Weight, right: Weight) -> Weight {
111 | return compute(left, right: right, operation: -)
112 | }
113 |
114 | public func *(left: Weight, right: Weight) -> Weight {
115 | return compute(left, right: right, operation: *)
116 | }
117 |
118 | public func /(left: Weight, right: Weight) throws -> Weight {
119 | guard right.value != 0 else {
120 | throw ScaleError.dividedByZero
121 | }
122 |
123 | return compute(left, right: right, operation: /)
124 | }
125 |
--------------------------------------------------------------------------------
/Support/Definitions/Angle.def:
--------------------------------------------------------------------------------
1 | public enum AngleUnit: Double {
2 | case degree = 1
3 | case radian = 57.295_8
4 | case pi = 180
5 |
6 | static var defaultScale: Double {
7 | return AngleUnit.degree.rawValue
8 | }
9 | }
--------------------------------------------------------------------------------
/Support/Definitions/Area.def:
--------------------------------------------------------------------------------
1 | public enum AreaUnit: Double {
2 | case squareFoot = 0.092_903
3 | case squareYard = 0.836_127
4 | case squareMeter = 1
5 | case squareKilometer = 1_000_000
6 | case squareMile = 2_589_988.11
7 | case acre = 4_046.86
8 | case hectare = 10_000
9 |
10 | static var defaultScale: Double {
11 | return AreaUnit.squareMeter.rawValue
12 | }
13 | }
--------------------------------------------------------------------------------
/Support/Definitions/Energy.def:
--------------------------------------------------------------------------------
1 | public enum EnergyUnit: Double {
2 | case joule = 1
3 | case kilojoule = 1_000
4 | case gramcalorie = 4.184
5 | case kilocalorie = 4_184
6 | case watthour = 3_600
7 |
8 | static var defaultScale: Double {
9 | return EnergyUnit.joule.rawValue
10 | }
11 | }
--------------------------------------------------------------------------------
/Support/Definitions/Length.def:
--------------------------------------------------------------------------------
1 | public enum LengthUnit: Double {
2 | case millimeter = 0.001
3 | case centimeter = 0.01
4 | case decimeter = 0.1
5 | case meter = 1
6 | case dekameter = 10
7 | case hectometer = 100
8 | case kilometer = 1_000
9 | case yard = 0.914_4
10 | case parsec = 30_856_775_813_060_000
11 | case mile = 1_609.344
12 | case foot = 0.304_8
13 | case fathom = 1.828_8
14 | case inch = 0.025_4
15 | case league = 4_828.032
16 |
17 | static var defaultScale: Double {
18 | return LengthUnit.meter.rawValue
19 | }
20 | }
--------------------------------------------------------------------------------
/Support/Definitions/Metric.def:
--------------------------------------------------------------------------------
1 | public enum MetricUnit: Double {
2 | case nano = 0.000_000_001
3 | case micro = 0.000_001
4 | case milli = 0.001
5 | case centi = 0.01
6 | case deci = 0.1
7 | case base = 1
8 | case deka = 10
9 | case hecto = 100
10 | case kilo = 1_000
11 | case mega = 1_000_000
12 | case giga = 1_000_000_000
13 | case tera = 1_000_000_000_000
14 | case peta = 1_000_000_000_000_000
15 |
16 | static var defaultScale: Double {
17 | return MetricUnit.base.rawValue
18 | }
19 | }
--------------------------------------------------------------------------------
/Support/Definitions/Power.def:
--------------------------------------------------------------------------------
1 | public enum PowerUnit: Double {
2 | case milliwatt = 0.001
3 | case watt = 1
4 | case kilowatt = 1_000
5 | case megawatt = 1_000_000
6 | case gigawatt = 1_000_000_000
7 | case horsepower = 745.699_871_582_3
8 |
9 | static var defaultScale: Double {
10 | return PowerUnit.watt.rawValue
11 | }
12 | }
--------------------------------------------------------------------------------
/Support/Definitions/Template.t:
--------------------------------------------------------------------------------
1 | //
2 | // <>.swift
3 | // Scale
4 | //
5 | // Created by Khoa Pham
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | <>
12 |
13 | public struct <> {
14 | public let value: Double
15 | public let unit: <>
16 |
17 | public init(value: Double, unit: <>) {
18 | self.value = value
19 | self.unit = unit
20 | }
21 |
22 | public func to(unit unit: <>) -> <> {
23 | return <>(value: self.value * self.unit.rawValue * <>.<>.rawValue / unit.rawValue, unit: unit)
24 | }
25 | }
26 |
27 | public extension Double {
28 | <>
29 | }
30 |
31 | public func compute(left: <>, right: <>, operation: (Double, Double) -> Double) -> <> {
32 | let (min, max) = left.unit.rawValue < right.unit.rawValue ? (left, right) : (right, left)
33 | let result = operation(min.value, max.to(unit: min.unit).value)
34 |
35 | return <>(value: result, unit: min.unit)
36 | }
37 |
38 | public func +(left: <>, right: <>) -> <> {
39 | return compute(left, right: right, operation: +)
40 | }
41 |
42 | public func -(left: <>, right: <>) -> <> {
43 | return compute(left, right: right, operation: -)
44 | }
45 |
46 | public func *(left: <>, right: <>) -> <> {
47 | return compute(left, right: right, operation: *)
48 | }
49 |
50 | public func /(left: <>, right: <>) throws -> <> {
51 | guard right.value != 0 else {
52 | throw Error.DividedByZero
53 | }
54 |
55 | return compute(left, right: right, operation: /)
56 | }
57 |
--------------------------------------------------------------------------------
/Support/Definitions/Time.def:
--------------------------------------------------------------------------------
1 | public enum TimeUnit: Double {
2 | case nanosecond = 0.000_000_001
3 | case microsecond = 0.000_001
4 | case millisecond = 0.001
5 | case centisecond = 0.01
6 | case second = 1
7 | case minute = 60
8 | case hour = 3_600
9 | case day = 86_400
10 | case week = 604_800
11 | case fortnight = 1_209_600
12 | case month = 2_629_822.965_84
13 | case year = 31_536_000
14 | case decade = 315_360_000
15 | case century = 3_153_600_000
16 | case millennium = 31_536_000_000
17 |
18 | static var defaultScale: Double {
19 | return TimeUnit.second.rawValue
20 | }
21 | }
--------------------------------------------------------------------------------
/Support/Definitions/Volume.def:
--------------------------------------------------------------------------------
1 | public enum VolumeUnit: Double {
2 | case microliter = 0.000_001
3 | case milliliter = 0.001
4 | case centiliter = 0.01
5 | case liter = 1
6 | case dekaliter = 10
7 | case hectoliter = 100
8 | case kiloliter = 1_000
9 | case gill = 0.118_294_118_25
10 | case gallon = 3.785_41
11 | case pint = 0.473_176_473
12 | case quart = 1.136_522_5
13 |
14 | static var defaultScale: Double {
15 | return VolumeUnit.liter.rawValue
16 | }
17 | }
--------------------------------------------------------------------------------
/Support/Definitions/Weight.def:
--------------------------------------------------------------------------------
1 | public enum WeightUnit: Double {
2 | case milligram = 0.001
3 | case centigram = 0.01
4 | case decigram = 0.1
5 | case gram = 1
6 | case dekagram = 10
7 | case hectogram = 100
8 | case kilogram = 1_000
9 | case ton = 1_000_000
10 | case carat = 0.2
11 | case newton = 101.971_621_297_8
12 | case ounce = 28.349_523_125
13 | case pound = 453.592_37
14 | case stone = 6_350.293_18
15 |
16 | static var defaultScale: Double {
17 | return WeightUnit.gram.rawValue
18 | }
19 | }
--------------------------------------------------------------------------------
/Support/Script/Script.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Script.swift
3 | // Pods
4 | //
5 | // Created by Khoa Pham on 1/6/16.
6 | // Copyright © 2016 Fantageek. All rights reserved.
7 | //
8 |
9 | /*
10 | HOW TO RUN THIS SCRIPT
11 |
12 | Way 1
13 | xcrun swift Script.swift
14 |
15 | Way 2
16 | Declare #!/usr/bin/env xcrun swift -i at the top of the file
17 | */
18 |
19 |
20 | import Foundation
21 |
22 | // MARK: NSURL
23 | extension NSURL {
24 | func parentDirectory() -> NSURL {
25 | return self.URLByDeletingLastPathComponent!
26 | }
27 |
28 | func append(pathComponent: String) -> NSURL {
29 | return self.URLByAppendingPathComponent(pathComponent)
30 | }
31 |
32 | var correctPath: String {
33 | return path ?? ""
34 | }
35 | }
36 |
37 | // MARK: String
38 | extension String {
39 | func substring(range: NSRange) -> String {
40 | return (self as NSString).substringWithRange(range)
41 | }
42 |
43 | func split(separator: String) -> [String] {
44 | return (self as NSString).componentsSeparatedByString(separator)
45 | }
46 |
47 | func remove(string: String) -> String {
48 | return self.replace(string, replacement: "")
49 | }
50 |
51 | func replace(string: String, replacement: String) -> String {
52 | return (self as NSString).stringByReplacingOccurrencesOfString(string, withString: replacement)
53 | }
54 | }
55 |
56 | // MARK: NSRegularExpression
57 | extension NSRegularExpression {
58 | class func find(pattern: String, string: String) throws -> [String] {
59 | let regex = try NSRegularExpression(pattern: pattern, options: [.CaseInsensitive])
60 | let results = regex.matchesInString(string, options: [], range: NSMakeRange(0, string.characters.count))
61 |
62 | return results.flatMap { result in
63 | return result.range
64 | }.flatMap { range in
65 | return string.substring(range)
66 | }
67 | }
68 | }
69 |
70 | // MARK: Path
71 | func currentDirectory() -> NSURL {
72 | return NSURL(fileURLWithPath: NSFileManager.defaultManager().currentDirectoryPath)
73 | }
74 |
75 | func definitionPath() -> NSURL {
76 | return currentDirectory().parentDirectory().append("Definitions")
77 | }
78 |
79 | func defFileNames() throws -> [String] {
80 | return try NSFileManager.defaultManager().contentsOfDirectoryAtPath(definitionPath().correctPath).filter {
81 | return $0.containsString(".def")
82 | }
83 | }
84 |
85 | // READ
86 | func read(filePath: String) throws -> String {
87 | return try String(contentsOfFile: filePath)
88 | }
89 |
90 | // WRITE
91 | func write(filePath: String, content: String) throws {
92 | try content.writeToFile(filePath, atomically: false, encoding: NSUTF8StringEncoding)
93 | }
94 |
95 | // DATA
96 | class Definition {
97 | var name = "" // Ex: Length
98 | var units = [(String, String)]() // Ex: (kilometer, 1000)
99 | var defaultScale = "" // Ex: meter
100 |
101 | init() {
102 |
103 | }
104 |
105 | var unitName: String {
106 | return name + "Unit"
107 | }
108 | }
109 |
110 | // ACTION
111 | func action() throws {
112 | let templatePath = definitionPath().append("Template.t").correctPath
113 | let template = try read(templatePath)
114 |
115 | let outputPath = currentDirectory().parentDirectory().parentDirectory().append("Sources")
116 |
117 | for defFileName in try defFileNames() {
118 | print(defFileName)
119 |
120 | let defPath = definitionPath().append(defFileName).correctPath
121 |
122 | let def = try read(defPath)
123 | let definition = try parse(def)
124 |
125 | let result = apply(def, template: template, definition: definition)
126 | let resultPath = outputPath.append(definition.name + ".swift")
127 |
128 | try write(resultPath.correctPath, content: result)
129 | }
130 | }
131 |
132 | // MARK: Parse
133 | func parse(def: String) throws -> Definition {
134 | let definition = Definition()
135 |
136 | definition.name = try {
137 | guard let match = try NSRegularExpression.find("enum\\s\\w+Unit", string: def).first else {
138 | return ""
139 | }
140 |
141 | return match.remove("Unit").split(" ").last ?? ""
142 | }()
143 |
144 | definition.units = try {
145 | var units = [(String, String)]()
146 |
147 | try NSRegularExpression.find("case.+", string: def).forEach { match in
148 | let trim = match.remove("case").remove(" ").split("=")
149 |
150 | units.append((trim.first ?? "", trim.last ?? ""))
151 | }
152 |
153 | return units
154 | }()
155 |
156 |
157 | definition.defaultScale = try {
158 | guard let match = try NSRegularExpression.find("\\w+.rawValue", string: def).first else {
159 | return ""
160 | }
161 |
162 | return match.split(".").first ?? ""
163 | }()
164 |
165 | return definition
166 | }
167 |
168 | func apply(def: String, template: String, definition: Definition) -> String {
169 | // Def
170 | var result = template.replace("<>", replacement: def)
171 |
172 | // Name
173 | result = result.replace("<>", replacement: definition.name)
174 |
175 | // Unit Name
176 | result = result.replace("<>", replacement: definition.unitName)
177 |
178 | // Default Scale
179 | result = result.replace("<>", replacement: definition.defaultScale)
180 |
181 | // Units
182 | let units = definition.units.map { (key, value) in
183 | return " public var \(key): \(definition.name) {\n"
184 | + " return \(definition.name)(value: self, unit: .\(key))\n"
185 | + " }"
186 | }.joinWithSeparator("\n\n")
187 |
188 | result = result.replace("<>", replacement: units)
189 |
190 |
191 | return result
192 | }
193 |
194 | // MAIN
195 | func main(){
196 | print("Begin ...")
197 |
198 | do {
199 | try action()
200 | } catch {
201 | print("Something went wrong")
202 | }
203 |
204 | print("Done ^^")
205 | }
206 |
207 | main()
208 |
--------------------------------------------------------------------------------