├── .gitignore ├── .travis.yml ├── Example ├── Model │ ├── Friend+CoreDataProperties.swift │ ├── Friend.swift │ ├── Model.xcdatamodeld │ │ └── Model.xcdatamodel │ │ │ └── contents │ ├── Person+CoreDataProperties.swift │ └── Person.swift ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── Stack.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Stack.xcscheme │ └── Target Support Files │ │ ├── Pods-StackOSXDemo │ │ ├── Info.plist │ │ ├── Pods-StackOSXDemo-acknowledgements.markdown │ │ ├── Pods-StackOSXDemo-acknowledgements.plist │ │ ├── Pods-StackOSXDemo-dummy.m │ │ ├── Pods-StackOSXDemo-frameworks.sh │ │ ├── Pods-StackOSXDemo-resources.sh │ │ ├── Pods-StackOSXDemo-umbrella.h │ │ ├── Pods-StackOSXDemo.debug.xcconfig │ │ ├── Pods-StackOSXDemo.modulemap │ │ └── Pods-StackOSXDemo.release.xcconfig │ │ ├── Pods-Stack_Example │ │ ├── Info.plist │ │ ├── Pods-Stack_Example-acknowledgements.markdown │ │ ├── Pods-Stack_Example-acknowledgements.plist │ │ ├── Pods-Stack_Example-dummy.m │ │ ├── Pods-Stack_Example-frameworks.sh │ │ ├── Pods-Stack_Example-resources.sh │ │ ├── Pods-Stack_Example-umbrella.h │ │ ├── Pods-Stack_Example.debug.xcconfig │ │ ├── Pods-Stack_Example.modulemap │ │ └── Pods-Stack_Example.release.xcconfig │ │ ├── Pods-Stack_Tests │ │ ├── Info.plist │ │ ├── Pods-Stack_Tests-acknowledgements.markdown │ │ ├── Pods-Stack_Tests-acknowledgements.plist │ │ ├── Pods-Stack_Tests-dummy.m │ │ ├── Pods-Stack_Tests-frameworks.sh │ │ ├── Pods-Stack_Tests-resources.sh │ │ ├── Pods-Stack_Tests-umbrella.h │ │ ├── Pods-Stack_Tests.debug.xcconfig │ │ ├── Pods-Stack_Tests.modulemap │ │ └── Pods-Stack_Tests.release.xcconfig │ │ ├── Pods-StackiOSDemo │ │ ├── Info.plist │ │ ├── Pods-StackiOSDemo-acknowledgements.markdown │ │ ├── Pods-StackiOSDemo-acknowledgements.plist │ │ ├── Pods-StackiOSDemo-dummy.m │ │ ├── Pods-StackiOSDemo-frameworks.sh │ │ ├── Pods-StackiOSDemo-resources.sh │ │ ├── Pods-StackiOSDemo-umbrella.h │ │ ├── Pods-StackiOSDemo.debug.xcconfig │ │ ├── Pods-StackiOSDemo.modulemap │ │ └── Pods-StackiOSDemo.release.xcconfig │ │ └── Stack │ │ ├── Info.plist │ │ ├── Stack-dummy.m │ │ ├── Stack-prefix.pch │ │ ├── Stack-umbrella.h │ │ ├── Stack.modulemap │ │ └── Stack.xcconfig ├── Stack.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Stack-Example.xcscheme ├── Stack.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── Stack.xcscmblueprint ├── Stack │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── DataViewController.swift │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── StackViewController.swift │ └── Stack_Example-Bridging-Header.h └── Tests │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── Pod └── Classes │ ├── .gitkeep │ ├── Additions.swift │ ├── Query.swift │ ├── Readable.swift │ ├── Stack.swift │ ├── StackConfiguration.swift │ ├── StackTypes.swift │ └── Transaction.swift ├── README.md ├── Stack.podspec └── assets ├── stack.png └── stack@2x.png /.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 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | language: swift 6 | xcode_workspace: Example/Stack.xcworkspace 7 | xcode_scheme: Stack-Example 8 | xcode_sdk: iphonesimulator 9 | podfile: Example/Podfile 10 | 11 | 12 | -------------------------------------------------------------------------------- /Example/Model/Friend+CoreDataProperties.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import Foundation 27 | import CoreData 28 | 29 | extension Friend { 30 | 31 | @NSManaged var name: String? 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Example/Model/Friend.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import Foundation 27 | import CoreData 28 | import Stack 29 | 30 | @objc(Friend) 31 | class Friend: NSManagedObject { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Example/Model/Model.xcdatamodeld/Model.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Example/Model/Person+CoreDataProperties.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import Foundation 27 | import CoreData 28 | 29 | extension Person { 30 | 31 | @NSManaged var name: String? 32 | @NSManaged var identifier: String? 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Example/Model/Person.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import Foundation 27 | import CoreData 28 | 29 | @objc(Person) 30 | class Person: NSManagedObject { 31 | 32 | // Insert code here to add functionality to your managed object subclass 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | target 'Stack_Example', :exclusive => true do 5 | pod "Stack", :path => "../" 6 | end 7 | 8 | target 'Stack_Tests', :exclusive => true do 9 | pod "Stack", :path => "../" 10 | 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Stack (2.0.0) 3 | 4 | DEPENDENCIES: 5 | - Stack (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | Stack: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | Stack: b2a77662cf52a7f3449812ee259613cd013f5296 13 | 14 | COCOAPODS: 0.39.0 15 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/Stack.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Stack", 3 | "version": "2.0.0", 4 | "summary": "A Type-Safe, Thread-Safe-ish approach to CoreData in Swift", 5 | "homepage": "https://github.com/shaps80/Stack", 6 | "license": "MIT", 7 | "authors": { 8 | "Shaps Mohsenin": "shapsuk@me.com" 9 | }, 10 | "source": { 11 | "git": "https://github.com/shaps80/Stack.git", 12 | "tag": "2.0.0" 13 | }, 14 | "social_media_url": "https://twitter.com/shaps", 15 | "platforms": { 16 | "ios": "8.0", 17 | "osx": "10.10" 18 | }, 19 | "requires_arc": true, 20 | "source_files": "Pod/Classes/**/*.swift", 21 | "frameworks": [ 22 | "Foundation", 23 | "CoreData" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Stack (2.0.0) 3 | 4 | DEPENDENCIES: 5 | - Stack (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | Stack: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | Stack: b2a77662cf52a7f3449812ee259613cd013f5296 13 | 14 | COCOAPODS: 0.39.0 15 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Stack.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/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-StackOSXDemo/Pods-StackOSXDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Stack 5 | 6 | Copyright (c) 2015 Shaps Mohsenin 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-StackOSXDemo/Pods-StackOSXDemo-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) 2015 Shaps Mohsenin <shapsuk@me.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 | Stack 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-StackOSXDemo/Pods-StackOSXDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_StackOSXDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_StackOSXDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/Pods-StackOSXDemo-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-StackOSXDemo/Stack.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-StackOSXDemo/Stack.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/Pods-StackOSXDemo-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-StackOSXDemo/Pods-StackOSXDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_StackOSXDemoVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_StackOSXDemoVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/Pods-StackOSXDemo.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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-StackOSXDemo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/Pods-StackOSXDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_StackOSXDemo { 2 | umbrella header "Pods-StackOSXDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackOSXDemo/Pods-StackOSXDemo.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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-StackOSXDemo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/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 | 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-Stack_Example/Pods-Stack_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Stack 5 | 6 | Copyright (c) 2015 Shaps Mohsenin 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-Stack_Example/Pods-Stack_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) 2015 Shaps Mohsenin <shapsuk@me.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 | Stack 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-Stack_Example/Pods-Stack_Example-dummy.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | @interface PodsDummy_Pods_Stack_Example : NSObject 28 | @end 29 | @implementation PodsDummy_Pods_Stack_Example 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_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-Stack_Example/Stack.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-Stack_Example/Stack.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_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-Stack_Example/Pods-Stack_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | 29 | FOUNDATION_EXPORT double Pods_Stack_ExampleVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char Pods_Stack_ExampleVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Stack_Example 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Stack_Example { 2 | umbrella header "Pods-Stack_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Stack_Example 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_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 | 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-Stack_Tests/Pods-Stack_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Stack 5 | 6 | Copyright (c) 2015 Shaps Mohsenin 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-Stack_Tests/Pods-Stack_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) 2015 Shaps Mohsenin <shapsuk@me.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 | Stack 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-Stack_Tests/Pods-Stack_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | @interface PodsDummy_Pods_Stack_Tests : NSObject 28 | @end 29 | @implementation PodsDummy_Pods_Stack_Tests 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_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-Stack_Tests/Stack.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-Stack_Tests/Stack.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_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-Stack_Tests/Pods-Stack_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | 29 | FOUNDATION_EXPORT double Pods_Stack_TestsVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char Pods_Stack_TestsVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Stack_Tests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Stack_Tests { 2 | umbrella header "Pods-Stack_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-Stack_Tests 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/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-StackiOSDemo/Pods-StackiOSDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Stack 5 | 6 | Copyright (c) 2015 Shaps Mohsenin 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-StackiOSDemo/Pods-StackiOSDemo-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) 2015 Shaps Mohsenin <shapsuk@me.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 | Stack 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-StackiOSDemo/Pods-StackiOSDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_StackiOSDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_StackiOSDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/Pods-StackiOSDemo-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-StackiOSDemo/Stack.framework" 88 | fi 89 | if [[ "$CONFIGURATION" == "Release" ]]; then 90 | install_framework "Pods-StackiOSDemo/Stack.framework" 91 | fi 92 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/Pods-StackiOSDemo-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-StackiOSDemo/Pods-StackiOSDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_StackiOSDemoVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_StackiOSDemoVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/Pods-StackiOSDemo.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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-StackiOSDemo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/Pods-StackiOSDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_StackiOSDemo { 2 | umbrella header "Pods-StackiOSDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-StackiOSDemo/Pods-StackiOSDemo.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/Stack.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Stack" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-StackiOSDemo 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/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 | FMWK 17 | CFBundleShortVersionString 18 | 2.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/Stack-dummy.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | @interface PodsDummy_Stack : NSObject 28 | @end 29 | @implementation PodsDummy_Stack 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/Stack-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/Stack-umbrella.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #import 27 | 28 | 29 | FOUNDATION_EXPORT double StackVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char StackVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/Stack.modulemap: -------------------------------------------------------------------------------- 1 | framework module Stack { 2 | umbrella header "Stack-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Stack/Stack.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Stack" "${PODS_ROOT}/Headers/Public" 3 | OTHER_LDFLAGS = -framework "CoreData" -framework "Foundation" 4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Example/Stack.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5456E6781C5584F300364348 /* StackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* StackViewController.swift */; }; 11 | 5456E67A1C55B64500364348 /* DataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5456E6791C55B64500364348 /* DataViewController.swift */; }; 12 | 546837C71C4D5B5A004DA140 /* Person+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 546837C51C4D5B5A004DA140 /* Person+CoreDataProperties.swift */; }; 13 | 546837C81C4D5B5A004DA140 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 546837C61C4D5B5A004DA140 /* Person.swift */; }; 14 | 54C505A41C07335D004DB6BC /* Friend+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C505A21C07335D004DB6BC /* Friend+CoreDataProperties.swift */; }; 15 | 54C505A51C07335D004DB6BC /* Friend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C505A31C07335D004DB6BC /* Friend.swift */; }; 16 | 54C505A81C073385004DB6BC /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 54C505A61C073385004DB6BC /* Model.xcdatamodeld */; }; 17 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 18 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 19 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 20 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 21 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 22 | CDD2A3777437227369BB2961 /* Pods_Stack_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 956FB9C2EC5941BF29C560D2 /* Pods_Stack_Example.framework */; }; 23 | D0AD1FF3669D655C079B99B9 /* Pods_Stack_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CEA01D8CFABE9CC249EB810 /* Pods_Stack_Tests.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 32 | remoteInfo = Stack; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 0CEA01D8CFABE9CC249EB810 /* Pods_Stack_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Stack_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 5456E6791C55B64500364348 /* DataViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataViewController.swift; sourceTree = ""; }; 39 | 546837C51C4D5B5A004DA140 /* Person+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Person+CoreDataProperties.swift"; sourceTree = ""; }; 40 | 546837C61C4D5B5A004DA140 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = ""; }; 41 | 547BC24D1C6FCD6800BB4B2B /* Readable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Readable.swift; sourceTree = ""; }; 42 | 54C0FE9A1C4E754000A04C91 /* StackTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StackTypes.swift; sourceTree = ""; }; 43 | 54C505881C073144004DB6BC /* Additions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Additions.swift; sourceTree = ""; }; 44 | 54C505891C073144004DB6BC /* Query.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = ""; }; 45 | 54C5058A1C073144004DB6BC /* Stack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stack.swift; sourceTree = ""; }; 46 | 54C5058B1C073144004DB6BC /* Transaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transaction.swift; sourceTree = ""; }; 47 | 54C505901C07329F004DB6BC /* Stack_Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Stack_Example-Bridging-Header.h"; sourceTree = ""; }; 48 | 54C505A21C07335D004DB6BC /* Friend+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Friend+CoreDataProperties.swift"; sourceTree = ""; }; 49 | 54C505A31C07335D004DB6BC /* Friend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Friend.swift; sourceTree = ""; }; 50 | 54C505A71C073385004DB6BC /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = ""; }; 51 | 54C505A91C073501004DB6BC /* StackConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StackConfiguration.swift; sourceTree = ""; }; 52 | 607FACD01AFB9204008FA782 /* Stack_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Stack_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 55 | 607FACD71AFB9204008FA782 /* StackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackViewController.swift; sourceTree = ""; }; 56 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 58 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 59 | 607FACE51AFB9204008FA782 /* Stack_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Stack_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 62 | 8A91076063E1DFCC4942A6C8 /* Stack.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Stack.podspec; path = ../Stack.podspec; sourceTree = ""; }; 63 | 956FB9C2EC5941BF29C560D2 /* Pods_Stack_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Stack_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | 963DF70FA74CAEB2159915E4 /* Pods-Stack_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stack_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_Tests.release.xcconfig"; sourceTree = ""; }; 65 | CDFF1868B417442D3F22D40E /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 66 | EB43860A2AC2EB72765B133F /* Pods-Stack_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stack_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_Tests.debug.xcconfig"; sourceTree = ""; }; 67 | EEBABD2CBF4D3B49509C2A24 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 68 | F240ADDADBBB8267593FFB1B /* Pods-Stack_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stack_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_Example.debug.xcconfig"; sourceTree = ""; }; 69 | F34B797405F97225B196ED4E /* Pods-Stack_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Stack_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_Example.release.xcconfig"; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | CDD2A3777437227369BB2961 /* Pods_Stack_Example.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | D0AD1FF3669D655C079B99B9 /* Pods_Stack_Tests.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | /* End PBXFrameworksBuildPhase section */ 90 | 91 | /* Begin PBXGroup section */ 92 | 29F6E9B481C7F423154FB3CF /* Pods */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | F240ADDADBBB8267593FFB1B /* Pods-Stack_Example.debug.xcconfig */, 96 | F34B797405F97225B196ED4E /* Pods-Stack_Example.release.xcconfig */, 97 | EB43860A2AC2EB72765B133F /* Pods-Stack_Tests.debug.xcconfig */, 98 | 963DF70FA74CAEB2159915E4 /* Pods-Stack_Tests.release.xcconfig */, 99 | ); 100 | name = Pods; 101 | sourceTree = ""; 102 | }; 103 | 54C505861C073134004DB6BC /* Stack */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 54C5058A1C073144004DB6BC /* Stack.swift */, 107 | 54C505891C073144004DB6BC /* Query.swift */, 108 | 547BC24D1C6FCD6800BB4B2B /* Readable.swift */, 109 | 54C5058B1C073144004DB6BC /* Transaction.swift */, 110 | 54C0FE9A1C4E754000A04C91 /* StackTypes.swift */, 111 | 54C505A91C073501004DB6BC /* StackConfiguration.swift */, 112 | 54C505881C073144004DB6BC /* Additions.swift */, 113 | ); 114 | name = Stack; 115 | path = ../Pod/Classes; 116 | sourceTree = ""; 117 | }; 118 | 54C5058C1C0731C8004DB6BC /* Resources */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 122 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 123 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 124 | 54C505901C07329F004DB6BC /* Stack_Example-Bridging-Header.h */, 125 | ); 126 | name = Resources; 127 | sourceTree = ""; 128 | }; 129 | 54C505A11C073321004DB6BC /* Model */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 54C505A31C07335D004DB6BC /* Friend.swift */, 133 | 54C505A21C07335D004DB6BC /* Friend+CoreDataProperties.swift */, 134 | 546837C51C4D5B5A004DA140 /* Person+CoreDataProperties.swift */, 135 | 546837C61C4D5B5A004DA140 /* Person.swift */, 136 | 54C505A61C073385004DB6BC /* Model.xcdatamodeld */, 137 | ); 138 | path = Model; 139 | sourceTree = ""; 140 | }; 141 | 607FACC71AFB9204008FA782 = { 142 | isa = PBXGroup; 143 | children = ( 144 | 54C505861C073134004DB6BC /* Stack */, 145 | 54C505A11C073321004DB6BC /* Model */, 146 | 607FACD21AFB9204008FA782 /* Example for Stack */, 147 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 148 | 607FACE81AFB9204008FA782 /* Tests */, 149 | 607FACD11AFB9204008FA782 /* Products */, 150 | 29F6E9B481C7F423154FB3CF /* Pods */, 151 | AEABF9C42BA61B52295F5578 /* Frameworks */, 152 | ); 153 | sourceTree = ""; 154 | }; 155 | 607FACD11AFB9204008FA782 /* Products */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 607FACD01AFB9204008FA782 /* Stack_Example.app */, 159 | 607FACE51AFB9204008FA782 /* Stack_Tests.xctest */, 160 | ); 161 | name = Products; 162 | sourceTree = ""; 163 | }; 164 | 607FACD21AFB9204008FA782 /* Example for Stack */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 168 | 5456E6791C55B64500364348 /* DataViewController.swift */, 169 | 607FACD71AFB9204008FA782 /* StackViewController.swift */, 170 | 54C5058C1C0731C8004DB6BC /* Resources */, 171 | 607FACD31AFB9204008FA782 /* Supporting Files */, 172 | ); 173 | name = "Example for Stack"; 174 | path = Stack; 175 | sourceTree = ""; 176 | }; 177 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 607FACD41AFB9204008FA782 /* Info.plist */, 181 | ); 182 | name = "Supporting Files"; 183 | sourceTree = ""; 184 | }; 185 | 607FACE81AFB9204008FA782 /* Tests */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 189 | 607FACE91AFB9204008FA782 /* Supporting Files */, 190 | ); 191 | path = Tests; 192 | sourceTree = ""; 193 | }; 194 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 607FACEA1AFB9204008FA782 /* Info.plist */, 198 | ); 199 | name = "Supporting Files"; 200 | sourceTree = ""; 201 | }; 202 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 8A91076063E1DFCC4942A6C8 /* Stack.podspec */, 206 | CDFF1868B417442D3F22D40E /* README.md */, 207 | EEBABD2CBF4D3B49509C2A24 /* LICENSE */, 208 | ); 209 | name = "Podspec Metadata"; 210 | sourceTree = ""; 211 | }; 212 | AEABF9C42BA61B52295F5578 /* Frameworks */ = { 213 | isa = PBXGroup; 214 | children = ( 215 | 956FB9C2EC5941BF29C560D2 /* Pods_Stack_Example.framework */, 216 | 0CEA01D8CFABE9CC249EB810 /* Pods_Stack_Tests.framework */, 217 | ); 218 | name = Frameworks; 219 | sourceTree = ""; 220 | }; 221 | /* End PBXGroup section */ 222 | 223 | /* Begin PBXNativeTarget section */ 224 | 607FACCF1AFB9204008FA782 /* Stack_Example */ = { 225 | isa = PBXNativeTarget; 226 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Stack_Example" */; 227 | buildPhases = ( 228 | ECF79C99A50505D6D1286C34 /* Check Pods Manifest.lock */, 229 | 607FACCC1AFB9204008FA782 /* Sources */, 230 | 607FACCD1AFB9204008FA782 /* Frameworks */, 231 | 607FACCE1AFB9204008FA782 /* Resources */, 232 | EFCEB103132BF9F3CF66D283 /* Embed Pods Frameworks */, 233 | B203FC8E6C3D1AB9F87A43E1 /* Copy Pods Resources */, 234 | ); 235 | buildRules = ( 236 | ); 237 | dependencies = ( 238 | ); 239 | name = Stack_Example; 240 | productName = Stack; 241 | productReference = 607FACD01AFB9204008FA782 /* Stack_Example.app */; 242 | productType = "com.apple.product-type.application"; 243 | }; 244 | 607FACE41AFB9204008FA782 /* Stack_Tests */ = { 245 | isa = PBXNativeTarget; 246 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Stack_Tests" */; 247 | buildPhases = ( 248 | 083D803196F8B3502FC0BB5E /* Check Pods Manifest.lock */, 249 | 607FACE11AFB9204008FA782 /* Sources */, 250 | 607FACE21AFB9204008FA782 /* Frameworks */, 251 | 607FACE31AFB9204008FA782 /* Resources */, 252 | 5C30F0FEA94B870B6FB96F61 /* Embed Pods Frameworks */, 253 | 3E69D0160FD5CB0BC5CC1208 /* Copy Pods Resources */, 254 | ); 255 | buildRules = ( 256 | ); 257 | dependencies = ( 258 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 259 | ); 260 | name = Stack_Tests; 261 | productName = Tests; 262 | productReference = 607FACE51AFB9204008FA782 /* Stack_Tests.xctest */; 263 | productType = "com.apple.product-type.bundle.unit-test"; 264 | }; 265 | /* End PBXNativeTarget section */ 266 | 267 | /* Begin PBXProject section */ 268 | 607FACC81AFB9204008FA782 /* Project object */ = { 269 | isa = PBXProject; 270 | attributes = { 271 | LastSwiftUpdateCheck = 0710; 272 | LastUpgradeCheck = 0710; 273 | ORGANIZATIONNAME = Snippex; 274 | TargetAttributes = { 275 | 607FACCF1AFB9204008FA782 = { 276 | CreatedOnToolsVersion = 6.3.1; 277 | }; 278 | 607FACE41AFB9204008FA782 = { 279 | CreatedOnToolsVersion = 6.3.1; 280 | TestTargetID = 607FACCF1AFB9204008FA782; 281 | }; 282 | }; 283 | }; 284 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Stack" */; 285 | compatibilityVersion = "Xcode 3.2"; 286 | developmentRegion = English; 287 | hasScannedForEncodings = 0; 288 | knownRegions = ( 289 | en, 290 | Base, 291 | ); 292 | mainGroup = 607FACC71AFB9204008FA782; 293 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 294 | projectDirPath = ""; 295 | projectRoot = ""; 296 | targets = ( 297 | 607FACCF1AFB9204008FA782 /* Stack_Example */, 298 | 607FACE41AFB9204008FA782 /* Stack_Tests */, 299 | ); 300 | }; 301 | /* End PBXProject section */ 302 | 303 | /* Begin PBXResourcesBuildPhase section */ 304 | 607FACCE1AFB9204008FA782 /* Resources */ = { 305 | isa = PBXResourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 309 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 310 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | 607FACE31AFB9204008FA782 /* Resources */ = { 315 | isa = PBXResourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | /* End PBXResourcesBuildPhase section */ 322 | 323 | /* Begin PBXShellScriptBuildPhase section */ 324 | 083D803196F8B3502FC0BB5E /* Check Pods Manifest.lock */ = { 325 | isa = PBXShellScriptBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | ); 329 | inputPaths = ( 330 | ); 331 | name = "Check Pods Manifest.lock"; 332 | outputPaths = ( 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | shellPath = /bin/sh; 336 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 337 | showEnvVarsInLog = 0; 338 | }; 339 | 3E69D0160FD5CB0BC5CC1208 /* Copy Pods Resources */ = { 340 | isa = PBXShellScriptBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | ); 344 | inputPaths = ( 345 | ); 346 | name = "Copy Pods Resources"; 347 | outputPaths = ( 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | shellPath = /bin/sh; 351 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_Tests-resources.sh\"\n"; 352 | showEnvVarsInLog = 0; 353 | }; 354 | 5C30F0FEA94B870B6FB96F61 /* Embed Pods Frameworks */ = { 355 | isa = PBXShellScriptBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | inputPaths = ( 360 | ); 361 | name = "Embed Pods Frameworks"; 362 | outputPaths = ( 363 | ); 364 | runOnlyForDeploymentPostprocessing = 0; 365 | shellPath = /bin/sh; 366 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Stack_Tests/Pods-Stack_Tests-frameworks.sh\"\n"; 367 | showEnvVarsInLog = 0; 368 | }; 369 | B203FC8E6C3D1AB9F87A43E1 /* Copy Pods Resources */ = { 370 | isa = PBXShellScriptBuildPhase; 371 | buildActionMask = 2147483647; 372 | files = ( 373 | ); 374 | inputPaths = ( 375 | ); 376 | name = "Copy Pods Resources"; 377 | outputPaths = ( 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | shellPath = /bin/sh; 381 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_Example-resources.sh\"\n"; 382 | showEnvVarsInLog = 0; 383 | }; 384 | ECF79C99A50505D6D1286C34 /* Check Pods Manifest.lock */ = { 385 | isa = PBXShellScriptBuildPhase; 386 | buildActionMask = 2147483647; 387 | files = ( 388 | ); 389 | inputPaths = ( 390 | ); 391 | name = "Check Pods Manifest.lock"; 392 | outputPaths = ( 393 | ); 394 | runOnlyForDeploymentPostprocessing = 0; 395 | shellPath = /bin/sh; 396 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 397 | showEnvVarsInLog = 0; 398 | }; 399 | EFCEB103132BF9F3CF66D283 /* Embed Pods Frameworks */ = { 400 | isa = PBXShellScriptBuildPhase; 401 | buildActionMask = 2147483647; 402 | files = ( 403 | ); 404 | inputPaths = ( 405 | ); 406 | name = "Embed Pods Frameworks"; 407 | outputPaths = ( 408 | ); 409 | runOnlyForDeploymentPostprocessing = 0; 410 | shellPath = /bin/sh; 411 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Stack_Example/Pods-Stack_Example-frameworks.sh\"\n"; 412 | showEnvVarsInLog = 0; 413 | }; 414 | /* End PBXShellScriptBuildPhase section */ 415 | 416 | /* Begin PBXSourcesBuildPhase section */ 417 | 607FACCC1AFB9204008FA782 /* Sources */ = { 418 | isa = PBXSourcesBuildPhase; 419 | buildActionMask = 2147483647; 420 | files = ( 421 | 54C505A41C07335D004DB6BC /* Friend+CoreDataProperties.swift in Sources */, 422 | 546837C71C4D5B5A004DA140 /* Person+CoreDataProperties.swift in Sources */, 423 | 54C505A81C073385004DB6BC /* Model.xcdatamodeld in Sources */, 424 | 546837C81C4D5B5A004DA140 /* Person.swift in Sources */, 425 | 5456E67A1C55B64500364348 /* DataViewController.swift in Sources */, 426 | 5456E6781C5584F300364348 /* StackViewController.swift in Sources */, 427 | 54C505A51C07335D004DB6BC /* Friend.swift in Sources */, 428 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 429 | ); 430 | runOnlyForDeploymentPostprocessing = 0; 431 | }; 432 | 607FACE11AFB9204008FA782 /* Sources */ = { 433 | isa = PBXSourcesBuildPhase; 434 | buildActionMask = 2147483647; 435 | files = ( 436 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 437 | ); 438 | runOnlyForDeploymentPostprocessing = 0; 439 | }; 440 | /* End PBXSourcesBuildPhase section */ 441 | 442 | /* Begin PBXTargetDependency section */ 443 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 444 | isa = PBXTargetDependency; 445 | target = 607FACCF1AFB9204008FA782 /* Stack_Example */; 446 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 447 | }; 448 | /* End PBXTargetDependency section */ 449 | 450 | /* Begin PBXVariantGroup section */ 451 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 452 | isa = PBXVariantGroup; 453 | children = ( 454 | 607FACDA1AFB9204008FA782 /* Base */, 455 | ); 456 | name = Main.storyboard; 457 | sourceTree = ""; 458 | }; 459 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 460 | isa = PBXVariantGroup; 461 | children = ( 462 | 607FACDF1AFB9204008FA782 /* Base */, 463 | ); 464 | name = LaunchScreen.xib; 465 | sourceTree = ""; 466 | }; 467 | /* End PBXVariantGroup section */ 468 | 469 | /* Begin XCBuildConfiguration section */ 470 | 607FACED1AFB9204008FA782 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ALWAYS_SEARCH_USER_PATHS = NO; 474 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 475 | CLANG_CXX_LIBRARY = "libc++"; 476 | CLANG_ENABLE_MODULES = YES; 477 | CLANG_ENABLE_OBJC_ARC = YES; 478 | CLANG_WARN_BOOL_CONVERSION = YES; 479 | CLANG_WARN_CONSTANT_CONVERSION = YES; 480 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 481 | CLANG_WARN_EMPTY_BODY = YES; 482 | CLANG_WARN_ENUM_CONVERSION = YES; 483 | CLANG_WARN_INT_CONVERSION = YES; 484 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 485 | CLANG_WARN_UNREACHABLE_CODE = YES; 486 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 487 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 488 | COPY_PHASE_STRIP = NO; 489 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 490 | ENABLE_STRICT_OBJC_MSGSEND = YES; 491 | ENABLE_TESTABILITY = YES; 492 | GCC_C_LANGUAGE_STANDARD = gnu99; 493 | GCC_DYNAMIC_NO_PIC = NO; 494 | GCC_NO_COMMON_BLOCKS = YES; 495 | GCC_OPTIMIZATION_LEVEL = 0; 496 | GCC_PREPROCESSOR_DEFINITIONS = ( 497 | "DEBUG=1", 498 | "$(inherited)", 499 | ); 500 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 501 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 502 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 503 | GCC_WARN_UNDECLARED_SELECTOR = YES; 504 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 505 | GCC_WARN_UNUSED_FUNCTION = YES; 506 | GCC_WARN_UNUSED_VARIABLE = YES; 507 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 508 | MTL_ENABLE_DEBUG_INFO = YES; 509 | ONLY_ACTIVE_ARCH = YES; 510 | SDKROOT = iphoneos; 511 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 512 | }; 513 | name = Debug; 514 | }; 515 | 607FACEE1AFB9204008FA782 /* 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 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 535 | ENABLE_NS_ASSERTIONS = NO; 536 | ENABLE_STRICT_OBJC_MSGSEND = YES; 537 | GCC_C_LANGUAGE_STANDARD = gnu99; 538 | GCC_NO_COMMON_BLOCKS = YES; 539 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 540 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 541 | GCC_WARN_UNDECLARED_SELECTOR = YES; 542 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 543 | GCC_WARN_UNUSED_FUNCTION = YES; 544 | GCC_WARN_UNUSED_VARIABLE = YES; 545 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 546 | MTL_ENABLE_DEBUG_INFO = NO; 547 | SDKROOT = iphoneos; 548 | VALIDATE_PRODUCT = YES; 549 | }; 550 | name = Release; 551 | }; 552 | 607FACF01AFB9204008FA782 /* Debug */ = { 553 | isa = XCBuildConfiguration; 554 | baseConfigurationReference = F240ADDADBBB8267593FFB1B /* Pods-Stack_Example.debug.xcconfig */; 555 | buildSettings = { 556 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 557 | CLANG_ENABLE_MODULES = YES; 558 | INFOPLIST_FILE = Stack/Info.plist; 559 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 560 | MODULE_NAME = ExampleApp; 561 | PRODUCT_BUNDLE_IDENTIFIER = uk.co.snippex.Stack; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | SWIFT_OBJC_BRIDGING_HEADER = "Stack/Stack_Example-Bridging-Header.h"; 564 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 565 | }; 566 | name = Debug; 567 | }; 568 | 607FACF11AFB9204008FA782 /* Release */ = { 569 | isa = XCBuildConfiguration; 570 | baseConfigurationReference = F34B797405F97225B196ED4E /* Pods-Stack_Example.release.xcconfig */; 571 | buildSettings = { 572 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 573 | CLANG_ENABLE_MODULES = YES; 574 | INFOPLIST_FILE = Stack/Info.plist; 575 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 576 | MODULE_NAME = ExampleApp; 577 | PRODUCT_BUNDLE_IDENTIFIER = uk.co.snippex.Stack; 578 | PRODUCT_NAME = "$(TARGET_NAME)"; 579 | SWIFT_OBJC_BRIDGING_HEADER = "Stack/Stack_Example-Bridging-Header.h"; 580 | }; 581 | name = Release; 582 | }; 583 | 607FACF31AFB9204008FA782 /* Debug */ = { 584 | isa = XCBuildConfiguration; 585 | baseConfigurationReference = EB43860A2AC2EB72765B133F /* Pods-Stack_Tests.debug.xcconfig */; 586 | buildSettings = { 587 | BUNDLE_LOADER = "$(TEST_HOST)"; 588 | GCC_PREPROCESSOR_DEFINITIONS = ( 589 | "DEBUG=1", 590 | "$(inherited)", 591 | ); 592 | INFOPLIST_FILE = Tests/Info.plist; 593 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 594 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 595 | PRODUCT_NAME = "$(TARGET_NAME)"; 596 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stack_Example.app/Stack_Example"; 597 | }; 598 | name = Debug; 599 | }; 600 | 607FACF41AFB9204008FA782 /* Release */ = { 601 | isa = XCBuildConfiguration; 602 | baseConfigurationReference = 963DF70FA74CAEB2159915E4 /* Pods-Stack_Tests.release.xcconfig */; 603 | buildSettings = { 604 | BUNDLE_LOADER = "$(TEST_HOST)"; 605 | INFOPLIST_FILE = Tests/Info.plist; 606 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 607 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 608 | PRODUCT_NAME = "$(TARGET_NAME)"; 609 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stack_Example.app/Stack_Example"; 610 | }; 611 | name = Release; 612 | }; 613 | /* End XCBuildConfiguration section */ 614 | 615 | /* Begin XCConfigurationList section */ 616 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Stack" */ = { 617 | isa = XCConfigurationList; 618 | buildConfigurations = ( 619 | 607FACED1AFB9204008FA782 /* Debug */, 620 | 607FACEE1AFB9204008FA782 /* Release */, 621 | ); 622 | defaultConfigurationIsVisible = 0; 623 | defaultConfigurationName = Release; 624 | }; 625 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Stack_Example" */ = { 626 | isa = XCConfigurationList; 627 | buildConfigurations = ( 628 | 607FACF01AFB9204008FA782 /* Debug */, 629 | 607FACF11AFB9204008FA782 /* Release */, 630 | ); 631 | defaultConfigurationIsVisible = 0; 632 | defaultConfigurationName = Release; 633 | }; 634 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Stack_Tests" */ = { 635 | isa = XCConfigurationList; 636 | buildConfigurations = ( 637 | 607FACF31AFB9204008FA782 /* Debug */, 638 | 607FACF41AFB9204008FA782 /* Release */, 639 | ); 640 | defaultConfigurationIsVisible = 0; 641 | defaultConfigurationName = Release; 642 | }; 643 | /* End XCConfigurationList section */ 644 | 645 | /* Begin XCVersionGroup section */ 646 | 54C505A61C073385004DB6BC /* Model.xcdatamodeld */ = { 647 | isa = XCVersionGroup; 648 | children = ( 649 | 54C505A71C073385004DB6BC /* Model.xcdatamodel */, 650 | ); 651 | currentVersion = 54C505A71C073385004DB6BC /* Model.xcdatamodel */; 652 | path = Model.xcdatamodeld; 653 | sourceTree = ""; 654 | versionGroupType = wrapper.xcdatamodel; 655 | }; 656 | /* End XCVersionGroup section */ 657 | }; 658 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 659 | } 660 | -------------------------------------------------------------------------------- /Example/Stack.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Stack.xcodeproj/xcshareddata/xcschemes/Stack-Example.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 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/Stack.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Stack.xcworkspace/xcshareddata/Stack.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5343E412DB191DE1D3D2C96252AD542839908E4D", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "5343E412DB191DE1D3D2C96252AD542839908E4D" : 0, 8 | "AD5AF6AEDDDD730FA80703CD514927426A013C86" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "24880D6A-3814-4A8D-83A7-26E7EDEDE2C2", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "5343E412DB191DE1D3D2C96252AD542839908E4D" : "Stack\/", 13 | "AD5AF6AEDDDD730FA80703CD514927426A013C86" : "..\/TAB\/TABSwiftLayout" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "Stack", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Example\/Stack.xcworkspace", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:shaps80\/Stack.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5343E412DB191DE1D3D2C96252AD542839908E4D" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:theappbusiness\/TABSwiftLayout.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "AD5AF6AEDDDD730FA80703CD514927426A013C86" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /Example/Stack/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import UIKit 27 | import Stack 28 | 29 | @UIApplicationMain 30 | class AppDelegate: UIResponder, UIApplicationDelegate { 31 | 32 | var window: UIWindow? 33 | 34 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 35 | 36 | return true 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Example/Stack/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/Stack/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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Example/Stack/DataViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import UIKit 27 | import CoreData 28 | 29 | class DataViewController: UITableViewController, NSFetchedResultsControllerDelegate { 30 | 31 | 32 | /* 33 | 34 | ------------------------------------------------------------------------- 35 | This class is purely NSFetchedResultsController boilerplate code! 36 | 37 | Please checkout StackViewController for example code. 38 | ------------------------------------------------------------------------- 39 | 40 | */ 41 | 42 | 43 | 44 | 45 | 46 | 47 | // MARK: Subclassers Methods 48 | 49 | @IBAction func add(sender: AnyObject?) { /* implement in subclass */ } 50 | func delete(atIndexPath indexPath: NSIndexPath) { /* implement in subclass */ } 51 | 52 | // MARK: TableView DataSource 53 | 54 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 55 | return fetchedResultsController.fetchedObjects?.count ?? 0 56 | } 57 | 58 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 59 | let cell = tableView.dequeueReusableCellWithIdentifier("cell")! 60 | 61 | if let person = fetchedResultsController.objectAtIndexPath(indexPath) as? Person { 62 | cell.textLabel?.text = person.name ?? "Unknown" 63 | } 64 | 65 | return cell 66 | } 67 | 68 | override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { 69 | return true 70 | } 71 | 72 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 73 | if editingStyle == .Delete { 74 | delete(atIndexPath: indexPath) 75 | } 76 | } 77 | 78 | // MARK: FetchedResultsController Delegate 79 | 80 | var fetchedResultsController: NSFetchedResultsController! 81 | 82 | func controllerWillChangeContent(controller: NSFetchedResultsController) { 83 | tableView.beginUpdates() 84 | 85 | if !NSThread.isMainThread() { 86 | fatalError("Fetched Results Controller executed off the main thread!!") 87 | } 88 | } 89 | 90 | func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) { 91 | 92 | switch type { 93 | case .Insert: 94 | tableView.insertSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Automatic) 95 | case .Delete: 96 | tableView.deleteSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Automatic) 97 | default: 98 | break 99 | } 100 | } 101 | 102 | func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { 103 | switch type { 104 | case .Insert: 105 | tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Automatic) 106 | print("FRC: Inserted -- \(anObject)") 107 | case .Delete: 108 | tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Automatic) 109 | print("FRC: Deleted -- \(anObject)") 110 | case .Update: 111 | tableView.reloadRowsAtIndexPaths([indexPath!], withRowAnimation: .Automatic) 112 | case .Move: 113 | tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Automatic) 114 | tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Automatic) 115 | } 116 | } 117 | 118 | func controllerDidChangeContent(controller: NSFetchedResultsController) { 119 | tableView.endUpdates() 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /Example/Stack/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/Stack/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/Stack/StackViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import UIKit 27 | import CoreData 28 | import Stack 29 | 30 | class ViewController: DataViewController { 31 | 32 | // MARK: Stack Configuration, Add, Delete 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | 37 | // this should be configured BEFORE the first time you access defaultStack() 38 | Stack.configureDefaults { (config) -> () in 39 | 40 | // Stack supports various configurations, here we will setup a stack to use only the mainThread context for all operations 41 | config.stackType = .ParentChild // .MainThreadOnly // .ManualMerge 42 | 43 | // We can also define the persistence type 44 | config.persistenceType = .SQLite // .MemoryOnly // .Binary 45 | 46 | // checkout `config` to see what other options you can configure and what the defaults are 47 | } 48 | 49 | // Now we have configured the stack, lets grab it 50 | let stack = Stack.defaultStack() 51 | let person = try! stack.fetch(Query(key: "name", identifier: "Shaps")).first 52 | print(person?.name) 53 | 54 | // Now lets setup a query for `Person`, sorting by the person's `name` 55 | // let name = "Anne" 56 | // let query = Query().filter("%K == %@", "name", name) 57 | // let query = Query().filter("name == 'Anne'") 58 | let query = Query().sort(byKey: "name", direction: .Ascending) 59 | let results = try! stack.fetch(query) 60 | results.first?.name 61 | 62 | // We can now use a convenience init on `NSFetchedResultsController` 63 | fetchedResultsController = try! NSFetchedResultsController(stack: stack, query: query) 64 | fetchedResultsController.delegate = self 65 | 66 | // in your application you may do this lazily 67 | try! fetchedResultsController.performFetch() 68 | } 69 | 70 | private func add(person name: NSString) { 71 | let stack = Stack.defaultStack() 72 | 73 | // In order to insert, we need to use a `write` transaction 74 | stack.write({ (transaction) -> Void in 75 | // First, lets insert a new `Person` into CoreData 76 | let person = try transaction.fetchOrInsert("name", identifier: name) as Person 77 | 78 | // when the transaction completes it will automatically persist for us -- updating the UI along with it 79 | print("Stack: Inserted -- \(person) -- %@", NSThread.currentThread()) 80 | }) { (error) -> Void in 81 | if error != nil { print(error) } 82 | } 83 | } 84 | 85 | override func delete(atIndexPath indexPath: NSIndexPath) { 86 | let stack = Stack.defaultStack() 87 | let person = fetchedResultsController.objectAtIndexPath(indexPath) as! Person 88 | 89 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) { () -> Void in 90 | // In order to delete, we need to use a `write` transaction 91 | stack.write({ (transaction) -> Void in 92 | // first we need to copy the object into the current transaction 93 | let person = transaction.copy(person) 94 | 95 | // now we can delete it 96 | try transaction.delete(person) 97 | 98 | // when the transaction completes it will automatically persist for us -- updating the UI along with it 99 | print("Stack: Deleted -- \(person) -- %@", NSThread.currentThread()) 100 | }, completion: { (error) -> Void in 101 | if error != nil { print(error) } 102 | }) 103 | } 104 | } 105 | 106 | // MARK: AlertControllers 107 | 108 | override func add(sender: AnyObject?) { 109 | let controller = UIAlertController(title: "Stack", message: "Enter a name for this person", preferredStyle: .Alert) 110 | 111 | controller.addTextFieldWithConfigurationHandler { (field) -> Void in 112 | field.placeholder = "name" 113 | } 114 | 115 | controller.addAction(UIAlertAction(title: "Submit", style: .Default, handler: { (action) -> Void in 116 | if let field = controller.textFields?.first, name = field.text { 117 | self.add(person: name) 118 | } 119 | })) 120 | 121 | controller.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)) 122 | presentViewController(controller, animated: true, completion: nil) 123 | } 124 | 125 | func handleError(error: ErrorType) { 126 | let controller = UIAlertController(title: "Stack", message: "\(error)", preferredStyle: .Alert) 127 | controller.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) 128 | presentViewController(controller, animated: true, completion: nil) 129 | } 130 | 131 | } 132 | 133 | -------------------------------------------------------------------------------- /Example/Stack/Stack_Example-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /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 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import UIKit 27 | import XCTest 28 | import Stack 29 | 30 | class Tests: XCTestCase { 31 | 32 | override func setUp() { 33 | super.setUp() 34 | // Put setup code here. This method is called before the invocation of each test method in the class. 35 | } 36 | 37 | override func tearDown() { 38 | // Put teardown code here. This method is called after the invocation of each test method in the class. 39 | super.tearDown() 40 | } 41 | 42 | func testExample() { 43 | // This is an example of a functional test case. 44 | XCTAssert(true, "Pass") 45 | } 46 | 47 | func testPerformanceExample() { 48 | // This is an example of a performance test case. 49 | self.measureBlock() { 50 | // Put the code you want to measure the time of here. 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Shaps Mohsenin 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 | -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaps80/Stack/2b6963e0232a735789fe0bfd640227a9ae20a3ff/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/Additions.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | /** 29 | Combines two NSPredicate using [NSCompoundPredicate andPredicateWithSubpredicates:] 30 | 31 | - parameter left: The first NSPredicate 32 | - parameter right: The second NSPredicate 33 | 34 | - returns: An NSCompoundPredicate 35 | */ 36 | public func && (left: NSPredicate, right: NSPredicate) -> NSPredicate { 37 | return NSCompoundPredicate(type: NSCompoundPredicateType.AndPredicateType, subpredicates: [left, right]) 38 | } 39 | 40 | 41 | /** 42 | Combines two NSPredicate using [NSCompoundPredicate orPredicateWithSubpredicates:] 43 | 44 | - parameter left: The first predicate 45 | - parameter right: The second predicate 46 | 47 | - returns: An NSCompoundPredicate 48 | */ 49 | public func || (left: NSPredicate, right: NSPredicate) -> NSPredicate { 50 | return NSCompoundPredicate(type: NSCompoundPredicateType.OrPredicateType, subpredicates: [left, right]) 51 | } 52 | 53 | #if os(iOS) 54 | 55 | extension NSFetchedResultsController { 56 | 57 | /** 58 | Provides a convenience initializer for creating an NSFetchedResultsController from a Stack and Query. Note: you are still required to call -performFetch() 59 | 60 | - parameter stack: The stack to use 61 | - parameter query: The query to use for configuring this fetched results controller 62 | - parameter sectionNameKeyPath: The keyPath to use for providing section information (optional) 63 | - parameter cacheName: The cache name to use for caching results (optional) 64 | 65 | - throws: Throws an error if the fetchRequest cannot be created from the specified query 66 | 67 | - returns: A newly configured NSFetchedResultsController. 68 | */ 69 | public convenience init(stack: Stack, query: Query, sectionNameKeyPath: String? = nil, cacheName: String? = nil) throws { 70 | precondition(NSThread.isMainThread(), "You must ONLY create an NSFetchedResultsController from the Main Thread") 71 | let request = try stack.fetchRequest(query) 72 | self.init(fetchRequest: request, managedObjectContext: stack.currentThreadContext(), sectionNameKeyPath: sectionNameKeyPath, cacheName: nil) 73 | } 74 | 75 | } 76 | #endif 77 | 78 | extension NSManagedObjectContext { 79 | 80 | /** 81 | Provides an internal method for saving NSManagedObjectContext changes 82 | 83 | - parameter synchronous: Whether or not this save should be performed synchronously or asynchronously 84 | - parameter completion: The completion block to execute when this save completes (may contain an error is the save was unsuccessful) 85 | */ 86 | func save(synchronous: Bool, completion: ((NSError?) -> ())?) { 87 | let saveBlock: () -> () = { [unowned self] in 88 | if !self.hasChanges { 89 | completion?(nil) 90 | return 91 | } 92 | 93 | do { 94 | try self.save() 95 | } catch { 96 | completion?(error as NSError) 97 | return 98 | } 99 | 100 | if self.parentContext != nil { 101 | self.parentContext?.save(synchronous, completion: completion) 102 | } else { 103 | completion?(nil) 104 | } 105 | } 106 | 107 | if synchronous { 108 | performBlockAndWait(saveBlock) 109 | } else { 110 | performBlock(saveBlock) 111 | } 112 | 113 | } 114 | 115 | } 116 | 117 | 118 | -------------------------------------------------------------------------------- /Pod/Classes/Query.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import Foundation 27 | import CoreData 28 | 29 | 30 | /** 31 | Defines a sort direction for better readability 32 | 33 | - Ascending: Sort in ascending order 34 | - Descending: Sorts in descending order 35 | */ 36 | public enum SortDirection { 37 | case Ascending 38 | case Descending 39 | } 40 | 41 | /** 42 | Defines a result type for a Stack Query 43 | 44 | - ManagedObjects: The query will return NSManagedObject's in its result 45 | - ManagedObjectIDs: The query will return NSManagedObjectID's in its result 46 | - Dictionaries: The query will return dictionaries in its result 47 | */ 48 | public enum QueryResultType { 49 | case ManagedObjects 50 | case ManagedObjectIDs 51 | case Dictionaries 52 | 53 | /** 54 | A convenience function to convert a QueryResultType to an NSFetchRequestResultType 55 | 56 | - returns: The NSFetchRequestResultType 57 | */ 58 | func toFetchRequestResultType() -> NSFetchRequestResultType { 59 | switch self { 60 | case .ManagedObjects: 61 | return .ManagedObjectResultType 62 | case .Dictionaries: 63 | return .DictionaryResultType 64 | case .ManagedObjectIDs: 65 | return .ManagedObjectIDResultType 66 | } 67 | } 68 | } 69 | 70 | /// Defines a type-safe Query for usage with Stack 71 | public class Query: CustomDebugStringConvertible, CustomStringConvertible { 72 | 73 | // MARK: Public Functions 74 | 75 | /** 76 | Set if, when the query is executed, property data is obtained from the persistent store. If the value is set to false, the request will not obtain property information, but only information to identify each object (used to create NSManagedObjectIDs.) If managed objects for these IDs are later faulted (as a result of attempting to access property values), they will incur subsequent access to the persistent store to obtain their property values. Defaults to true. 77 | 78 | - parameter propertyValues: true if you want to include property values, false otherwise 79 | 80 | - returns: The modified query 81 | */ 82 | public func include(propertyValues propertyValues: Bool) -> Query { 83 | includesPropertyValues = propertyValues 84 | return self 85 | } 86 | 87 | /** 88 | Set whether or not to accommodate the currently unsaved changes in the NSManagedObjectContext. When disabled, the query skips checking unsaved changes and only returns objects that matched the predicate in the persistent store. Defaults to true 89 | 90 | - parameter pendingChanges: true if you want to include pending changes, false otherwise 91 | 92 | - returns: The modified query 93 | */ 94 | public func include(pendingChanges pendingChanges: Bool) -> Query { 95 | includesPendingChanges = pendingChanges 96 | return self 97 | } 98 | 99 | /** 100 | Set if the fetch request includes subentities. If set to false, the query will fetch objects of exactly the entity type of the request; if set to true, the request will include all subentities of the entity for the request. Defaults to true 101 | 102 | - parameter subentities: true if you want to include sub-entities, false otherwise 103 | 104 | - returns: The modified query 105 | */ 106 | public func include(subentities subentities: Bool) -> Query { 107 | includesSubentities = subentities 108 | return self 109 | } 110 | 111 | /** 112 | Set the collection of either NSPropertyDescriptions or NSString property names that should be fetched. The collection may represent attributes, to-one relationships, or NSExpressionDescription. If resultType == Dictionaries, the results of the fetch will be dictionaries containing key/value pairs where the key is the name of the specified property description. If resultType == ManagedObjects, then NSExpressionDescription cannot be used, and the results are managed object faults partially pre-populated with the named properties 113 | 114 | - parameter properties: The properties to include 115 | 116 | - returns: The modified query 117 | */ 118 | public func include(properties properties: [String]) -> Query { 119 | includeProperties = properties 120 | return self 121 | } 122 | 123 | /** 124 | Set the collection of either NSPropertyDescriptions or NSString property names that should be fetched. The collection may represent attributes, to-one relationships, or NSExpressionDescription. If resultType == Dictionaries, the results of the fetch will be dictionaries containing key/value pairs where the key is the name of the specified property description. If resultType == ManagedObjects, then NSExpressionDescription cannot be used, and the results are managed object faults partially pre-populated with the named properties 125 | 126 | - parameter properties: The properties to include 127 | 128 | - returns: The modified query 129 | */ 130 | public func include(descriptors descriptors: [NSPropertyDescription]) -> Query { 131 | includeProperties = descriptors 132 | return self 133 | } 134 | 135 | /** 136 | Set an array of relationship keypaths to prefetch along with the entity for the query. The array contains keypath strings in NSKeyValueCoding notation, as you would normally use with valueForKeyPath 137 | 138 | - parameter keyPaths: The relationship keyPaths to include 139 | 140 | - returns: The modified query 141 | */ 142 | public func include(relationship keyPaths: [String]) -> Query { 143 | includeRelationships = keyPaths 144 | return self 145 | } 146 | 147 | /** 148 | Appends a sort descriptor using the specified key and direction 149 | 150 | - parameter key: The key to sort by 151 | - parameter direction: The sort direction. Defaults to .Ascending 152 | 153 | - returns: The modified query 154 | */ 155 | public func sort(byKey key: String, direction: SortDirection = .Ascending) -> Query { 156 | let sortDescriptor = NSSortDescriptor(key: key, ascending: direction == .Ascending) 157 | sortDescriptors.append(sortDescriptor) 158 | return self 159 | } 160 | 161 | /** 162 | Appends sort descriptors using the specified key/direction pairs 163 | 164 | - parameter keys: The key/direction pairs to sort by. 165 | 166 | - returns: The modified query 167 | */ 168 | public func sort(byKeys keys: [String: SortDirection]) -> Query { 169 | for (key, direction) in keys { 170 | let sortDescriptor = NSSortDescriptor(key: key, ascending: direction == .Ascending) 171 | sortDescriptors.append(sortDescriptor) 172 | } 173 | 174 | return self 175 | } 176 | 177 | /** 178 | Appends the specified sort descriptors to the query 179 | 180 | - parameter descriptors: The sort descriptors to append 181 | 182 | - returns: The modified query 183 | */ 184 | public func sort(bySortDescriptors descriptors: [NSSortDescriptor]) -> Query { 185 | sortDescriptors.appendContentsOf(descriptors) 186 | return self 187 | } 188 | 189 | /** 190 | Updates the predicate to apply for this query. Also Supports `pred1 && pred2` or `pred1 || pred2` -- negating the need for NSCompoundPredicate in many cases 191 | 192 | - parameter pred: The predicate to apply 193 | 194 | - returns: The modified query 195 | */ 196 | public func filter(predicate pred: NSPredicate) -> Query { 197 | self.predicate = pred 198 | return self 199 | } 200 | 201 | /** 202 | Updates the predicate to apply for this query 203 | 204 | - parameter format: The format string to use for this predicate 205 | - parameter args: The arguments to be replaced in the format string 206 | 207 | - returns: The modified query 208 | */ 209 | public func filter(format: String, _ args: AnyObject...) -> Query { 210 | self.predicate = NSPredicate(format: format, argumentArray: args) 211 | return self 212 | } 213 | 214 | /** 215 | Sets whether or not to return results as a fault 216 | 217 | - parameter fault: Set to false to return results with their values pre-populated. Defaults to true 218 | 219 | - returns: The modified query 220 | */ 221 | public func fault(fault: Bool) -> Query { 222 | returnsObjectsAsFaults = fault 223 | return self 224 | } 225 | 226 | /** 227 | Sets whether or not to return distinct values for this query. Defaults to false 228 | 229 | - parameter distinct: This only applies when resultType == .Dictionaries 230 | 231 | - returns: The modified query 232 | */ 233 | public func distinct(distinct: Bool) -> Query { 234 | returnsDistinctResults = distinct 235 | return self 236 | } 237 | 238 | /** 239 | Updates the fetch batch offset for this query. Defaults to 0 240 | 241 | - parameter offset: The offset to apply 242 | 243 | - returns: The modified query 244 | */ 245 | public func offset(offset: Int) -> Query { 246 | fetchOffset = offset 247 | return self 248 | } 249 | 250 | /** 251 | Updates the fetch batch size for this query. Defaults to 0 252 | 253 | - parameter size: The size to apply 254 | 255 | - returns: The modified query 256 | */ 257 | public func batch(size: Int) -> Query { 258 | fetchBatchSize = size 259 | return self 260 | } 261 | 262 | /** 263 | Updates the batch batch limit for this query. Defaults to 0 264 | 265 | - parameter limit: The limit to apply 266 | 267 | - returns: The modified query 268 | */ 269 | public func limit(limit: Int) -> Query { 270 | fetchLimit = limit 271 | return self 272 | } 273 | 274 | public init() { } 275 | 276 | /** 277 | This convenience initializer is used internally for setting up the query to perform fetches based on identifier 278 | 279 | - parameter key: The identifier key 280 | - parameter identifier: The identifier value 281 | 282 | - returns: The configured query 283 | */ 284 | public convenience init(key: String, identifier: ID) { 285 | self.init() 286 | predicate = NSPredicate(format: "%K == %@", key, identifier) 287 | } 288 | 289 | /** 290 | This convenience initializer is used internally for setting up the query to perform fetches based on multiple identifiers 291 | 292 | - parameter key: The identifier key 293 | - parameter identifiers: The identifier values 294 | 295 | - returns: The configured query 296 | */ 297 | public convenience init(key: String, identifiers: [IDs]) { 298 | self.init() 299 | predicate = NSPredicate(format: "%K IN %@", key, identifiers) 300 | } 301 | 302 | // MARK: Internal 303 | 304 | /// Returns a print friendly description 305 | public var description: String { 306 | var description = "" 307 | 308 | description += " class:\t\t\t\t\(NSStringFromClass(T))" 309 | description += "\n filtering:\t\t\t\(predicate != nil ? "\(predicate)" : "none")" 310 | description += "\n sorting:\t\t\t\(sortDescriptors.count > 0 ? "\(sortDescriptors)" : "none")" 311 | description += "\n resultType:\t\t\(resultType)" 312 | 313 | return description 314 | } 315 | 316 | /// Returns a debug friendly description 317 | public var debugDescription: String { 318 | var description = self.description + "\n" 319 | 320 | description += "\n size:\t\t\t\t\(fetchBatchSize)" 321 | description += "\n offset:\t\t\t\(fetchOffset)" 322 | description += "\n limit:\t\t\t\t\(fetchLimit)" 323 | description += "\n" 324 | description += "\n faulting:\t\t\t\(_returnsObjectsAsFaults == true && resultType == .ManagedObjectIDs ? "false (resultType == .ManagedObjectIDs)" : "\(returnsObjectsAsFaults)")" 325 | description += "\n distinct:\t\t\t\(_returnsDistinctResults == true && resultType != .Dictionaries ? "false (resultType != .Dictionaries)" : "\(returnsDistinctResults)")" 326 | description += "\n" 327 | description += "\n inc properties:\t\(includeProperties)" 328 | description += "\n inc values:\t\t\(includesPropertyValues)" 329 | description += "\n inc pending:\t\t\(includesPendingChanges)" 330 | description += "\n inc relations:\t\t\(includeRelationships)" 331 | description += "\n inc sub-entities:\t\(includesSubentities)" 332 | 333 | return description 334 | } 335 | 336 | /// Get/set the predicate for this query 337 | private(set) var predicate: NSPredicate? 338 | 339 | /// Get/set the sortDescriptors for this query 340 | private(set) var sortDescriptors = [NSSortDescriptor]() 341 | 342 | /// Get/set the fetchBatchSize for this query. Defaults to 0 343 | private(set) var fetchBatchSize = 0 344 | 345 | /// Get/set the fetchOffset for this query. Defaults to 0 346 | private(set) var fetchOffset = 0 347 | 348 | /// Get/set the fetchLimit for this query. Defaults to 0 349 | private(set) var fetchLimit = 0 350 | 351 | /// Get/set whether or not this query should returns objects as faults. Defaults to true 352 | private var _returnsObjectsAsFaults = true 353 | private(set) var returnsObjectsAsFaults: Bool { 354 | set { _returnsObjectsAsFaults = newValue } 355 | get { 356 | if _returnsObjectsAsFaults == true && resultType == .ManagedObjectIDs { 357 | return false 358 | } 359 | 360 | return _returnsObjectsAsFaults 361 | } 362 | } 363 | 364 | /// Get/set whether or not this query should return distint results. This only applies when resultType == .Dictionaries. Defaults to false 365 | private var _returnsDistinctResults = false 366 | private(set) var returnsDistinctResults: Bool { 367 | set { _returnsDistinctResults = newValue } 368 | get { 369 | if _returnsDistinctResults == true && resultType != .Dictionaries { 370 | return false 371 | } 372 | 373 | return _returnsDistinctResults 374 | } 375 | } 376 | 377 | /// Get/set if, when the query is executed, property data is obtained from the persistent store. If the value is set to false, the request will not obtain property information, but only information to identify each object (used to create NSManagedObjectIDs.) If managed objects for these IDs are later faulted (as a result of attempting to access property values), they will incur subsequent access to the persistent store to obtain their property values. Defaults to true. 378 | private(set) var includesPropertyValues: Bool = true 379 | 380 | /// Get/set whether or not to accommodate the currently unsaved changes in the NSManagedObjectContext. When disabled, the query skips checking unsaved changes and only returns objects that matched the predicate in the persistent store. Defaults to true 381 | private(set) var includesPendingChanges: Bool = true 382 | 383 | /// Get/sets if the fetch request includes subentities. If set to false, the query will fetch objects of exactly the entity type of the request; if set to true, the request will include all subentities of the entity for the request. Defaults to true 384 | private(set) var includesSubentities: Bool = true 385 | 386 | /// Get/set the collection of either NSPropertyDescriptions or NSString property names that should be fetched. The collection may represent attributes, to-one relationships, or NSExpressionDescription. If resultType == Dictionaries, the results of the fetch will be dictionaries containing key/value pairs where the key is the name of the specified property description. If resultType == ManagedObjects, then NSExpressionDescription cannot be used, and the results are managed object faults partially pre-populated with the named properties 387 | private(set) var includeProperties: [AnyObject]? 388 | 389 | /// Get/set an array of relationship keypaths to prefetch along with the entity for the query. The array contains keypath strings in NSKeyValueCoding notation, as you would normally use with valueForKeyPath 390 | private(set) var includeRelationships: [String]? 391 | 392 | /// Get/set the result type you want from this query. Setting the value to .ManagedObjectIDs will demote any sort orderings to "best effort" hints if property values are not included in the request. 393 | public var resultType: QueryResultType = .ManagedObjects 394 | 395 | /** 396 | A convenience function for returns a configured NSFetchRequest based on this query 397 | 398 | - parameter entityName: The entity name to use for this request 399 | 400 | - returns: A newly configured NSFetchRequest 401 | */ 402 | func fetchRequestForEntityNamed(entityName: String) -> NSFetchRequest? { 403 | let request = NSFetchRequest(entityName: entityName) 404 | 405 | request.predicate = predicate 406 | request.sortDescriptors = sortDescriptors 407 | 408 | request.fetchBatchSize = fetchBatchSize 409 | request.fetchOffset = fetchOffset 410 | request.fetchLimit = fetchLimit 411 | 412 | request.returnsObjectsAsFaults = returnsObjectsAsFaults 413 | request.returnsDistinctResults = returnsDistinctResults 414 | 415 | request.includesPropertyValues = includesPropertyValues 416 | request.includesPendingChanges = includesPendingChanges 417 | request.includesSubentities = includesSubentities 418 | 419 | request.propertiesToFetch = includeProperties 420 | request.relationshipKeyPathsForPrefetching = includeRelationships 421 | 422 | request.resultType = resultType.toFetchRequestResultType() 423 | 424 | return request 425 | } 426 | 427 | } 428 | 429 | 430 | 431 | 432 | -------------------------------------------------------------------------------- /Pod/Classes/Readable.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | extension Readable { 29 | 30 | /** 31 | Copies the specified object into the current thread's context and returns it to the caller 32 | 33 | - parameter object: The object to copy 34 | 35 | - returns: The newly copied object 36 | */ 37 | public func copy(object: T) -> T { 38 | let objects = copy([object]) as [T] 39 | return objects.first! 40 | } 41 | 42 | /** 43 | Copies the specified objects into the current thread's context and returns them to the caller 44 | 45 | - parameter objs: The objects to copy 46 | 47 | - returns: The newly copied objects 48 | */ 49 | public func copy(objects objs: T...) -> [T] { 50 | return copy(objs) 51 | } 52 | 53 | /** 54 | Copies the specified objects into the current thread's context and returns them to the caller 55 | 56 | - parameter objects: The objects to copy 57 | 58 | - returns: The newly copied objects 59 | */ 60 | public func copy(objects: [T]) -> [T] { 61 | var results = [T]() 62 | 63 | for object in objects { 64 | if object.managedObjectContext == _stack().currentThreadContext() { 65 | results.append(object) 66 | } else { 67 | if let obj = _stack().currentThreadContext().objectWithID(object.objectID) as? T { 68 | results.append(obj) 69 | } 70 | } 71 | } 72 | 73 | return results 74 | } 75 | 76 | /** 77 | Returns the number of results that would be returned if a fe 78 | tch was performed using the specified query 79 | 80 | - parameter query: The query to perform 81 | 82 | - throws: An error will be thrown if the query cannot be performed 83 | 84 | - returns: The number of results 85 | */ 86 | public func count(query: Query) throws -> Int { 87 | let request = try fetchRequest(query) 88 | var error: NSError? 89 | let count = _stack().currentThreadContext().countForFetchRequest(request, error: &error) 90 | 91 | if let error = error { 92 | throw StackError.FetchError(error) 93 | } 94 | 95 | return count 96 | } 97 | 98 | /** 99 | Performs a fetch using the specified query and returns the results to the caller 100 | 101 | - parameter query: The query to perform 102 | 103 | - throws: An eror will be thrown if the query cannot be performed 104 | 105 | - returns: The resulting objects 106 | */ 107 | public func fetch(query: Query) throws -> [T] { 108 | let request = try fetchRequest(query) 109 | 110 | let stack = _stack() 111 | let context = stack.currentThreadContext() 112 | 113 | guard let results = try context.executeFetchRequest(request) as? [T] else { 114 | throw StackError.InvalidResultType(T.Type) 115 | } 116 | 117 | return results 118 | } 119 | 120 | /** 121 | Performs a fetch using the specified query and returns the first result 122 | 123 | - parameter query: The query to perform 124 | 125 | - throws: An error will be thrown is the query cannot be performed 126 | 127 | - returns: The resulting object or nil 128 | */ 129 | public func fetch(first query: Query) throws -> T? { 130 | return try fetch(query).first 131 | } 132 | 133 | /** 134 | Performs a fetch using the specified query and returns the last result 135 | 136 | - parameter query: The query to perform 137 | 138 | - throws: An error will be thrown is the query cannot be performed 139 | 140 | - returns: The resulting object or nil 141 | */ 142 | public func fetch(last query: Query) throws -> T? { 143 | return try fetch(query).first 144 | } 145 | 146 | /** 147 | A convenience method that converts this query into an NSFetchRequest 148 | 149 | - parameter query: The query to convert 150 | 151 | - throws: An error will be thrown is the entity name cannot be found or an entity couldn't be associated with the specified class (using generics) 152 | 153 | - returns: The resulting NSFetchRequest -- Note: this will not be configured 154 | */ 155 | internal func fetchRequest(query: Query) throws -> NSFetchRequest { 156 | guard let entityName = _stack().entityNameForManagedObjectClass(T) else { 157 | throw StackError.EntityNameNotFoundForClass(T) 158 | } 159 | 160 | guard let request = query.fetchRequestForEntityNamed(entityName) else { 161 | throw StackError.EntityNotFoundInStack(_stack(), entityName) 162 | } 163 | 164 | return request 165 | } 166 | 167 | } 168 | 169 | -------------------------------------------------------------------------------- /Pod/Classes/Stack.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | private let StackThreadContextKey = "stack_context" 29 | 30 | /// This class is responsible for listening for NSNotification's on context changes. It exists purely as a convenience, so that we don't have to subclass NSObject on our Stack! 31 | class StackContextHandler: NSObject { 32 | 33 | unowned var stack: Stack 34 | 35 | init(stack: Stack) { 36 | self.stack = stack 37 | } 38 | 39 | // Called when an NSManagedObjectContext posts changes 40 | func contextDidSaveContext(note: NSNotification) { 41 | stack.contextDidSaveContext(note, contextHandler: self) 42 | } 43 | 44 | } 45 | 46 | /// A Stack is a CoreData wrapper that provides a type-safe implementation for reading and writing to CoreData 47 | public final class Stack: CustomStringConvertible, Readable { 48 | 49 | /// The context handler that will listen for notifications. Only used when stackType = .ManualMerge 50 | private var contextHandler: StackContextHandler? 51 | 52 | /// Returns a string representation of the Stack's configuration 53 | public var description: String { 54 | return configuration.description 55 | } 56 | 57 | /// Holds onto the various Stacks in your application (1 or more) 58 | private static var stacks = { return [String: Stack]() }() 59 | 60 | /// The persistent coordinator associated with this stack 61 | private let coordinator: NSPersistentStoreCoordinator 62 | 63 | /// The configuration associated with this stack 64 | private let configuration: StackConfiguration 65 | 66 | /// The root context. Used only when stackType != .ManualMerge 67 | lazy var rootContext: NSManagedObjectContext = { 68 | let context = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType) 69 | context.persistentStoreCoordinator = self.coordinator 70 | return context 71 | }() 72 | 73 | /// The main thread context. 74 | private lazy var mainContext: NSManagedObjectContext = { 75 | let context = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) 76 | if self.configuration.stackType == .ManualMerge { 77 | context.persistentStoreCoordinator = self.coordinator 78 | } else { 79 | context.parentContext = self.rootContext 80 | } 81 | 82 | return context 83 | }() 84 | 85 | /** 86 | Returns a context associated with the current thread. This function may return an existing context, however if none exist, it will create one, add it to the threadDictionary and return it 87 | 88 | - returns: An NSManagedObjectContext that can be used on the current thread 89 | */ 90 | func currentThreadContext() -> NSManagedObjectContext { 91 | if NSThread.isMainThread() || configuration.stackType == .MainThreadOnly { 92 | return mainContext 93 | } 94 | 95 | if let context = NSThread.currentThread().threadDictionary[StackThreadContextKey] as? NSManagedObjectContext { 96 | return context 97 | } 98 | 99 | let context = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType) 100 | 101 | switch configuration.stackType { 102 | case .ParentChild: 103 | context.parentContext = mainContext 104 | default: 105 | context.persistentStoreCoordinator = coordinator 106 | } 107 | 108 | NSThread.currentThread().threadDictionary[StackThreadContextKey] = context 109 | return context 110 | } 111 | 112 | /** 113 | Adds a new Stack 114 | 115 | - parameter name: The name for this stack. Must be unique! 116 | - parameter configure: The configuration to apply to this Stack 117 | */ 118 | public class func add(name: String, configure: ((_: StackConfiguration) -> ())?) { 119 | let config = StackConfiguration(name: name) 120 | configure?(config) 121 | 122 | let stack = Stack(config: config) 123 | stacks[name] = stack 124 | } 125 | 126 | /** 127 | Returns the entity name associated with the specified NSManagedObject class 128 | 129 | - parameter objectClass: The object 130 | 131 | - returns: The entity name for this managedObject class or nil if not found 132 | */ 133 | func entityNameForManagedObjectClass(managedObjectClass: AnyClass) -> String? { 134 | let entities = coordinator.managedObjectModel.entitiesByName.values 135 | 136 | for entity in entities { 137 | if entity.managedObjectClassName == NSStringFromClass(managedObjectClass) { 138 | return entity.name 139 | } 140 | } 141 | 142 | return nil 143 | } 144 | 145 | public class func stack(named name: String) -> Stack? { 146 | guard let stack = stacks[name] else { 147 | if name != DefaultConfiguration.name { 148 | print("Stack: attempted to load a stack named '\(name)' that doesn't exist. Use Stack.add(name, config) first.") 149 | } 150 | return nil 151 | } 152 | 153 | return stack 154 | } 155 | 156 | private init(config: StackConfiguration) { 157 | self.configuration = config 158 | 159 | let model = NSManagedObjectModel.mergedModelFromBundles(nil) 160 | precondition(model != nil, "Stack: A valid NSManagedObjectModel must be provided!") 161 | coordinator = NSPersistentStoreCoordinator(managedObjectModel: model!) 162 | 163 | do { 164 | var storeType: String! 165 | 166 | switch config.persistenceType { 167 | case .Binary: 168 | storeType = NSBinaryStoreType 169 | case .MemoryOnly: 170 | storeType = NSInMemoryStoreType 171 | default: 172 | storeType = NSSQLiteStoreType 173 | } 174 | 175 | let filename = config.name 176 | let pathExtension = config.persistenceType == .SQLite ? ".sqlite" : ".bin" 177 | let path = NSURL(string: filename + pathExtension, relativeToURL: config.storeURL) 178 | try coordinator.addPersistentStoreWithType(storeType, configuration: nil, URL: path, options: config.storeOptions) 179 | } catch { 180 | print("Unable to add a persistent store for configuration: \(config)") 181 | } 182 | 183 | if config.stackType == .ManualMerge { 184 | contextHandler = StackContextHandler(stack: self) 185 | NSNotificationCenter.defaultCenter().addObserver(contextHandler!, selector: #selector(StackContextHandler.contextDidSaveContext(_:)), name: NSManagedObjectContextDidSaveNotification, object: nil) 186 | } 187 | } 188 | 189 | deinit { 190 | if configuration.stackType == .ManualMerge { 191 | NSNotificationCenter.defaultCenter().removeObserver(contextHandler!, name: NSManagedObjectContextDidSaveNotification, object: rootContext) 192 | } 193 | } 194 | 195 | func contextDidSaveContext(note: NSNotification, contextHandler: StackContextHandler) { 196 | if note.object === mainContext { 197 | return 198 | } 199 | 200 | if let info = note.userInfo { 201 | let userInfo = NSDictionary(dictionary: info) 202 | 203 | if let updated = userInfo.objectForKey(NSUpdatedObjectsKey) as? Set { 204 | for object in updated { 205 | do { try mainContext.existingObjectWithID(object.objectID) } catch { } 206 | } 207 | } 208 | } 209 | 210 | dispatch_async(dispatch_get_main_queue()) { () -> Void in 211 | self.mainContext.mergeChangesFromContextDidSaveNotification(note) 212 | } 213 | } 214 | 215 | public func write(transaction: (transaction: Transaction) throws -> Void, completion: ((NSError?) -> Void)?) { 216 | let block: () -> () = { [unowned self] in 217 | do { 218 | try transaction(transaction: Transaction(stack: self, context: self.currentThreadContext())) 219 | self.currentThreadContext().save(true, completion: completion) 220 | } catch { 221 | completion?(error as NSError) 222 | } 223 | } 224 | 225 | currentThreadContext().performBlockAndWait(block) 226 | } 227 | } 228 | 229 | // MARK: OSX Additions 230 | 231 | extension Stack { 232 | 233 | #if os(OSX) 234 | 235 | /** 236 | Provided as a convenience for OSX only -- since a lot of bindings rely on having access to an NSManagedObjectContext 237 | 238 | - returns: The NSManagedObjectContext for use ONLY on the main queue 239 | */ 240 | public func mainThreadContext() -> NSManagedObjectContext { 241 | return mainContext 242 | } 243 | #endif 244 | 245 | } 246 | 247 | // MARK: Default Stack 248 | 249 | extension Stack { 250 | 251 | /// Returns the default Stack name 252 | private static let DefaultName = "Default" 253 | 254 | /** 255 | Returns a default Stack instance that uses the default configuration. You can modify the configuration by calling Stack.configureDefaults() early in your applications lifecycle 256 | 257 | - returns: The default Stack 258 | */ 259 | public static func defaultStack() -> Stack { 260 | if let stack = Stack.stack(named: DefaultName) { 261 | return stack 262 | } 263 | 264 | let stack = Stack(config: DefaultConfiguration) 265 | stacks[DefaultName] = stack 266 | return stack 267 | } 268 | 269 | /// Private: Returns the default Stack configuration 270 | private static var DefaultConfiguration: StackConfiguration = { 271 | return StackConfiguration(name: DefaultName) 272 | }() 273 | 274 | /** 275 | Provides a convenience function for configuring the default Stack before its initialized 276 | 277 | - parameter configure: The configuration to apply 278 | */ 279 | public class func configureDefaults(configure: (_: StackConfiguration) -> ()) { 280 | let configuration = StackConfiguration(name: DefaultName) 281 | configure(configuration) 282 | DefaultConfiguration = configuration 283 | } 284 | 285 | 286 | } 287 | 288 | 289 | 290 | 291 | -------------------------------------------------------------------------------- /Pod/Classes/StackConfiguration.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | /** 29 | Defines the type of persistence you want to support 30 | 31 | - SQLite: Your Stack will be backed by an SQLite database 32 | - Binary: Your Stack will be serialized to disk as a binary file 33 | - MemoryOnly: Your Stack will never be persisted to disk, and will only exist in memory 34 | */ 35 | public enum StackPersistenceType: String { 36 | case SQLite 37 | case Binary 38 | case MemoryOnly 39 | } 40 | 41 | /** 42 | Defines the type of setup you want for your NSManagedObjectContext's 43 | 44 | - ParentChild: Your stack will use parent-child NSManagedObjectContext's (recommended for simplicity with some performance wins) 45 | - MainThreadOnly: Your stack will use ONLY a main queue context, dispatching to the main thread if necessary (optimal for simple UI only based apps) 46 | - ManualMerge: Your stack will use background contexts, but handle merging manually (optimal for large data access) 47 | */ 48 | public enum StackType { 49 | case ParentChild 50 | case MainThreadOnly 51 | case ManualMerge 52 | } 53 | 54 | 55 | /// A Stack Configuration is used to setup and configure your Stack 56 | public final class StackConfiguration: CustomStringConvertible { 57 | 58 | /// Returns a string representation of the current configuration 59 | public var description: String { return 60 | " name:\t\t\t\(name)" + 61 | "\n bundle:\t\t\(bundle.bundlePath)" + 62 | "\n storeURL:\t\t\(storeURL)" + 63 | "\n options:\t\t\(storeOptions)" + 64 | "\n type:\t\t\t\(stackType)" 65 | } 66 | 67 | /// Returns the name that will be used for the Stack. Defaults to CFBundleName 68 | public private(set) var name: String 69 | 70 | /// Get/set the persistence type to use for your Stack. Defaults to .SQLite 71 | public var persistenceType: StackPersistenceType = .SQLite 72 | 73 | /// Get/set the context configuration to use for your Stack. Defaults to .ParentChild 74 | public var stackType: StackType = .ParentChild 75 | 76 | /// Get/set the options you want to use to configure your NSPersistentStore 77 | public lazy var storeOptions: [NSObject : AnyObject] = { 78 | return [ 79 | NSMigratePersistentStoresAutomaticallyOption: true, 80 | NSInferMappingModelAutomaticallyOption: true 81 | ] 82 | }() 83 | 84 | /// Get/set the bundle where your model can be loaded from. Defaults to NSBundle.mainBundle() 85 | public lazy var bundle: NSBundle = { 86 | return NSBundle.mainBundle() 87 | }() 88 | 89 | /// Get/set the storeURL where your Stack will be stored. Defaults to $APP_DIR/Documents (Note: this does not include filename or extension) 90 | public lazy var storeURL: NSURL = { 91 | return NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true).first!) 92 | }() 93 | 94 | /** 95 | Private: Initializes this configuration with the specified name 96 | 97 | - parameter name: The name to apply for this configuration. Will be used for your Stack name and filename. 98 | 99 | - returns: A new configuration instance 100 | */ 101 | init(name: String) { 102 | self.name = name 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /Pod/Classes/StackTypes.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | /** 29 | * Provides a protocol for any class that supports Reading from a Stack 30 | */ 31 | public protocol Readable: StackSupport { 32 | 33 | /** 34 | Copies the specified object into the current thread's context and returns it to the caller 35 | */ 36 | func copy(object: T) -> T 37 | 38 | /** 39 | Copies the specified objects into the current thread's context and returns them to the caller 40 | */ 41 | func copy(objects objs: T...) -> [T] 42 | 43 | /** 44 | Copies the specified objects into the current thread's context and returns them to the caller 45 | */ 46 | func copy(objects: [T]) -> [T] 47 | 48 | /** 49 | Returns the number of results that would be returned if a fetch was performed using the specified query 50 | */ 51 | func count(query: Query) throws -> Int 52 | 53 | /** 54 | Performs a fetch using the specified query and returns the results to the caller 55 | */ 56 | func fetch(query: Query) throws -> [T] 57 | 58 | /** 59 | Performs a fetch using the specified query and returns the first result 60 | */ 61 | func fetch(first query: Query) throws -> T? 62 | 63 | /** 64 | Performs a fetch using the specified query and returns the last result 65 | */ 66 | func fetch(last query: Query) throws -> T? 67 | 68 | } 69 | 70 | /** 71 | * Provides a protocol for any class that supports Writing to a Stack 72 | */ 73 | public protocol Writable { 74 | 75 | /** 76 | Inserts a new entity of the specified class. Usage: `insert() as EntityName` 77 | */ 78 | func insert() throws -> T 79 | 80 | /** 81 | Fetches (or inserts if not found) an entity with the specified identifier 82 | */ 83 | func fetchOrInsert(key: String, identifier: U) throws -> T 84 | 85 | /** 86 | Fetches (or inserts if not found) entities with the specified identifiers 87 | */ 88 | func fetchOrInsert(key: String, identifiers: [U]) throws -> [T] 89 | 90 | /** 91 | Performs a fetch using the specified NSManagedObjectID 92 | */ 93 | func fetch(objectWithID objectID: NSManagedObjectID) throws -> T? 94 | 95 | /** 96 | Deletes the specified objects 97 | */ 98 | func delete(objects: T...) throws 99 | 100 | /** 101 | Deletes the specified objects 102 | */ 103 | func delete(objects objects: [T]) throws 104 | 105 | } 106 | 107 | // MARK: Error Handling 108 | 109 | /** 110 | Used throughout Stack to provide finer grained error handling 111 | 112 | - EntityNameNotFoundForClass: The entity name you queried, couldn't be located for the specified class type 113 | - EntityNotFoundInStack: The entity could not be found in Stack. Generally indicates your class no longer maps to a valid entity in your model 114 | - InvalidResultType: The result type expected from a fetch request was invalid 115 | - FetchError: A generic error occurred 116 | */ 117 | public enum StackError: ErrorType { 118 | case EntityNameNotFoundForClass(AnyClass) 119 | case EntityNotFoundInStack(Stack, String) 120 | case InvalidResultType(AnyClass.Type) 121 | case FetchError(NSError?) 122 | } 123 | 124 | // MARK: NSManagedObject Identifiers 125 | 126 | 127 | /** 128 | * Defines a protocol that all NSManagedObject key's must conform to in order to be used as an identifier 129 | */ 130 | public protocol StackManagedKey: NSObjectProtocol, Equatable, Hashable, CVarArgType { } 131 | extension NSObject: StackManagedKey { } 132 | 133 | /** 134 | * Defines a protocol that all 135 | */ 136 | public protocol StackManagedObject { } 137 | extension NSManagedObject: StackManagedObject { } 138 | 139 | 140 | // MARK: Stack Support 141 | 142 | 143 | /** 144 | * Classes conforming to this protocol can provide access to a Stack 145 | */ 146 | public protocol StackSupport { 147 | 148 | /** 149 | Provides internal access to the stack. 150 | */ 151 | func _stack() -> Stack 152 | 153 | } 154 | 155 | extension Readable where Self: Stack { 156 | 157 | /** 158 | Provides stack support for all classes conforming to Readable 159 | */ 160 | public func _stack() -> Stack { 161 | return self 162 | } 163 | 164 | } 165 | 166 | extension Readable where Self: Transaction { 167 | 168 | /** 169 | Provides stack support for all classes conforming to Readable 170 | */ 171 | public func _stack() -> Stack { 172 | return self.stack 173 | } 174 | 175 | } 176 | 177 | -------------------------------------------------------------------------------- /Pod/Classes/Transaction.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2015 Shaps Mohsenin. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY SHAPS MOHSENIN `AS IS' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL THE APP BUSINESS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | import CoreData 27 | 28 | /// A transaction provides a type-safe implementation for performing any write action to CoreData 29 | public class Transaction: Readable, Writable { 30 | 31 | /// Returns the stack associated with this transaction 32 | private(set) var stack: Stack 33 | 34 | /// Returns the context associated with this transaction 35 | private(set) var context: NSManagedObjectContext 36 | 37 | /** 38 | Internal: Initializes a new transaction for the specified Stack 39 | 40 | - parameter stack: The stack this transaction will be applied to 41 | - parameter context: The context this transaction will be applied to 42 | 43 | - returns: A new Transaction 44 | */ 45 | init(stack: Stack, context: NSManagedObjectContext) { 46 | self.stack = stack 47 | self.context = context 48 | } 49 | 50 | /** 51 | Inserts a new entity of the specified class. Usage: `insert() as EntityName` 52 | */ 53 | public func insert() throws -> T { 54 | guard let entityName = stack.entityNameForManagedObjectClass(T) where entityName != NSStringFromClass(NSManagedObject) else { 55 | throw StackError.EntityNameNotFoundForClass(T) 56 | } 57 | 58 | guard let object = NSEntityDescription.insertNewObjectForEntityForName(entityName, inManagedObjectContext: context) as? T else { 59 | throw StackError.EntityNotFoundInStack(stack, entityName) 60 | } 61 | 62 | return object as T 63 | } 64 | 65 | /** 66 | Fetches (or inserts if not found) an entity with the specified identifier 67 | */ 68 | public func fetchOrInsert(key: String, identifier: U) throws -> T { 69 | let results = try fetchOrInsert(key, identifiers: [identifier]) as [T] 70 | return results.first! 71 | } 72 | 73 | /** 74 | Fetches (or inserts if not found) entities with the specified identifiers 75 | */ 76 | public func fetchOrInsert(key: String, identifiers: [U]) throws -> [T] { 77 | let query = Query(key: key, identifiers: identifiers) 78 | let request = try fetchRequest(query) 79 | 80 | guard let results = try context.executeFetchRequest(request) as? [T] else { 81 | throw StackError.FetchError(nil) 82 | } 83 | 84 | if results.count == identifiers.count { 85 | return results 86 | } 87 | 88 | var objects = [T]() 89 | if let existingIds = (results as NSArray).valueForKey(key) as? [U] { 90 | for id in identifiers { 91 | if !existingIds.contains(id) { 92 | let result = try insert() as T 93 | result.setValue(id, forKeyPath: key) 94 | objects.append(result) 95 | } 96 | } 97 | } 98 | 99 | return objects as [T] 100 | } 101 | 102 | /** 103 | Performs a fetch using the specified NSManagedObjectID 104 | 105 | - parameter objectID: The objectID to use for this fetch 106 | 107 | - throws: An error will be thrown if the query cannot be performed 108 | 109 | - returns: The resulting object or nil 110 | */ 111 | public func fetch(objectWithID objectID: NSManagedObjectID) throws -> T? { 112 | let stack = _stack() 113 | let context = stack.currentThreadContext() 114 | 115 | return try context.existingObjectWithID(objectID) as? T 116 | } 117 | 118 | /** 119 | Deletes the specified objects 120 | */ 121 | public func delete(objects: T...) throws { 122 | try delete(objects: objects) 123 | } 124 | 125 | /** 126 | Deletes the specified objects 127 | */ 128 | public func delete(objects objects: [T]) throws { 129 | for object in objects { 130 | context.deleteObject(object) 131 | } 132 | } 133 | 134 | } 135 | 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Stack Logo 2 | 3 | # Stack 4 | 5 | [![CI Status](http://img.shields.io/travis/shaps80/Stack.svg?style=flat)](https://travis-ci.org/shaps80/Stack) 6 | [![Version](https://img.shields.io/cocoapods/v/Stack.svg?style=flat)](http://cocoadocs.org/docsets/Stack) 7 | [![Language](https://img.shields.io/badge/language-swift-ff69b4.svg)](http://cocoadocs.org/docsets/Stack) 8 | [![Platform](https://img.shields.io/cocoapods/p/Stack.svg?style=flat)](http://cocoadocs.org/docsets/Stack) 9 | 10 | Wouldn't it be great to have a type-safe CoreData Stack? 11 | 12 | __Reading__ 13 | 14 | ```swift 15 | let stack = Stack.defaultStack() 16 | let query = Query().sort(byKey: "name", direction: .Ascending).filter("name == %@", name) 17 | let results = try! stack.fetch(query) 18 | print(results.first?.name) 19 | ``` 20 | 21 | __Writing__ 22 | 23 | ```swift 24 | let stack = Stack.defaultStack() 25 | stack.write({ (transaction) -> Void in 26 | let person = try transaction.fetchOrInsert("name", identifier: name) as Person 27 | person.age = 35 28 | }, completion: nil) 29 | ``` 30 | 31 | ## Introducing Stack 32 | 33 | CoreData is a powerful API, but its easily misused and misunderstood. Stack attempts to remove many of the issues associated with using CoreData in your applications. 34 | 35 | Specifically, Stack adds both type-safety and thread-safety (ish) methods for dealing with queries and updates. 36 | 37 | Additionally, Stack provides a much more expressive API through features like: 38 | 39 | * Type-safe inserts, updates and deletes 40 | * Query chaining 41 | * Custom Query class for setting up sorting, filtering, etc... 42 | * Transaction based API -- No access to contexts! 43 | * Asynchronous 44 | * Lightweight -- Swift function overloads allow the API to remain clean and concise 45 | * NSFetchedResultsController support -- convenience init() 46 | * See [Documentation](http://cocoadocs.org/docsets/Stack/2.0.0) for more... 47 | 48 | ## Goal 49 | 50 | The aim of Stack is to provide a clean, expressive abstraction from CoreData. Giving you the flexibility and power of CoreData, without all the headache surrounding contexts and thread management. 51 | 52 | With Swift, Stack now supports type-safe queries giving you more confidence when implementing CoreData in your applications. 53 | 54 | Stack 2.0 provides read-only access through the Stack itself, moving all write methods into a transaction. This prevents you from making mistakes and attempting to update objects outside of a transaction. 55 | 56 | Stack is used in various production apps, but I still consider it an ever changing concept so input is welcome :) 57 | 58 | ## Need to Know 59 | 60 | __Reading__ 61 | 62 | Once you have a Stack, reading is easy. You just need to construct a query and then call one of the `fetch` methods on your stack. Note: The optional is required since a fetch may return nil. 63 | 64 | ```swift 65 | let stack = Stack.defaultStack() 66 | let query= Query(key: "name", identifier: "Shaps") 67 | let person = try! stack.fetch(query).first 68 | print(person?.name) 69 | ``` 70 | 71 | Now we can update that same object. Note: Thanks to Swift closures, we can safely re-define the variable with the same name. 72 | 73 | __Writing__ 74 | 75 | ```swift 76 | let stack = Stack.defaultStack() 77 | stack.write({ (transaction) -> Void in 78 | let person = transaction.copy(person) 79 | person.age = 35 80 | }, completion: nil) 81 | ``` 82 | 83 | As you can see, all write actions occur ONLY inside a transaction, which prevents many common mistakes when implementing CoreData. 84 | 85 | You probably noticed that `copy()` function? This is another nice feature provided by Stack. Basically it will copy the object(s) into the current transaction/context so you don't try to modify an object on the wrong thread. And don't worry, all changes will be propogated to your other threads automatically ;) 86 | 87 | ## Docs 88 | 89 | To learn more about how to use Stack. Checkout the included example project, read over the unit tests or checkout the [documentation](https://github.com/shaps80/Stack/wiki). 90 | 91 | ## Usage 92 | 93 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 94 | 95 | ## Installation 96 | 97 | Stack is available through [CocoaPods](http://cocoapods.org). To install 98 | it, simply add the following line to your Podfile: 99 | 100 | pod "Stack" 101 | 102 | ## Author 103 | 104 | Shaps, shapsuk@me.com 105 | 106 | ## License 107 | 108 | Stack is available under the MIT license. See the LICENSE file for more info. 109 | 110 | ## Attribution 111 | 112 | * All code is my own, no 3rd party code is used in this project at all. 113 | 114 | -------------------------------------------------------------------------------- /Stack.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Stack" 3 | s.version = "2.0.0" 4 | s.summary = "A Type-Safe, Thread-Safe-ish approach to CoreData in Swift" 5 | s.homepage = "https://github.com/shaps80/Stack" 6 | s.license = 'MIT' 7 | s.author = { "Shaps Mohsenin" => "shapsuk@me.com" } 8 | s.source = { :git => "https://github.com/shaps80/Stack.git", :tag => s.version.to_s } 9 | s.social_media_url = 'https://twitter.com/shaps' 10 | s.platforms = { :ios => "8.0", :osx => "10.10" } 11 | s.requires_arc = true 12 | s.source_files = 'Pod/Classes/**/*.swift' 13 | s.frameworks = 'Foundation', 'CoreData' 14 | end 15 | -------------------------------------------------------------------------------- /assets/stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaps80/Stack/2b6963e0232a735789fe0bfd640227a9ae20a3ff/assets/stack.png -------------------------------------------------------------------------------- /assets/stack@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaps80/Stack/2b6963e0232a735789fe0bfd640227a9ae20a3ff/assets/stack@2x.png --------------------------------------------------------------------------------