├── .gitignore
├── .idea
├── .name
├── OatmealFramework.iml
├── encodings.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── vcs.xml
├── workspace.xml
└── xcode.xml
├── .travis.yml
├── Example
├── .idea
│ ├── .name
│ ├── Example.iml
│ ├── encodings.xml
│ ├── inspectionProfiles
│ │ ├── Project_Default.xml
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations
│ │ ├── Oatmeal.xml
│ │ └── Oatmeal_Example.xml
│ ├── vcs.xml
│ ├── workspace.xml
│ └── xcode.xml
├── Oatmeal.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Oatmeal-Example.xcscheme
├── Oatmeal.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── Oatmeal.xcscmblueprint
├── Oatmeal
│ ├── Album.swift
│ ├── App.txt
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── Framework.playground
│ │ ├── Contents.swift
│ │ ├── contents.xcplayground
│ │ ├── playground.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── timeline.xctimeline
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── cry.imageset
│ │ │ ├── Contents.json
│ │ │ └── cry.png
│ │ └── oatmeal.imageset
│ │ │ ├── 1440384920_arroz.png
│ │ │ └── Contents.json
│ ├── Info.plist
│ ├── Models
│ │ ├── Github.swift
│ │ └── Owner.swift
│ ├── Person.swift
│ ├── Providers
│ │ ├── AppServiceProvider.swift
│ │ └── OatmealServiceProvider.swift
│ ├── Router.swift
│ ├── Settings.plist
│ ├── Song.swift
│ ├── ViewPresentor.swift
│ └── ViewsController.swift
├── Oatmeal_Example.entitlements
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Alamofire
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── Alamofire.swift
│ │ │ ├── Download.swift
│ │ │ ├── Error.swift
│ │ │ ├── Manager.swift
│ │ │ ├── MultipartFormData.swift
│ │ │ ├── NetworkReachabilityManager.swift
│ │ │ ├── Notifications.swift
│ │ │ ├── ParameterEncoding.swift
│ │ │ ├── Request.swift
│ │ │ ├── Response.swift
│ │ │ ├── ResponseSerialization.swift
│ │ │ ├── Result.swift
│ │ │ ├── ServerTrustPolicy.swift
│ │ │ ├── Stream.swift
│ │ │ ├── Timeline.swift
│ │ │ ├── Upload.swift
│ │ │ └── Validation.swift
│ ├── AlamofireImage
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── Image.swift
│ │ │ ├── ImageCache.swift
│ │ │ ├── ImageDownloader.swift
│ │ │ ├── ImageFilter.swift
│ │ │ ├── Request+AlamofireImage.swift
│ │ │ ├── UIButton+AlamofireImage.swift
│ │ │ ├── UIImage+AlamofireImage.swift
│ │ │ └── UIImageView+AlamofireImage.swift
│ ├── Carlos
│ │ ├── Carlos
│ │ │ ├── BasicCache.swift
│ │ │ ├── BasicFetcher.swift
│ │ │ ├── CacheLevel+Batch.swift
│ │ │ ├── CacheProvider+iOS.swift
│ │ │ ├── CacheProvider.swift
│ │ │ ├── Carlos.swift
│ │ │ ├── Composed.swift
│ │ │ ├── ComposedOneWayTransformer.swift
│ │ │ ├── ComposedTwoWayTransformer.swift
│ │ │ ├── ConcurrentOperation.swift
│ │ │ ├── Conditioned.swift
│ │ │ ├── ConditionedOneWayTransformer.swift
│ │ │ ├── ConditionedOutputProcessing.swift
│ │ │ ├── ConditionedTwoWayTransformer.swift
│ │ │ ├── ConditionedValueTransformation.swift
│ │ │ ├── Crypto.swift
│ │ │ ├── DeferredCacheRequestOperation.swift
│ │ │ ├── DiskCacheLevel.swift
│ │ │ ├── Dispatched.swift
│ │ │ ├── Errors.swift
│ │ │ ├── ExpensiveObject+iOS.swift
│ │ │ ├── ExpensiveObject.swift
│ │ │ ├── Extensions.swift
│ │ │ ├── FetcherValueTransformation.swift
│ │ │ ├── GenericOperation.swift
│ │ │ ├── ImageTransformer+iOS.swift
│ │ │ ├── JSONTransformer.swift
│ │ │ ├── KeyTransformation.swift
│ │ │ ├── Logger.swift
│ │ │ ├── MemoryCacheLevel.swift
│ │ │ ├── MemoryWarning.swift
│ │ │ ├── NSKeyedUnarchiver+SwiftUtilities.h
│ │ │ ├── NSKeyedUnarchiver+SwiftUtilities.m
│ │ │ ├── NSUserDefaultsCacheLevel.swift
│ │ │ ├── NetworkFetcher.swift
│ │ │ ├── Normalize.swift
│ │ │ ├── OneWayTransformer.swift
│ │ │ ├── PoolCache.swift
│ │ │ ├── PostProcess.swift
│ │ │ ├── RequestCapperCache.swift
│ │ │ ├── StringConvertible.swift
│ │ │ ├── StringTransformer.swift
│ │ │ ├── SwitchCache.swift
│ │ │ ├── Transformers.swift
│ │ │ ├── TwoWayTransformer.swift
│ │ │ └── ValueTransformation.swift
│ │ ├── LICENSE
│ │ └── README.md
│ ├── Local Podspecs
│ │ ├── Oatmeal.podspec.json
│ │ └── SwiftyJSON.podspec.json
│ ├── Manifest.lock
│ ├── PiedPiper
│ │ ├── LICENSE
│ │ ├── PiedPiper
│ │ │ ├── FunctionComposition.swift
│ │ │ ├── Future+Filter.swift
│ │ │ ├── Future+FlatMap.swift
│ │ │ ├── Future+Map.swift
│ │ │ ├── Future+Merge.swift
│ │ │ ├── Future+Recover.swift
│ │ │ ├── Future+Reduce.swift
│ │ │ ├── Future+Traverse.swift
│ │ │ ├── Future+Zip.swift
│ │ │ ├── Future.swift
│ │ │ ├── GCD.swift
│ │ │ ├── Promise.swift
│ │ │ ├── ReadWriteLock.swift
│ │ │ ├── Result+Filter.swift
│ │ │ ├── Result+Map.swift
│ │ │ ├── Result+flatMap.swift
│ │ │ └── Result.swift
│ │ └── README.md
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Oatmeal.xcscheme
│ ├── SwiftyJSON
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ └── SwiftyJSON.swift
│ └── Target Support Files
│ │ ├── Alamofire
│ │ ├── Alamofire-dummy.m
│ │ ├── Alamofire-prefix.pch
│ │ ├── Alamofire-umbrella.h
│ │ ├── Alamofire.modulemap
│ │ ├── Alamofire.xcconfig
│ │ └── Info.plist
│ │ ├── AlamofireImage
│ │ ├── AlamofireImage-dummy.m
│ │ ├── AlamofireImage-prefix.pch
│ │ ├── AlamofireImage-umbrella.h
│ │ ├── AlamofireImage.modulemap
│ │ ├── AlamofireImage.xcconfig
│ │ └── Info.plist
│ │ ├── Carlos
│ │ ├── Carlos-dummy.m
│ │ ├── Carlos-prefix.pch
│ │ ├── Carlos-umbrella.h
│ │ ├── Carlos.modulemap
│ │ ├── Carlos.xcconfig
│ │ └── Info.plist
│ │ ├── Oatmeal
│ │ ├── Info.plist
│ │ ├── Oatmeal-dummy.m
│ │ ├── Oatmeal-prefix.pch
│ │ ├── Oatmeal-umbrella.h
│ │ ├── Oatmeal.modulemap
│ │ └── Oatmeal.xcconfig
│ │ ├── PiedPiper
│ │ ├── Info.plist
│ │ ├── PiedPiper-dummy.m
│ │ ├── PiedPiper-prefix.pch
│ │ ├── PiedPiper-umbrella.h
│ │ ├── PiedPiper.modulemap
│ │ └── PiedPiper.xcconfig
│ │ ├── Pods-Oatmeal_Example
│ │ ├── Info.plist
│ │ ├── Pods-Oatmeal_Example-acknowledgements.markdown
│ │ ├── Pods-Oatmeal_Example-acknowledgements.plist
│ │ ├── Pods-Oatmeal_Example-dummy.m
│ │ ├── Pods-Oatmeal_Example-frameworks.sh
│ │ ├── Pods-Oatmeal_Example-resources.sh
│ │ ├── Pods-Oatmeal_Example-umbrella.h
│ │ ├── Pods-Oatmeal_Example.debug.xcconfig
│ │ ├── Pods-Oatmeal_Example.modulemap
│ │ └── Pods-Oatmeal_Example.release.xcconfig
│ │ ├── Pods-Oatmeal_Tests
│ │ ├── Info.plist
│ │ ├── Pods-Oatmeal_Tests-acknowledgements.markdown
│ │ ├── Pods-Oatmeal_Tests-acknowledgements.plist
│ │ ├── Pods-Oatmeal_Tests-dummy.m
│ │ ├── Pods-Oatmeal_Tests-frameworks.sh
│ │ ├── Pods-Oatmeal_Tests-resources.sh
│ │ ├── Pods-Oatmeal_Tests-umbrella.h
│ │ ├── Pods-Oatmeal_Tests.debug.xcconfig
│ │ ├── Pods-Oatmeal_Tests.modulemap
│ │ └── Pods-Oatmeal_Tests.release.xcconfig
│ │ └── SwiftyJSON
│ │ ├── Info.plist
│ │ ├── SwiftyJSON-dummy.m
│ │ ├── SwiftyJSON-prefix.pch
│ │ ├── SwiftyJSON-umbrella.h
│ │ ├── SwiftyJSON.modulemap
│ │ └── SwiftyJSON.xcconfig
└── Tests
│ ├── Info.plist
│ └── Tests.swift
├── LICENSE
├── Oatmeal.podspec
├── Pod
├── Assets
│ └── .gitkeep
└── Classes
│ ├── .gitkeep
│ ├── Assets
│ ├── AtlasPipeline.swift
│ └── ImagePipeline.swift
│ ├── Cache
│ ├── FileCache.swift
│ └── MemoryCache.swift
│ ├── CloudStorage.swift
│ ├── Config
│ ├── Configuration.swift
│ └── Setting.swift
│ ├── Container
│ ├── Container.swift
│ ├── ContainerOperators.swift
│ ├── NullElement.swift
│ ├── Provider.swift
│ └── Reflections.swift
│ ├── ContainerException.swift
│ ├── Contracts
│ ├── Autoresolves.swift
│ ├── Cacheable.swift
│ ├── DidSerialize .swift
│ ├── Eventable.swift
│ ├── Loggable.swift
│ ├── Modelable.swift
│ ├── Oatmeal.swift
│ ├── Pipeable.swift
│ ├── ProactiveResolvable.swift
│ ├── Resolveable.swift
│ ├── ServiceProvider.swift
│ ├── Storageable.swift
│ └── UsesEvents.swift
│ ├── Controller.swift
│ ├── Events
│ ├── Event.swift
│ └── Events.swift
│ ├── Extensions
│ ├── AutoresolvableEntity.swift
│ ├── CachePipe.swift
│ ├── Modelable+Entity.swift
│ ├── ResolveableEntity.swift
│ └── Swift
│ │ ├── Array.swift
│ │ ├── AutoCurry.swift
│ │ ├── Cent.h
│ │ ├── Date.swift
│ │ ├── Dictionary.swift
│ │ ├── Dollar.h
│ │ ├── Dollar.swift
│ │ ├── Int.swift
│ │ ├── Range.swift
│ │ ├── Regex.swift
│ │ └── String.swift
│ ├── FileStorage.swift
│ ├── Log
│ ├── FileLog.swift
│ ├── HttpLog.swift
│ └── LogType.swift
│ ├── Model
│ ├── Autoresolveable.swift
│ ├── Model.swift
│ └── StorageTypes.swift
│ ├── Networking
│ ├── Networking.swift
│ ├── Reachability.swift
│ ├── RequestType.swift
│ ├── ResponseHandler.swift
│ ├── Route.swift
│ └── Routing.swift
│ ├── ResolveableRecord.swift
│ └── Serialization
│ ├── Property.swift
│ ├── SerializebleObject.swift
│ └── Serializer.swift
├── README.md
└── _Pods.xcodeproj
/.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 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | _Pods
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/xcode.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * http://www.objc.io/issue-6/travis-ci.html
3 | # * https://github.com/supermarin/xcpretty#usage
4 |
5 | language: objective-c
6 | # cache: cocoapods
7 | # podfile: Example/Podfile
8 | # before_install:
9 | # - gem install cocoapods # Since Travis is not always on latest version
10 | # - pod install --project-directory=Example
11 | install:
12 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet
13 | script:
14 | <<<<<<< HEAD
15 | - set -o pipefail && xcodebuild test -workspace Example/OatmealFramework.xcworkspace -scheme OatmealFramework-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
16 | =======
17 | - set -o pipefail && xcodebuild test -workspace Example/Oatmeal.xcworkspace -scheme Oatmeal-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
18 | >>>>>>> 3feadc1ac1c07cd95104e2d326bcbc82aae70e5e
19 | - pod lib lint --quick
20 |
--------------------------------------------------------------------------------
/Example/.idea/.name:
--------------------------------------------------------------------------------
1 | Oatmeal
--------------------------------------------------------------------------------
/Example/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Example/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Example/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Example/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/.idea/runConfigurations/Oatmeal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/.idea/runConfigurations/Oatmeal_Example.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Example/.idea/xcode.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Example/Oatmeal.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Oatmeal.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/Oatmeal.xcworkspace/xcshareddata/Oatmeal.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "2D039D4B245FF2ECF70AFB558A1A8ADD48FF9D29",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "2D039D4B245FF2ECF70AFB558A1A8ADD48FF9D29" : 0,
8 | "98D9CFCAA6E8B3ABF9AA0A9273C91006F9A0686F" : 0
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "6FA90FFC-AE95-456E-A7AB-BD29659CBA6E",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "2D039D4B245FF2ECF70AFB558A1A8ADD48FF9D29" : "OatmealFramework\/",
13 | "98D9CFCAA6E8B3ABF9AA0A9273C91006F9A0686F" : "Oatmeal\/"
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "Oatmeal",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Example\/Oatmeal.xcworkspace",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/mikenolimits\/Oatmeal.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "2D039D4B245FF2ECF70AFB558A1A8ADD48FF9D29"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/mikenolimits\/OatmealFramework.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "98D9CFCAA6E8B3ABF9AA0A9273C91006F9A0686F"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Album.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Album.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 1/8/16.
6 | // Copyright © 2016 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 |
12 | class Album : SerializebleObject{
13 | var name : String?
14 | var href : String?
15 | var available_markets : [String]
16 |
17 | required init()
18 | {
19 | self.available_markets = [String]()
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Oatmeal
4 | //
5 | // Created by mikenolimits on 08/21/2015.
6 | // Copyright (c) 2015 mikenolimits. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Oatmeal
11 |
12 | @UIApplicationMain
13 | class AppDelegate: UIResponder, UIApplicationDelegate {
14 |
15 | var window: UIWindow?
16 |
17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
18 | {
19 | Container.App.register(OatmealServiceProvider())
20 |
21 | // Override point for customization after application launch.
22 | return true
23 | }
24 |
25 | func applicationWillResignActive(application: UIApplication) {
26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
28 | }
29 |
30 | func applicationDidEnterBackground(application: UIApplication) {
31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 | func applicationWillEnterForeground(application: UIApplication) {
36 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
37 | }
38 |
39 | func applicationDidBecomeActive(application: UIApplication) {
40 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
41 | }
42 |
43 | func applicationWillTerminate(application: UIApplication) {
44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
45 | }
46 |
47 |
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/Example/Oatmeal/Framework.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Example/Oatmeal/Framework.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/Oatmeal/Framework.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
14 |
15 |
19 |
20 |
24 |
25 |
29 |
30 |
34 |
35 |
39 |
40 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/Oatmeal/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/Oatmeal/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Images.xcassets/cry.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "cry.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Images.xcassets/cry.imageset/cry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OatmealCode/Oatmeal/6d49a9eb5f7ed2bb5e65616e1ef85f199ff9db9e/Example/Oatmeal/Images.xcassets/cry.imageset/cry.png
--------------------------------------------------------------------------------
/Example/Oatmeal/Images.xcassets/oatmeal.imageset/1440384920_arroz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OatmealCode/Oatmeal/6d49a9eb5f7ed2bb5e65616e1ef85f199ff9db9e/Example/Oatmeal/Images.xcassets/oatmeal.imageset/1440384920_arroz.png
--------------------------------------------------------------------------------
/Example/Oatmeal/Images.xcassets/oatmeal.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "1440384920_arroz.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/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 | Fabric
24 |
25 | APIKey
26 | a15e83abd3aa4e75d7ff146f32cdc2d88d86fe73
27 | Kits
28 |
29 |
30 | KitInfo
31 |
32 | KitName
33 | Crashlytics
34 |
35 |
36 |
37 | LSRequiresIPhoneOS
38 |
39 | NSAppTransportSecurity
40 |
41 | NSExceptionDomains
42 |
43 | github.com
44 |
45 | NSExceptionAllowsInsecureHTTPLoads
46 |
47 | NSExceptionRequiresForwardSecrecy
48 |
49 | NSIncludesSubdomains
50 |
51 | NSTemporaryExceptionMinimumTLSVersion
52 | TLSv1.2
53 |
54 |
55 |
56 | UILaunchStoryboardName
57 | LaunchScreen
58 | UIMainStoryboardFile
59 | Main
60 | UIRequiredDeviceCapabilities
61 |
62 | armv7
63 |
64 | UIStatusBarHidden
65 |
66 | UISupportedInterfaceOrientations
67 |
68 | UIInterfaceOrientationPortrait
69 | UIInterfaceOrientationLandscapeLeft
70 | UIInterfaceOrientationLandscapeRight
71 |
72 | UISupportedInterfaceOrientations~ipad
73 |
74 | UIInterfaceOrientationPortrait
75 | UIInterfaceOrientationPortraitUpsideDown
76 | UIInterfaceOrientationLandscapeLeft
77 | UIInterfaceOrientationLandscapeRight
78 |
79 | NSAppTransportSecurity
80 |
81 |
82 | NSAllowsArbitraryLoads
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/Example/Oatmeal/Models/Github.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import Oatmeal
3 |
4 | class Github:SerializebleObject
5 | {
6 | var name :String?
7 | var language : String?
8 | var watchers_count : NSNumber?
9 | var owner : Owner?
10 | var cache : MemoryCache?
11 | var log : FileLog?
12 |
13 |
14 | required init()
15 | {
16 | super.init()
17 | }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Models/Owner.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Owner.swift
3 | // OatmealFramework
4 | //
5 | // Created by Michael Kantor on 9/13/15.
6 | // Copyright © 2015 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 |
12 | class Owner : SerializebleObject
13 | {
14 | var login : String?
15 | var avatar_url : String?
16 |
17 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Person.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Person.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 1/4/16.
6 | // Copyright © 2016 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 |
12 | class Person : Autoresolveable, UsesEvents
13 | {
14 | var networking : Networking?
15 | var serializer : Serializer?
16 | var events : Events?
17 |
18 | var swag = [String]()
19 | var donuts = [Int]()
20 | var optionalSwag : [String]?
21 | var optionalInts : [Int]?
22 | var oranges = [String:String]()
23 |
24 | required init()
25 | {
26 | super.init()
27 | self.customEntityName = "Person"
28 | }
29 |
30 | func setEvents() {
31 |
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Providers/AppServiceProvider.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppServiceProvider.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 8/25/15.
6 | // Copyright © 2015 CocoaPods. All rights reserved.
7 |
8 | import Foundation
9 | import Oatmeal
10 |
11 | final class AppServiceProvider : ServiceProvider{
12 |
13 | var provides : [Resolveable.Type] = []
14 |
15 | func registerCustomTypes() -> [Any.Type] {
16 | return [String.self]
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Providers/OatmealServiceProvider.swift:
--------------------------------------------------------------------------------
1 | //
2 | // OatmealServiceProvider.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 8/25/15.
6 | //
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 | import SpriteKit
12 |
13 | final class OatmealServiceProvider : ServiceProvider
14 | {
15 | /*
16 | This is the default service provider for Oatmeal.
17 | Objects removed will not be accessible unless bound later.
18 | */
19 | var provides : [Resolveable.Type] = [
20 | FileCache.self,
21 | MemoryCache.self,
22 | Configuration.self,
23 | FileLog.self,
24 | Reachability.self,
25 | Networking.self,
26 | HttpLog.self,
27 | Serializer.self,
28 | CloudStorage.self,
29 | Owner.self,
30 | Github.self,
31 | Person.self,
32 | Song.self,
33 | Album.self
34 | ]
35 |
36 | func registerCustomTypes() -> [Any.Type]
37 | {
38 | return [Any.Type]()
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Router.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Router.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 5/19/16.
6 | // Copyright © 2016 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 | import Alamofire
12 |
13 |
14 | enum Router : Routing
15 | {
16 |
17 | static let baseUrl = "https://api.github.com"
18 |
19 | case GetFramework(framework: String)
20 |
21 |
22 | var method : Alamofire.Method{
23 | switch self{
24 | case GetFramework:
25 | return .GET
26 | }
27 | }
28 |
29 | var route : Route{
30 |
31 | var route : Route
32 | let parameters = [String:String]()
33 | var endpoint = ""
34 |
35 | switch self{
36 | case .GetFramework(let framework):
37 |
38 | endpoint += "/repos/\(framework)"
39 |
40 | }
41 |
42 | route = Route(baseUrl: Router.baseUrl, endpoint: endpoint, parameters: parameters)
43 | route.method = method
44 |
45 | return route
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/Settings.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | GameParams
6 |
7 | Players
8 |
9 | Snake
10 |
11 | Wiggle
12 |
13 | Frames
14 |
15 | character_w-01
16 | character_w-02
17 | character_w-03
18 | character_w-04
19 | character_w-05
20 | character_w-06
21 | character_w-07
22 |
23 | FPS
24 | 16
25 | AtlasFileName
26 | Worm
27 |
28 |
29 |
30 |
31 | LOG_LOCATION
32 | /Users/michaelkantor/AppcodProjects/Oatmeal/Example/Oatmeal/App.txt
33 | LOG_HTTP
34 |
35 | LOG_ENABLED
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Example/Oatmeal/Song.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Album.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 1/8/16.
6 | // Copyright © 2016 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import Oatmeal
11 |
12 | class Song : SerializebleObject{
13 | var name : String?
14 | var href : String?
15 | var album : Album?
16 |
17 | required init()
18 | {
19 |
20 | }
21 | }
--------------------------------------------------------------------------------
/Example/Oatmeal/ViewPresentor.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewPresentor.swift
3 | // Oatmeal
4 | //
5 | // Created by Michael Kantor on 8/24/15.
6 | // Copyright © 2015 CocoaPods. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | import Oatmeal
12 |
13 | class ViewPresentor : ProactiveResolveable
14 | {
15 |
16 | static var entityName : String? = "viewpresentor"
17 | var cache : MemoryCache?
18 |
19 | required init()
20 | {
21 |
22 | }
23 |
24 | func render(controller : ViewsController)
25 | {
26 | UIView.animateWithDuration(5.5, delay: 1.0, options: UIViewAnimationOptions.CurveEaseIn,
27 | animations: {
28 | controller.Hello.textColor = UIColor.whiteColor()
29 | controller.Hello.alpha = 0
30 | controller.view.backgroundColor = UIColor.blueColor()
31 | },completion: nil)
32 |
33 | UIView.animateWithDuration(5.5, delay: 2.0, options: UIViewAnimationOptions.CurveLinear,animations: {
34 | let image = UIImage(named: "oatmeal")
35 | let imageView = UIImageView(image: image!)
36 | let frame = controller.view.frame
37 | imageView.frame = CGRect(x: frame.midX, y: frame.midY + 100, width: 100, height: 100)
38 | controller.helloOatmeal.alpha = 0
39 | controller.view.addSubview(imageView)
40 | controller.view.addSubview(controller.Hello)
41 | controller.view.layoutIfNeeded()
42 | },completion: {
43 | (value: Bool) in
44 |
45 | if let events : Events = ~Oats()
46 | {
47 | events.fire("presented")
48 | }
49 | })
50 |
51 | }
52 |
53 | func didBind()
54 | {
55 | print("Did Resolve")
56 | if let events : Events = ~Oats()
57 | {
58 | events.listenFor("sayHello", global: true, handler: {
59 | event in
60 |
61 | if let data = event.data, view = data["view"] as? ViewsController
62 | {
63 | self.render(view)
64 | }
65 | })
66 |
67 | events.listenFor("setText", global: true, handler: {
68 | event in
69 |
70 | if let data = event.data, view = data["view"] as? ViewsController, framework = data["framework"] as? Github, name = framework.name
71 | {
72 | print("Got here 2")
73 | view.Hello.text = "And then there was \(name)"
74 | view.Hello.alpha = 1
75 | }
76 |
77 | if let github : Github = ~Oats()
78 | {
79 | print(github.name)
80 | }
81 | })
82 | }
83 | }
84 |
85 |
86 | func didResolve()
87 | {
88 |
89 | }
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/Example/Oatmeal_Example.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.icloud-container-identifiers
6 |
7 | iCloud.$(CFBundleIdentifier)
8 |
9 | com.apple.developer.icloud-services
10 |
11 | CloudKit
12 |
13 | com.apple.developer.ubiquity-kvstore-identifier
14 | $(TeamIdentifierPrefix)$(CFBundleIdentifier)
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | use_frameworks!
3 |
4 | target 'Oatmeal_Example' do
5 | pod 'Alamofire'
6 | pod 'AlamofireImage'
7 | pod 'Carlos'
8 | pod 'SwiftyJSON',:git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
9 | pod "Oatmeal", :path => "../"
10 | end
11 |
12 | target 'Oatmeal_Tests' do
13 | pod "Oatmeal", :path => "../"
14 | end
15 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Alamofire (3.4.0)
3 | - AlamofireImage (2.4.0):
4 | - Alamofire (~> 3.3)
5 | - Carlos (0.8):
6 | - PiedPiper (~> 0.8)
7 | - Oatmeal (0.3.3):
8 | - Alamofire
9 | - AlamofireImage
10 | - Carlos
11 | - SwiftyJSON
12 | - PiedPiper (0.8)
13 | - SwiftyJSON (2.3.2)
14 |
15 | DEPENDENCIES:
16 | - Alamofire
17 | - AlamofireImage
18 | - Carlos
19 | - Oatmeal (from `../`)
20 | - SwiftyJSON (from `https://github.com/SwiftyJSON/SwiftyJSON.git`)
21 |
22 | EXTERNAL SOURCES:
23 | Oatmeal:
24 | :path: "../"
25 | SwiftyJSON:
26 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
27 |
28 | CHECKOUT OPTIONS:
29 | SwiftyJSON:
30 | :commit: 2a5b70f06001316d4fb54501edc70b4084705da0
31 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
32 |
33 | SPEC CHECKSUMS:
34 | Alamofire: c19a627cefd6a95f840401c49ab1f124e07f54ee
35 | AlamofireImage: 87408b652e0f5ae5fe364035f15aea8b9b24c77e
36 | Carlos: a81e995dae4301a461be98a7363da2f1cf83a2bf
37 | Oatmeal: 9304bf1f96a255ba052e95d2d09de2f5206f6e15
38 | PiedPiper: cadc2fdfedb538958f3c42feffbe6812cdb4ec86
39 | SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a
40 |
41 | PODFILE CHECKSUM: 3f8702069da5627000a812e39be4b2a8b53a3c10
42 |
43 | COCOAPODS: 1.0.0.beta.6
44 |
--------------------------------------------------------------------------------
/Example/Pods/Alamofire/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
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 |
--------------------------------------------------------------------------------
/Example/Pods/Alamofire/Source/Notifications.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Notifications.swift
3 | //
4 | // Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 | //
24 |
25 | import Foundation
26 |
27 | /// Contains all the `NSNotification` names posted by Alamofire with descriptions of each notification's payload.
28 | public struct Notifications {
29 | /// Used as a namespace for all `NSURLSessionTask` related notifications.
30 | public struct Task {
31 | /// Notification posted when an `NSURLSessionTask` is resumed. The notification `object` contains the resumed
32 | /// `NSURLSessionTask`.
33 | public static let DidResume = "com.alamofire.notifications.task.didResume"
34 |
35 | /// Notification posted when an `NSURLSessionTask` is suspended. The notification `object` contains the
36 | /// suspended `NSURLSessionTask`.
37 | public static let DidSuspend = "com.alamofire.notifications.task.didSuspend"
38 |
39 | /// Notification posted when an `NSURLSessionTask` is cancelled. The notification `object` contains the
40 | /// cancelled `NSURLSessionTask`.
41 | public static let DidCancel = "com.alamofire.notifications.task.didCancel"
42 |
43 | /// Notification posted when an `NSURLSessionTask` is completed. The notification `object` contains the
44 | /// completed `NSURLSessionTask`.
45 | public static let DidComplete = "com.alamofire.notifications.task.didComplete"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Example/Pods/AlamofireImage/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
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 |
--------------------------------------------------------------------------------
/Example/Pods/AlamofireImage/Source/Image.swift:
--------------------------------------------------------------------------------
1 | // Image.swift
2 | //
3 | // Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | import Foundation
24 |
25 | #if os(iOS) || os(tvOS) || os(watchOS)
26 | import UIKit
27 | public typealias Image = UIImage
28 | #elseif os(OSX)
29 | import Cocoa
30 | public typealias Image = NSImage
31 | #endif
32 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/BasicCache.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// A wrapper cache that explicitly takes get, set, clear and memory warning closures
5 | public final class BasicCache: CacheLevel {
6 | public typealias KeyType = A
7 | public typealias OutputType = B
8 |
9 | private let getClosure: (key: A) -> Future
10 | private let setClosure: (value: B, key: A) -> Void
11 | private let clearClosure: () -> Void
12 | private let memoryClosure: () -> Void
13 |
14 | /**
15 | Initializes a new instance of a BasicCache specifying closures for get, set, clear and onMemoryWarning, thus determining the behavior of the cache level as a whole
16 |
17 | - parameter getClosure: The closure to execute when you call get(key) on this instance
18 | - parameter setClosure: The closure to execute when you call set(value, key) on this instance
19 | - parameter clearClosure: The closure to execute when you call clear() on this instance
20 | - parameter memoryClosure: The closure to execute when you call onMemoryWarning() on this instance, or when a memory warning is thrown by the system and the cache level is listening for memory pressure events
21 | */
22 | public init(getClosure: (key: A) -> Future, setClosure: (value: B, key: A) -> Void, clearClosure: () -> Void, memoryClosure: () -> Void) {
23 | self.getClosure = getClosure
24 | self.setClosure = setClosure
25 | self.clearClosure = clearClosure
26 | self.memoryClosure = memoryClosure
27 | }
28 |
29 | /**
30 | Asks the cache to get the value for a given key
31 |
32 | - parameter key: The key you want to get the value for
33 |
34 | - returns: The result of the getClosure specified when initializing the instance
35 | */
36 | public func get(key: KeyType) -> Future {
37 | return getClosure(key: key)
38 | }
39 |
40 | /**
41 | Asks the cache to set a value for the given key
42 |
43 | - parameter value: The value to set on the cache
44 | - parameter key: The key to use for the given value
45 |
46 | This call executes the setClosure specified when initializing the instance
47 | */
48 | public func set(value: B, forKey key: A) {
49 | setClosure(value: value, key: key)
50 | }
51 |
52 | /**
53 | Asks the cache to clear its contents
54 |
55 | This call executes the clearClosure specified when initializing the instance
56 | */
57 | public func clear() {
58 | clearClosure()
59 | }
60 |
61 | /**
62 | Tells the cache that a memory warning event was received
63 |
64 | This call executes the memoryClosure specified when initializing the instance
65 | */
66 | public func onMemoryWarning() {
67 | memoryClosure()
68 | }
69 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/BasicFetcher.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// A wrapper fetcher that explicitly takes a get closure
5 | public final class BasicFetcher: Fetcher {
6 | public typealias KeyType = A
7 | public typealias OutputType = B
8 |
9 | private let getClosure: (key: A) -> Future
10 |
11 | /**
12 | Initializes a new instance of a BasicFetcher specifying a get closure, thus determining the behavior of the fetcher as a whole
13 |
14 | - parameter getClosure: The closure to execute when you call get(key) on this instance
15 | */
16 | public init(getClosure: (key: A) -> Future) {
17 | self.getClosure = getClosure
18 | }
19 |
20 | /**
21 | Asks the fetcher to get the value for a given key
22 |
23 | - parameter key: The key you want to get the value for
24 |
25 | - returns: The result of the getClosure specified when initializing the instance
26 | */
27 | public func get(key: KeyType) -> Future {
28 | return getClosure(key: key)
29 | }
30 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/CacheLevel+Batch.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | extension CacheLevel {
5 | /**
6 | Performs a batch of get requests on this CacheLevel
7 |
8 | - parameter keys: The list of keys to batch
9 |
10 | - returns: A Future that will call the success callback when ALL the keys will be fetched successfully, and the failure callback as soon as JUST ONE of the keys cannot be fetched.
11 | */
12 | public func batchGetAll(keys: [KeyType]) -> Future<[OutputType]> {
13 | return keys.traverse(get)
14 | }
15 |
16 | /**
17 | Performs a batch of get requests on this CacheLevel
18 |
19 | - parameter keys: The list of keys to batch
20 |
21 | - returns: A Future that will call the success callback when all the keys will be either fetched or failed, passing a list containing just the successful results
22 | */
23 | public func batchGetSome(keys: [KeyType]) -> Future<[OutputType]> {
24 | let resultPromise = Promise<[OutputType]>()
25 | let resultsLock: ReadWriteLock = PThreadReadWriteLock()
26 | let counterLock: ReadWriteLock = PThreadReadWriteLock()
27 | var completedRequests = 0
28 | var intermediateResults = Array(count: keys.count, repeatedValue: nil)
29 | var batchedRequests: [Future] = []
30 |
31 | keys.enumerate().forEach { (iteration, key) in
32 | batchedRequests.append(get(key)
33 | .onCompletion { result in
34 | if let value = result.value {
35 | resultsLock.withWriteLock {
36 | intermediateResults[iteration] = value
37 | }
38 | }
39 |
40 | counterLock.withWriteLock {
41 | completedRequests += 1
42 |
43 | if completedRequests == keys.count {
44 | resultPromise.succeed(intermediateResults.flatMap { $0 })
45 | }
46 | }
47 | }
48 | )
49 | }
50 |
51 | resultPromise.onCancel {
52 | batchedRequests.forEach { request in
53 | request.cancel()
54 | }
55 | }
56 |
57 | return resultPromise.future
58 | }
59 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/CacheProvider+iOS.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import UIKit
3 |
4 | extension CacheProvider {
5 | /// A shared image cache instance
6 | public static let sharedImageCache: BasicCache = CacheProvider.imageCache()
7 |
8 | /**
9 | - returns: An initialized and configured CacheLevel that takes NSURL keys and stores UIImage values. Network requests are pooled for efficiency. Keep in mind that calling this method twice returns two different instances. You should take care of retaining the result or use `sharedImageCache` instead
10 | */
11 | public static func imageCache() -> BasicCache {
12 | return MemoryCacheLevel() >>> DiskCacheLevel() >>> (NetworkFetcher().pooled() =>> ImageTransformer())
13 | }
14 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/CacheProvider.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /**
4 | A simple class with the purpose of providing standard caches
5 | */
6 | public class CacheProvider {
7 | /// A shared data cache instance
8 | public static let sharedDataCache: BasicCache = CacheProvider.dataCache()
9 |
10 | /// A shared JSON cache instance
11 | public static let sharedJSONCache: BasicCache = CacheProvider.JSONCache()
12 |
13 | /**
14 | - returns: An initialized and configured CacheLevel that takes NSURL keys and stores NSData values. Network requests are pooled for efficiency. Keep in mind that calling this method twice returns two different instances. You should take care of retaining the result or use `sharedDataCache` instead
15 | */
16 | public static func dataCache() -> BasicCache {
17 | return MemoryCacheLevel() >>> (DiskCacheLevel() >>> NetworkFetcher()).pooled()
18 | }
19 |
20 | /**
21 | - returns: An initialized and configured CacheLevel that takes NSURL keys and stores JSON values in the form of AnyObject. Network requests are pooled for efficiency. Keep in mind that calling this method twice returns two different instances. You should take care of retaining the result or use `sharedJSONCache` instead
22 | */
23 | public static func JSONCache() -> BasicCache {
24 | return dataCache() =>> JSONTransformer()
25 | }
26 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Carlos.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | internal struct CarlosGlobals {
5 | static let QueueNamePrefix = "com.carlos."
6 | static let Caches = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0]
7 | }
8 |
9 | internal func wrapClosureIntoFetcher(closure: (key: A) -> Future) -> BasicFetcher {
10 | return BasicFetcher(getClosure: closure)
11 | }
12 |
13 | internal func wrapClosureIntoOneWayTransformer(transformerClosure: A -> Future) -> OneWayTransformationBox {
14 | return OneWayTransformationBox(transform: transformerClosure)
15 | }
16 |
17 | infix operator =>> { associativity left }
18 |
19 | /// An abstraction for a generic cache level
20 | public protocol CacheLevel {
21 | /// A typealias for the key the cache level accepts
22 | associatedtype KeyType
23 |
24 | /// A typealias for the data the cache returns in the success closure
25 | associatedtype OutputType
26 |
27 | /**
28 | Tries to get a value from the cache level
29 |
30 | - parameter key: The key of the value you would like to get
31 |
32 | - returns: a Future that you can attach success and failure closures to
33 | */
34 | func get(key: KeyType) -> Future
35 |
36 | /**
37 | Tries to set a value on the cache level
38 |
39 | - parameter value: The bytes to set on the cache level
40 | - parameter key: The key of the value you're trying to set
41 | */
42 | func set(value: OutputType, forKey key: KeyType)
43 |
44 | /**
45 | Asks to clear the cache level
46 | */
47 | func clear()
48 |
49 | /**
50 | Notifies the cache level that a memory warning was thrown, and asks it to do its best to clean some memory
51 | */
52 | func onMemoryWarning()
53 | }
54 |
55 | /// An abstraction for a generic cache level that can only fetch values but not store them
56 | public protocol Fetcher: CacheLevel {}
57 |
58 | /// Extending the Fetcher protocol to have a default no-op implementation for clear, onMemoryWarning and set
59 | extension Fetcher {
60 | /// No-op
61 | public func clear() {}
62 |
63 | /// No-op
64 | public func onMemoryWarning() {}
65 |
66 | /// No-op
67 | public func set(value: OutputType, forKey key: KeyType) {}
68 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ComposedTwoWayTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | extension TwoWayTransformer {
5 | /**
6 | Composes the transformer with another TwoWayTransformer
7 |
8 | - parameter transformer: The second TwoWayTransformer to apply
9 |
10 | - returns: A new TwoWayTransformer that is the result of the composition of the two TwoWayTransformers
11 | */
12 | public func compose(transformer: A) -> TwoWayTransformationBox {
13 | return TwoWayTransformationBox(
14 | transform: self.transform >>> transformer.transform,
15 | inverseTransform: transformer.inverseTransform >>> self.inverseTransform
16 | )
17 | }
18 | }
19 |
20 | /**
21 | Composes two TwoWayTransformers
22 |
23 | - parameter firstTransformer: The first TwoWayTransformer to apply
24 | - parameter secondTransformer: The second TwoWayTransformer to apply
25 |
26 | - returns: A new TwoWayTransformer that is the result of the composition of the two TwoWayTransformers
27 | */
28 | @available(*, deprecated=0.5)
29 | public func compose(firstTransformer: A, secondTransformer: B) -> TwoWayTransformationBox {
30 | return firstTransformer.compose(secondTransformer)
31 | }
32 |
33 | /**
34 | Composes two TwoWayTransformers
35 |
36 | - parameter firstTransformer: The first TwoWayTransformer to apply
37 | - parameter secondTransformer: The second TwoWayTransformer to apply
38 |
39 | - returns: A new TwoWayTransformer that is the result of the composition of the two TwoWayTransformers
40 | */
41 | public func >>>(firstTransformer: A, secondTransformer: B) -> TwoWayTransformationBox {
42 | return firstTransformer.compose(secondTransformer)
43 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ConcurrentOperation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ConcurrentOperation.swift
3 | //
4 | // Created by Caleb Davenport on 7/7/14.
5 | //
6 | // Learn more at http://blog.calebd.me/swift-concurrent-operations
7 | //
8 |
9 | import Foundation
10 |
11 | public class ConcurrentOperation: NSOperation {
12 | enum State {
13 | case Ready
14 | case Executing
15 | case Finished
16 |
17 | func asKeyPath() -> String {
18 | switch self {
19 | case .Ready:
20 | return "isReady"
21 | case .Executing:
22 | return "isExecuting"
23 | case .Finished:
24 | return "isFinished"
25 | }
26 | }
27 | }
28 |
29 | var state: State {
30 | willSet {
31 | willChangeValueForKey(newValue.asKeyPath())
32 | willChangeValueForKey(state.asKeyPath())
33 | }
34 |
35 | didSet {
36 | didChangeValueForKey(oldValue.asKeyPath())
37 | didChangeValueForKey(state.asKeyPath())
38 | }
39 | }
40 |
41 | override init() {
42 | state = .Ready
43 |
44 | super.init()
45 | }
46 |
47 | // MARK: - NSOperation
48 |
49 | override public var ready: Bool {
50 | return state == .Ready
51 | }
52 |
53 | override public var executing: Bool {
54 | return state == .Executing
55 | }
56 |
57 | override public var finished: Bool {
58 | return state == .Finished
59 | }
60 |
61 | override public var asynchronous: Bool {
62 | return true
63 | }
64 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ConditionedOneWayTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// Abstract an object that can conditionally transform values to another type
5 | public protocol ConditionedOneWayTransformer {
6 | /// The input type of the transformer
7 | associatedtype TypeIn
8 |
9 | /// The output type of the transformer
10 | associatedtype TypeOut
11 |
12 | /// The type of the key used to evaluate the condition
13 | associatedtype KeyType
14 |
15 | /**
16 | Apply the conditional transformation from A to B
17 |
18 | - parameter key: The key to use to evaluate the condition
19 | - parameter val: The value to transform
20 |
21 | - returns: A Future that will contain the transformed value, or fail if the transformation failed
22 | */
23 | func conditionalTransform(key: KeyType, value: TypeIn) -> Future
24 | }
25 |
26 | /// Simple implementation of the ConditionedOneWayTransformer protocol
27 | public class ConditionedOneWayTransformationBox: ConditionedOneWayTransformer {
28 | /// The input type of the transformation box
29 | public typealias TypeIn = InputType
30 |
31 | /// The output type of the transformation box
32 | public typealias TypeOut = OutputType
33 |
34 | /// The key type used by the transformation box
35 | public typealias KeyType = Key
36 |
37 | private let conditionalTransformClosure: (key: Key, value: InputType) -> Future
38 |
39 | /**
40 | Initializes a conditioned 1-way transformation box with the given closure
41 |
42 | - parameter conditionalTransformClosure: The conditional transformation closure to convert a value of type TypeIn into a value of type TypeOut given a key of type KeyType
43 | */
44 | public init(conditionalTransformClosure: (key: Key, value: InputType) -> Future) {
45 | self.conditionalTransformClosure = conditionalTransformClosure
46 | }
47 |
48 | /**
49 | Convenience initializer to create a conditioned 1-way transformation box through a normal 1-way transformer
50 |
51 | - parameter transformer: The normal OneWayTransformer with matching input and output type
52 |
53 | This initializer will basically ignore the key
54 | */
55 | public convenience init(transformer: T) {
56 | self.init(conditionalTransformClosure: { _, value in
57 | transformer.transform(value)
58 | })
59 | }
60 |
61 | /**
62 | Conditionally transforms a value of type TypeIn into a value of type TypeOut, based on the given key
63 |
64 | - parameter key: The key to use to evaluate the condition
65 | - parameter val: The value to convert
66 |
67 | - returns: A Future that will contain the converted value or fail if the transformation fails
68 | */
69 | public func conditionalTransform(key: KeyType, value: TypeIn) -> Future {
70 | return conditionalTransformClosure(key: key, value: value)
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ConditionedValueTransformation.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | extension Future {
5 |
6 | /**
7 | Mutates a future from a type A to a type B through a ConditionedTwoWayTransformer
8 |
9 | - parameter key The key to use for the condition
10 | - parameter conditionedTransformer A ConditionedTwoWayTransformer used to conditionally transform the values of the given Future
11 |
12 | - returns A new Future with the transformed value
13 | */
14 | internal func mutate(key: K, conditionedTransformer: Transformer) -> Future {
15 | return flatMap { result in
16 | conditionedTransformer.conditionalTransform(key, value: result)
17 | }
18 | }
19 | }
20 |
21 | extension CacheLevel {
22 |
23 | /**
24 | Applies a conditional transformation to the cache level
25 |
26 | The transformation works by changing the type of the value the cache returns when succeeding
27 |
28 | Use this transformation when you store a value type but want to mount the cache in a pipeline that works with other value types
29 |
30 | - parameter conditionedTransformer: The conditioned transformer that will be applied to every successful result of the method get or (inverse transform) set called on the cache level. The object gets the key used for the get request (where it can apply its condition on) and the fetched value, and returns the transformed value.
31 |
32 | - returns: A new cache result of the transformation of the original cache
33 | */
34 | public func conditionedValueTransformation(transformer: A) -> BasicCache {
35 | return BasicCache(
36 | getClosure: { key in
37 | self.get(key).mutate(key, conditionedTransformer: transformer)
38 | },
39 | setClosure: { (value, key) in
40 | transformer.conditionalInverseTransform(key, value: value)
41 | .onSuccess { transformedValue in
42 | self.set(transformedValue, forKey: key)
43 | }
44 | },
45 | clearClosure: self.clear,
46 | memoryClosure: self.onMemoryWarning
47 | )
48 | }
49 | }
50 |
51 | /**
52 | Adds a conditioned value transformation step to a given CacheLevel
53 |
54 | As usual, if the transformation fails, the get (or set) request will also fail
55 |
56 | - parameter cache: The CacheLevel you want to apply the value transformation step to
57 | - parameter conditionedTransformer: The transformer that will be applied to every get or set. The transformer gets the key used for the request (where it can apply its condition on) and the fetched value or the value to set, and returns a future with the transformed value.
58 |
59 | - returns: A transformed CacheLevel that incorporates the value transformation step
60 | */
61 | public func ?>>(cache: A, conditionedTransformer: T) -> BasicCache {
62 | return cache.conditionedValueTransformation(conditionedTransformer)
63 | }
64 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/DeferredCacheRequestOperation.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /*
5 | Warning! this class contains a workaround in order to have effective generic NSOperations in Swift
6 |
7 | Workaround 1: Generic subclasses of NSOperation can't have @objc implementation of start() or main(), so these methods will never be called (see http://stackoverflow.com/questions/26097581/generic-nsoperation-subclass-loses-nsoperation-functionality/26104946#26104946)
8 | */
9 | /**
10 | A subclass of NSOperation that wraps a cache request and executes it at a later point
11 | */
12 | public class DeferredResultOperation: GenericOperation {
13 | private let key: C.KeyType
14 | private let cache: C
15 | private let decoy: Promise
16 |
17 | /**
18 | Initializes a new instance of DeferredResultOperation
19 |
20 | - parameter decoyRequest: The Promise you want to notify when the deferred request will actually succeed or fail
21 | - parameter key: The key to use when calling the deferred get
22 | - parameter cache: The cache to call get on to
23 | */
24 | public init(decoyRequest: Promise, key: C.KeyType, cache: C) {
25 | self.decoy = decoyRequest
26 | self.key = key
27 | self.cache = cache
28 |
29 | super.init()
30 | }
31 |
32 | public override func genericStart() {
33 | state = .Executing
34 |
35 | cache.get(key)
36 | .onSuccess { result in
37 | GCD.main {
38 | self.decoy.succeed(result)
39 | }
40 | self.state = .Finished
41 | }
42 | .onFailure { error in
43 | GCD.main {
44 | self.decoy.fail(error)
45 | }
46 | self.state = .Finished
47 | }
48 | .onCancel {
49 | GCD.main {
50 | self.decoy.cancel()
51 | }
52 | self.state = .Finished
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Dispatched.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | infix operator ~>> { }
5 |
6 | extension CacheLevel {
7 | /**
8 | Dispatches all the operations of this CacheLevel on the given GCD queue
9 |
10 | - parameter queue: The queue you want to dispatch all the operations (get, set, clear, onMemoryWarning) of this CacheLevel on
11 |
12 | - returns: A new CacheLevel that dispatches all the operations on the given GCD queue
13 | */
14 | public func dispatch(queue: dispatch_queue_t) -> BasicCache {
15 | let gcd = GCD(queue: queue)
16 |
17 | return BasicCache(
18 | getClosure: { key in
19 | let result = Promise()
20 |
21 | gcd.async {
22 | result.mimic(self.get(key))
23 | }
24 |
25 | return result.future
26 | },
27 | setClosure: { (value, key) in
28 | gcd.async {
29 | self.set(value, forKey: key)
30 | }
31 | },
32 | clearClosure: {
33 | gcd.async(self.clear)
34 | },
35 | memoryClosure: {
36 | gcd.async(self.onMemoryWarning)
37 | }
38 | )
39 | }
40 | }
41 |
42 | /**
43 | Dispatches all the operations of a given CacheLevel on the given GCD queue
44 |
45 | - parameter lhs: The CacheLevel you want to dispatch on the given GCD queue
46 | - parameter rhs: The queue you want to dispatch all the operations (get, set, clear, onMemoryWarning) of the CacheLevel on
47 |
48 | - returns: A new CacheLevel that dispatches all the operations on the given GCD queue
49 | */
50 | public func ~>>(lhs: A, rhs: dispatch_queue_t) -> BasicCache {
51 | return lhs.dispatch(rhs)
52 | }
53 |
54 | /**
55 | Dispatches all the operations of a given fetch closure on the given GCD queue
56 |
57 | - parameter lhs: The fetch closure you want to dispatch on the given GCD queue
58 | - parameter rhs: The queue you want to dispatch the fetch closure on
59 |
60 | - returns: A new CacheLevel that dispatches the fetch closure on the given GCD queue
61 | */
62 | @available(*, deprecated=0.7)
63 | public func ~>>(lhs: A -> Future, rhs: dispatch_queue_t) -> BasicCache {
64 | return wrapClosureIntoFetcher(lhs).dispatch(rhs)
65 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Errors.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public enum FetchError: ErrorType {
4 | /// Used when a cache level doesn't have a value in the cache
5 | case ValueNotInCache
6 |
7 | /// Used when no cache level did find the key
8 | case NoCacheLevelsRemaining
9 |
10 | /// Used when the specified key was invalid
11 | case InvalidKey
12 |
13 | /// Used when some cached data was found but was likely corrupted
14 | case InvalidCachedData
15 |
16 | /// Used when the key doesn't satisfy the cache condition
17 | case ConditionNotSatisfied
18 |
19 | /// Used when a key transformation failed and the cache level had to skip a get operation
20 | case KeyTransformationFailed
21 |
22 | /// Used when a value transformation failed and the cache level had to skip a get operation
23 | case ValueTransformationFailed
24 | }
25 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ExpensiveObject+iOS.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import UIKit
3 |
4 | extension UIImage: ExpensiveObject {
5 | /// The size of the image in pixels (W x H)
6 | public var cost: Int {
7 | return Int(size.width * size.height)
8 | }
9 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ExpensiveObject.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// Abstracts objects that have a cost (useful for the MemoryCacheLevel)
4 | public protocol ExpensiveObject {
5 | /// The cost of the object
6 | var cost: Int { get }
7 | }
8 |
9 | extension NSData: ExpensiveObject {
10 | /// The number of bytes of the data block
11 | public var cost: Int {
12 | return self.length
13 | }
14 | }
15 |
16 | extension String: ExpensiveObject {
17 | /// The number of characters of the string
18 | public var cost: Int {
19 | return self.characters.count
20 | }
21 | }
22 |
23 | extension NSString: ExpensiveObject {
24 | /// The number of characters of the NSString
25 | public var cost: Int {
26 | return self.length
27 | }
28 | }
29 |
30 | extension NSURL: ExpensiveObject {
31 | /// The size of the URL
32 | public var cost: Int {
33 | return absoluteString.cost
34 | }
35 | }
36 |
37 | extension Int: ExpensiveObject {
38 | /// Integers have a unit cost
39 | public var cost: Int {
40 | return 1
41 | }
42 | }
43 |
44 | extension Float: ExpensiveObject {
45 | /// Floats have a unit cost
46 | public var cost: Int {
47 | return 1
48 | }
49 | }
50 |
51 | extension Double: ExpensiveObject {
52 | /// Doubles have a unit cost
53 | public var cost: Int {
54 | return 1
55 | }
56 | }
57 |
58 | extension Character: ExpensiveObject {
59 | /// Characters have a unit cost
60 | public var cost: Int {
61 | return 1
62 | }
63 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Extensions.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | extension String {
4 | internal func MD5String() -> String {
5 | if let data = self.dataUsingEncoding(NSUTF8StringEncoding) {
6 | let MD5Calculator = MD5(data)
7 | let MD5Data = MD5Calculator.calculate()
8 | let resultBytes = UnsafeMutablePointer(MD5Data.bytes)
9 | let resultEnumerator = UnsafeBufferPointer(start: resultBytes, count: MD5Data.length)
10 | let MD5String = NSMutableString()
11 | for c in resultEnumerator {
12 | MD5String.appendFormat("%02x", c)
13 | }
14 | return MD5String as String
15 | } else {
16 | return self
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/GenericOperation.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /**
4 | This class is a workaround for an issue with Swift where generic subclasses of NSOperation won't get the start() or main() func called.
5 | */
6 | public class GenericOperation: ConcurrentOperation {
7 | public override func start() {
8 | genericStart()
9 | }
10 |
11 | /**
12 | The method to override if you have a generic subclass of NSOperation (more specifically of ConcurrentOperation), so that your start() method will be called after adding the operation itself to a NSOperationQueue
13 | */
14 | public func genericStart() {}
15 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ImageTransformer+iOS.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 | import UIKit
4 |
5 | /**
6 | This class takes care of transforming NSData instances into UIImage objects.
7 |
8 | Keep in mind that at the moment this class always deserializes images through UIImagePNGRepresentation, so there may be a data usage bigger than actually required.
9 | */
10 | public class ImageTransformer: TwoWayTransformer {
11 | public enum Error: ErrorType {
12 | case InvalidData
13 | case CannotConvertImage
14 | }
15 |
16 | public typealias TypeIn = NSData
17 | public typealias TypeOut = UIImage
18 |
19 | /// Initializes a new instance of ImageTransformer
20 | public init() {}
21 |
22 | /**
23 | Serializes an NSData instance into a UIImage
24 |
25 | - parameter val: The NSData you want to serialize
26 |
27 | - returns: A Future object
28 | */
29 | public func transform(val: TypeIn) -> Future {
30 | let result = Promise()
31 |
32 | GCD.background {
33 | UIImage(data: val)
34 | }.main { image in
35 | if let image = image {
36 | result.succeed(image)
37 | } else {
38 | result.fail(Error.InvalidData)
39 | }
40 | }
41 |
42 | return result.future
43 | }
44 |
45 | /**
46 | Deserializes an UIImage instance into NSData
47 |
48 | - parameter val: The UIImage you want to deserialize
49 |
50 | - returns: A Future instance obtained with UIImagePNGRepresentation
51 | */
52 | public func inverseTransform(val: TypeOut) -> Future {
53 | let result = Promise()
54 |
55 | GCD.background {
56 | /* This is a waste of bytes, we should probably use a lower-level framework */
57 | UIImagePNGRepresentation(val)
58 | }.main { data in
59 | if let data = data {
60 | result.succeed(data)
61 | } else {
62 | result.fail(Error.CannotConvertImage)
63 | }
64 | }
65 |
66 | return result.future
67 | }
68 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/JSONTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /**
5 | This class takes care of transforming NSData instances into JSON objects in the form of AnyObject instances. Depending on your usage, the AnyObject could contain an Array, a Dictionary, or nil if the NSData is not a valid JSON
6 | */
7 | public class JSONTransformer: TwoWayTransformer {
8 | public typealias TypeIn = NSData
9 | public typealias TypeOut = AnyObject
10 |
11 | /// Initializes a new instance of JSONTransformer
12 | public init() {}
13 |
14 | /**
15 | Parses JSON from an NSData instance into an AnyObject instance
16 |
17 | - parameter val: The NSData representing the received JSON
18 |
19 | - returns: A Future value, with the parsed JSON if the input data was valid
20 | */
21 | public func transform(val: TypeIn) -> Future {
22 | let result = Promise()
23 |
24 | do {
25 | let transformed = try NSJSONSerialization.JSONObjectWithData(val, options: [.AllowFragments])
26 | result.succeed(transformed)
27 | } catch {
28 | result.fail(error)
29 | }
30 |
31 | return result.future
32 | }
33 |
34 | /**
35 | Deserializes a JSON object into an NSData instance
36 |
37 | - parameter val: The JSON object you want to deserialize
38 |
39 | - returns: A Future value, with the deserialized JSON if the input was valid
40 | */
41 | public func inverseTransform(val: TypeOut) -> Future {
42 | let result = Promise()
43 |
44 | do {
45 | let transformed = try NSJSONSerialization.dataWithJSONObject(val, options: [])
46 | result.succeed(transformed)
47 | } catch {
48 | result.fail(error)
49 | }
50 |
51 | return result.future
52 | }
53 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Logger.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// A simple logger to use instead of println with configurable output closure
5 | public class Logger {
6 | /// The level of the logged message
7 | public enum Level : String {
8 | case Debug = "Debug"
9 | case Info = "Info"
10 | case Warning = "Warning"
11 | case Error = "Error"
12 | }
13 |
14 | private static let queue = GCD.serial(CarlosGlobals.QueueNamePrefix + "logger")
15 |
16 | /**
17 | Called to output the log message. Override for custom logging.
18 | */
19 | public static var output: (String, Level) -> Void = { (msg, level) in
20 | queue.async {
21 | print("[Carlos][\(level.rawValue)]: \(msg)")
22 | }
23 | }
24 |
25 | /**
26 | Logs a message on the console
27 |
28 | - parameter message: The message to log
29 |
30 | This method uses the output closure internally to output the message. The closure is always dispatched on the main queue
31 | */
32 | public static func log(message: String, _ level: Level = Level.Debug) {
33 | GCD.main {
34 | self.output(message, level)
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/MemoryCacheLevel.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// This class is a memory cache level. It internally uses NSCache, and has a configurable total cost limit that defaults to 50 MB.
5 | public final class MemoryCacheLevel: CacheLevel {
6 | /// At the moment the memory cache level only accepts String keys
7 | public typealias KeyType = K
8 | public typealias OutputType = T
9 |
10 | private let internalCache: NSCache
11 |
12 | /**
13 | Initializes a new memory cache level
14 |
15 | - parameter cost: The total cost limit for the memory cache. Defaults to 50 MB
16 | */
17 | public init(capacity: Int = 50 * 1024 * 1024) {
18 | internalCache = NSCache()
19 | internalCache.totalCostLimit = capacity
20 | }
21 |
22 | /**
23 | Synchronously gets a value for the given key
24 |
25 | - parameter key: The key for the value
26 |
27 | - returns: A Future where you can call onSuccess and onFailure to be notified of the result of the fetch
28 | */
29 | public func get(key: KeyType) -> Future {
30 | let request = Promise()
31 | if let result = internalCache.objectForKey(key.toString()) as? T {
32 | Logger.log("Fetched \(key.toString()) on memory level")
33 | request.succeed(result)
34 | } else {
35 | Logger.log("Failed fetching \(key.toString()) on the memory cache")
36 | request.fail(FetchError.ValueNotInCache)
37 | }
38 |
39 | return request.future
40 | }
41 |
42 | /**
43 | Clears the contents of the cache
44 | */
45 | public func onMemoryWarning() {
46 | clear()
47 | }
48 |
49 | /**
50 | Sets a value for the given key
51 |
52 | - parameter value: The value to set
53 | - parameter key: The key for the value
54 | */
55 | public func set(value: T, forKey key: K) {
56 | Logger.log("Setting a value for the key \(key.toString()) on the memory cache \(self)")
57 | internalCache.setObject(value, forKey: key.toString(), cost: value.cost)
58 | }
59 |
60 | /**
61 | Clears the contents of the cache
62 | */
63 | public func clear() {
64 | internalCache.removeAllObjects()
65 | }
66 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/MemoryWarning.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | extension CacheLevel where Self: AnyObject {
4 | /**
5 | Adds a memory warning listener on the given cache
6 |
7 | - returns: The token that you should use later on to unsubscribe
8 | */
9 | public func listenToMemoryWarnings() -> NSObjectProtocol {
10 | return NSNotificationCenter.defaultCenter().addObserverForName(UIApplicationDidReceiveMemoryWarningNotification, object: nil, queue: NSOperationQueue.mainQueue(), usingBlock: { [weak self] _ in
11 | self?.onMemoryWarning()
12 | })
13 | }
14 | }
15 |
16 | /**
17 | Removes the memory warning listener
18 |
19 | - parameter token: The token you got from the call to listenToMemoryWarning: previously
20 | */
21 | public func unsubscribeToMemoryWarnings(token: NSObjectProtocol) {
22 | NSNotificationCenter.defaultCenter().removeObserver(token, name: UIApplicationDidReceiveMemoryWarningNotification, object: nil)
23 | }
24 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/NSKeyedUnarchiver+SwiftUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSKeyedUnarchiver+SwiftUtilities.h
3 | // Carlos
4 | //
5 | // Created by Monaco, Vittorio on 03/09/15.
6 | // Copyright (c) 2015 WeltN24. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSKeyedUnarchiver (SwiftUtilities)
12 |
13 | /**
14 | Safely unarchives an object at a given file path through NSKeyedUnarchiver
15 |
16 | :param: filePath The path to the file to unarchive
17 |
18 | :returns: The unarchived object if the unarchive operation was successful, or nil if the unarchiver threw an exception
19 | */
20 | + (id) su_unarchiveObjectWithFilePath:(NSString *)filePath;
21 |
22 | /**
23 | Safely unarchives an object from an NSData instance through NSKeyedUnarchiver
24 |
25 | :param: data The data containing the object to unarchive
26 |
27 | :returns: The unarchived object if the unarchive operation was successful, or nil if the unarchiver threw an exception
28 | */
29 | + (id) su_unarchiveObjectWithData:(NSData *)data;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/NSKeyedUnarchiver+SwiftUtilities.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSKeyedUnarchiver+SwiftUtilities.m
3 | // Carlos
4 | //
5 | // Created by Monaco, Vittorio on 03/09/15.
6 | // Copyright (c) 2015 WeltN24. All rights reserved.
7 | //
8 |
9 | #import "NSKeyedUnarchiver+SwiftUtilities.h"
10 |
11 | @implementation NSKeyedUnarchiver (SwiftUtilities)
12 |
13 | + (id) su_unarchiveObjectWithFilePath:(NSString *)filePath {
14 | id object = nil;
15 |
16 | @try {
17 | object = [self unarchiveObjectWithFile:filePath];
18 | } @catch (NSException *exception) {
19 | object = nil;
20 | }
21 |
22 | return object;
23 | }
24 |
25 | + (id) su_unarchiveObjectWithData:(NSData *)data {
26 | id object = nil;
27 |
28 | @try {
29 | object = [self unarchiveObjectWithData:data];
30 | } @catch (NSException *exception) {
31 | object = nil;
32 | }
33 |
34 | return object;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Normalize.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | extension CacheLevel {
4 |
5 | /**
6 | Normalizes the CacheLevel into a BasicCache.
7 | Use this function when you want to have a value of type BasicCache (e.g. to store as a instance property) and you don't care about the specific class of the CacheLevel you're going to obtain from the sequence of Carlos composition calls
8 |
9 | - returns: The CacheLevel normalized to appear as a BasicCache.
10 | */
11 | public func normalize() -> BasicCache {
12 | if let normalized = self as? BasicCache {
13 | return normalized
14 | } else {
15 | return BasicCache(
16 | getClosure: self.get,
17 | setClosure: self.set,
18 | clearClosure: self.clear,
19 | memoryClosure: self.onMemoryWarning
20 | )
21 | }
22 | }
23 | }
24 |
25 | /**
26 | Normalizes a given CacheLevel into a BasicCache.
27 | Use this function when you want to have a value of type BasicCache (e.g. to store as a instance property) and you don't care about the specific class of the CacheLevel you're going to obtain from the sequence of Carlos composition calls
28 |
29 | - parameter cache: The CacheLevel you want to normalize
30 |
31 | - returns: The same CacheLevel normalized to appear as a BasicCache.
32 | */
33 | @available(*, deprecated=0.5)
34 | public func normalize(cache: C) -> BasicCache {
35 | return cache.normalize()
36 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/OneWayTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// Abstract an object that can transform values to another type
5 | public protocol OneWayTransformer {
6 | /// The input type of the transformer
7 | associatedtype TypeIn
8 |
9 | /// The output type of the transformer
10 | associatedtype TypeOut
11 |
12 | /**
13 | Apply the transformation from A to B
14 |
15 | - parameter val: The value to transform
16 |
17 | - returns: A Future that will contain the transformed value, or fail if the transformation failed
18 | */
19 | func transform(val: TypeIn) -> Future
20 | }
21 |
22 | /// Simple implementation of the OneWayTransformer protocol
23 | public final class OneWayTransformationBox: OneWayTransformer {
24 | /// The input type of the transformation box
25 | public typealias TypeIn = I
26 |
27 | /// The output type of the transformation box
28 | public typealias TypeOut = O
29 |
30 | private let transformClosure: I -> Future
31 |
32 | /**
33 | Initializes a 1-way transformation box with the given closure
34 |
35 | - parameter transform: The transformation closure to convert a value of type TypeIn into a value of type TypeOut
36 | */
37 | public init(transform: (I -> Future)) {
38 | self.transformClosure = transform
39 | }
40 |
41 | /**
42 | Transforms a value of type TypeIn into a value of type TypeOut
43 |
44 | - parameter val: The value to convert
45 |
46 | - returns: A Future that will contain the converted value or fail if the transformation fails
47 | */
48 | public func transform(val: TypeIn) -> Future {
49 | return transformClosure(val)
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/StringConvertible.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// Represents a type that can be converted to a string
4 | public protocol StringConvertible {
5 | /**
6 | - returns: the String representation of the value
7 | */
8 | func toString() -> String
9 | }
10 |
11 | extension String: StringConvertible {
12 | /**
13 | - returns: The value itself
14 | */
15 | public func toString() -> String {
16 | return self
17 | }
18 | }
19 |
20 | extension NSString: StringConvertible {
21 | /**
22 | - returns: The value itself
23 | */
24 | public func toString() -> String {
25 | return self as String
26 | }
27 | }
28 |
29 | extension NSURL: StringConvertible {
30 | /**
31 | - returns: The absolute string or an empty string if the absolute string is nil
32 | */
33 | public func toString() -> String {
34 | return absoluteString ?? ""
35 | }
36 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/StringTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /**
5 | This class takes care of transforming NSData instances into String values.
6 | */
7 | public class StringTransformer: TwoWayTransformer {
8 | public enum Error: ErrorType {
9 | case InvalidData
10 | case DataConversionToStringFailed
11 | }
12 |
13 | public typealias TypeIn = NSData
14 | public typealias TypeOut = String
15 |
16 | private let encoding: NSStringEncoding
17 |
18 | /**
19 | Initializes a new instance of StringTransformer
20 |
21 | - parameter encoding: The encoding the transformer will use when serializing and deserializing NSData instances. By default it's NSUTF8StringEncoding
22 | */
23 | public init(encoding: NSStringEncoding = NSUTF8StringEncoding) {
24 | self.encoding = encoding
25 | }
26 |
27 | /**
28 | Serializes a NSData instance into a String with the configured encoding
29 |
30 | - parameter val: The NSData instance to serialize
31 |
32 | - returns: A Future containing the serialized String with the given encoding if the input is valid
33 | */
34 | public func transform(val: TypeIn) -> Future {
35 | return Future(value: NSString(data: val, encoding: encoding) as? String, error: Error.InvalidData)
36 | }
37 |
38 | /**
39 | Deserializes a String into a NSData instance
40 |
41 | - parameter val: The String to deserialize
42 |
43 | - returns: A Future instance containing the bytes representation of the given string
44 | */
45 | public func inverseTransform(val: TypeOut) -> Future {
46 | return Future(value: val.dataUsingEncoding(encoding, allowLossyConversion: false), error: Error.DataConversionToStringFailed)
47 | }
48 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/Transformers.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 | import MapKit
4 |
5 | /**
6 | NSDateFormatter extension to conform to the TwoWayTransformer protocol
7 |
8 | This class transforms from NSDate to String (transform) and viceversa (inverseTransform)
9 | */
10 | extension NSDateFormatter: TwoWayTransformer {
11 | public enum Error: ErrorType {
12 | case InvalidInputString
13 | }
14 |
15 | public typealias TypeIn = NSDate
16 | public typealias TypeOut = String
17 |
18 | public func transform(val: TypeIn) -> Future {
19 | return Future(stringFromDate(val))
20 | }
21 |
22 | public func inverseTransform(val: TypeOut) -> Future {
23 | return Future(value: dateFromString(val), error: Error.InvalidInputString)
24 | }
25 | }
26 |
27 | /**
28 | NSNumberFormatter extension to conform to the TwoWayTransformer protocol
29 |
30 | This class transforms from NSNumber to String (transform) and viceversa (inverseTransform)
31 | */
32 | extension NSNumberFormatter: TwoWayTransformer {
33 | public enum Error: ErrorType {
34 | case CannotConvertToString
35 | case InvalidString
36 | }
37 |
38 | public typealias TypeIn = NSNumber
39 | public typealias TypeOut = String
40 |
41 | public func transform(val: TypeIn) -> Future {
42 | return Future(value: stringFromNumber(val), error: Error.CannotConvertToString)
43 | }
44 |
45 | public func inverseTransform(val: TypeOut) -> Future {
46 | return Future(value: numberFromString(val), error: Error.InvalidString)
47 | }
48 | }
49 |
50 | /**
51 | MKDistanceFormatter extension to conform to the TwoWayTransformer protocol
52 |
53 | This class transforms from CLLocationDistance to String (transform) and viceversa (inverseTransform)
54 | */
55 | extension MKDistanceFormatter: TwoWayTransformer {
56 | public typealias TypeIn = CLLocationDistance
57 | public typealias TypeOut = String
58 |
59 | public func transform(val: TypeIn) -> Future {
60 | return Future(stringFromDistance(val))
61 | }
62 |
63 | public func inverseTransform(val: TypeOut) -> Future {
64 | return Future(distanceFromString(val))
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/TwoWayTransformer.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | /// Abstract an object that can transform values to another type and back to the original one
5 | public protocol TwoWayTransformer: OneWayTransformer {
6 | /**
7 | Apply the inverse transformation from B to A
8 |
9 | - parameter val: The value to inverse transform
10 |
11 | - returns: A Future that will contain the original value, or fail if the transformation failed
12 | */
13 | func inverseTransform(val: TypeOut) -> Future
14 | }
15 |
16 | extension TwoWayTransformer {
17 |
18 | /**
19 | Inverts a TwoWayTransformer
20 |
21 | - returns: A TwoWayTransformationBox that takes the output type of the original transformer and returns the input type of the original transformer
22 | */
23 | public func invert() -> TwoWayTransformationBox {
24 | return TwoWayTransformationBox(
25 | transform: self.inverseTransform,
26 | inverseTransform: self.transform
27 | )
28 | }
29 | }
30 |
31 | /// Simple implementation of the TwoWayTransformer protocol
32 | public final class TwoWayTransformationBox: TwoWayTransformer {
33 | /// The input type of the transformation box
34 | public typealias TypeIn = I
35 |
36 | /// The output type of the transformation box
37 | public typealias TypeOut = O
38 |
39 | private let transformClosure: I -> Future
40 | private let inverseTransformClosure: O -> Future
41 |
42 | /**
43 | Initializes a new instance of a 2-way transformation box
44 |
45 | - parameter transform: The transformation closure to convert a value of type TypeIn to a value of type TypeOut
46 | - parameter inverseTransform: The transformation closure to convert a value of type TypeOut to a value of type TypeIn
47 | */
48 | public init(transform: (I -> Future), inverseTransform: (O -> Future)) {
49 | self.transformClosure = transform
50 | self.inverseTransformClosure = inverseTransform
51 | }
52 |
53 | /**
54 | Converts a value of type TypeIn to a value of type TypeOut
55 |
56 | - parameter val: The value to convert
57 |
58 | - returns: A Future that will contain the converted value, or fail if the transformation fails
59 | */
60 | public func transform(val: I) -> Future {
61 | return transformClosure(val)
62 | }
63 |
64 | /**
65 | Converts a value of type TypeOut to a value of type TypeIn
66 |
67 | - parameter val: The value to convert
68 |
69 | - returns: A Future that will contain the converted value, or fail if the inverse transformation fails
70 | */
71 | public func inverseTransform(val: O) -> Future {
72 | return inverseTransformClosure(val)
73 | }
74 | }
75 |
76 | /**
77 | Inverts a TwoWayTransformer
78 |
79 | - parameter transformer: The TwoWayTransformer you want to invert
80 |
81 | - returns: A TwoWayTransformationBox that takes the output type of the original transformer and returns the input type of the original transformer
82 | */
83 | @available(*, deprecated=0.6)
84 | public func invert(transformer: A) -> TwoWayTransformationBox {
85 | return transformer.invert()
86 | }
--------------------------------------------------------------------------------
/Example/Pods/Carlos/Carlos/ValueTransformation.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import PiedPiper
3 |
4 | extension Future {
5 |
6 | /**
7 | Mutates a Future from a type A to a type B through a OneWayTransformer
8 |
9 | - parameter origin: The original Future
10 | - parameter transformer: The OneWayTransformer from A to B
11 |
12 | - returns: A new Future
13 | */
14 | internal func mutate(transformer: A) -> Future {
15 | return flatMap(transformer.transform)
16 | }
17 |
18 | /**
19 | Mutates a Future from a type A to a type B through a OneWayTransformer
20 |
21 | - parameter origin: The original Future
22 | - parameter transformerClosure: The transformation closure from A to B
23 |
24 | - returns: A new Future
25 | */
26 | @available(*, deprecated=0.7)
27 | internal func mutate(transformerClosure: T -> Future) -> Future {
28 | return self.mutate(wrapClosureIntoOneWayTransformer(transformerClosure))
29 | }
30 | }
31 |
32 | extension CacheLevel {
33 |
34 | /**
35 | Applies a transformation to the cache level
36 | The transformation works by changing the type of the value the cache returns when succeeding
37 | Use this transformation when you store a value type but want to mount the cache in a pipeline that works with other value types
38 |
39 | - parameter transformer: The transformation you want to apply
40 |
41 | - returns: A new cache result of the transformation of the original cache
42 | */
43 | public func transformValues(transformer: A) -> BasicCache {
44 | return BasicCache(
45 | getClosure: { key in
46 | return self.get(key).mutate(transformer)
47 | },
48 | setClosure: { (value, key) in
49 | transformer.inverseTransform(value)
50 | .onSuccess { transformedValue in
51 | self.set(transformedValue, forKey: key)
52 | }
53 | },
54 | clearClosure: self.clear,
55 | memoryClosure: self.onMemoryWarning
56 | )
57 | }
58 | }
59 |
60 | /**
61 | Applies a transformation to a cache level
62 | The transformation works by changing the type of the value the cache returns when succeeding
63 | Use this transformation when you store a value type but want to mount the cache in a pipeline that works with other value types
64 |
65 | - parameter cache: The cache level you want to transform
66 | - parameter transformer: The transformation you want to apply
67 |
68 | - returns: A new cache result of the transformation of the original cache
69 | */
70 | @available(*, deprecated=0.5)
71 | public func transformValues(cache: A, transformer: B) -> BasicCache {
72 | return cache.transformValues(transformer)
73 | }
74 |
75 | /**
76 | Applies a transformation to a cache level
77 | The transformation works by changing the type of the value the cache returns when succeeding
78 | Use this transformation when you store a value type but want to mount the cache in a pipeline that works with other value types
79 |
80 | - parameter cache: The cache level you want to transform
81 | - parameter transformer: The transformation you want to apply
82 |
83 | - returns: A new cache result of the transformation of the original cache
84 | */
85 | public func =>>(cache: A, transformer: B) -> BasicCache {
86 | return cache.transformValues(transformer)
87 | }
88 |
--------------------------------------------------------------------------------
/Example/Pods/Carlos/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 WeltN24 GmbH
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/Oatmeal.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Oatmeal",
3 | "version": "0.3.3",
4 | "summary": "Oatmeal is a refreshing Swift Framework to make bootstrapping your apps much easier.",
5 | "description": "Oatmeal is a refreshing Swift Framework to make bootstrapping your apps much easier. Mmmkay?",
6 | "homepage": "http://getoatmeal.com",
7 | "license": "MIT",
8 | "authors": {
9 | "mikenolimits": "empathynyc@gmail.com"
10 | },
11 | "source": {
12 | "git": "https://github.com/OatmealCode/Oatmeal.git",
13 | "tag": "0.3.3"
14 | },
15 | "social_media_url": "https://twitter.com/mikenolimits",
16 | "platforms": {
17 | "ios": "8.0",
18 | "osx": "10.10",
19 | "tvos": "9.0"
20 | },
21 | "source_files": "Pod/Classes/**/*.swift",
22 | "dependencies": {
23 | "Alamofire": [
24 |
25 | ],
26 | "AlamofireImage": [
27 |
28 | ],
29 | "SwiftyJSON": [
30 |
31 | ],
32 | "Carlos": [
33 |
34 | ]
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/SwiftyJSON.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SwiftyJSON",
3 | "version": "2.3.2",
4 | "summary": "SwiftyJSON makes it easy to deal with JSON data in Swift",
5 | "homepage": "https://github.com/SwiftyJSON/SwiftyJSON",
6 | "license": {
7 | "type": "MIT"
8 | },
9 | "authors": {
10 | "lingoer": "lingoerer@gmail.com",
11 | "tangplin": "tangplin@gmail.com"
12 | },
13 | "requires_arc": true,
14 | "platforms": {
15 | "osx": "10.9",
16 | "ios": "8.0",
17 | "watchos": "2.0",
18 | "tvos": "9.0"
19 | },
20 | "source": {
21 | "git": "https://github.com/SwiftyJSON/SwiftyJSON.git",
22 | "tag": "2.3.2"
23 | },
24 | "source_files": "Source/*.swift"
25 | }
26 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Alamofire (3.4.0)
3 | - AlamofireImage (2.4.0):
4 | - Alamofire (~> 3.3)
5 | - Carlos (0.8):
6 | - PiedPiper (~> 0.8)
7 | - Oatmeal (0.3.3):
8 | - Alamofire
9 | - AlamofireImage
10 | - Carlos
11 | - SwiftyJSON
12 | - PiedPiper (0.8)
13 | - SwiftyJSON (2.3.2)
14 |
15 | DEPENDENCIES:
16 | - Alamofire
17 | - AlamofireImage
18 | - Carlos
19 | - Oatmeal (from `../`)
20 | - SwiftyJSON (from `https://github.com/SwiftyJSON/SwiftyJSON.git`)
21 |
22 | EXTERNAL SOURCES:
23 | Oatmeal:
24 | :path: "../"
25 | SwiftyJSON:
26 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
27 |
28 | CHECKOUT OPTIONS:
29 | SwiftyJSON:
30 | :commit: 2a5b70f06001316d4fb54501edc70b4084705da0
31 | :git: https://github.com/SwiftyJSON/SwiftyJSON.git
32 |
33 | SPEC CHECKSUMS:
34 | Alamofire: c19a627cefd6a95f840401c49ab1f124e07f54ee
35 | AlamofireImage: 87408b652e0f5ae5fe364035f15aea8b9b24c77e
36 | Carlos: a81e995dae4301a461be98a7363da2f1cf83a2bf
37 | Oatmeal: 9304bf1f96a255ba052e95d2d09de2f5206f6e15
38 | PiedPiper: cadc2fdfedb538958f3c42feffbe6812cdb4ec86
39 | SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a
40 |
41 | PODFILE CHECKSUM: 3f8702069da5627000a812e39be4b2a8b53a3c10
42 |
43 | COCOAPODS: 1.0.0.beta.6
44 |
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 WeltN24 GmbH
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/FunctionComposition.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | infix operator >>> { associativity left }
4 |
5 | /**
6 | Composes two sync closures
7 |
8 | - parameter f: A closure taking an A parameter and returning an Optional
9 | - parameter g: A closure taking a B parameter and returning an Optional
10 |
11 | - returns: A closure taking an A parameter and returning an Optional obtained by combining f and g in a way similar to g(f(x))
12 | */
13 | public func >>> (f: A -> B?, g: B -> C?) -> A -> C? {
14 | return { x in
15 | if let fx = f(x) {
16 | return g(fx)
17 | } else {
18 | return nil
19 | }
20 | }
21 | }
22 |
23 | /**
24 | Composes two sync closures
25 |
26 | - parameter f: A closure taking an A parameter and returning a value of type B
27 | - parameter g: A closure taking a B parameter and returning a value of type C
28 |
29 | - returns: A closure taking an A parameter and returning a value of type C obtained by combining f and g through g(f(x))
30 | */
31 | public func >>> (f: A -> B, g: B -> C) -> A -> C {
32 | return { x in
33 | g(f(x))
34 | }
35 | }
36 |
37 | /**
38 | Composes two async (Future) closures
39 |
40 | - parameter f: A closure taking an A parameter and returning a Future (basically a future for a B return type)
41 | - parameter g: A closure taking a B parameter and returning a Future (basically a future for a C return type)
42 |
43 | - returns: A closure taking an A parameter and returning a Future (basically a future for a C return type) obtained by combining f and g in a way similar to g(f(x)) (if the closures were sync)
44 | */
45 | public func >>> (f: A -> Future, g: B -> Future) -> A -> Future {
46 | return { param in
47 | let resultingRequest = Promise()
48 |
49 | f(param)
50 | .onSuccess { result in
51 | resultingRequest.mimic(g(result))
52 | }
53 | .onCancel(resultingRequest.cancel)
54 | .onFailure(resultingRequest.fail)
55 |
56 | return resultingRequest.future
57 | }
58 | }
59 |
60 | //Expose later if it makes sense to
61 | /**
62 | Composes two async closures
63 |
64 | - parameter f: A closure taking an A parameter and a completion callback taking an Optional and returning Void
65 | - parameter g: A closure taking a B parameter and a completion callback taking an Optional and returning Void
66 |
67 | - returns: A closure taking an A parameter and a completion callback taking an Optional and returning Void obtained by combining f and g in a way similar to g(f(x)) (if the closures were sync)
68 | */
69 | internal func >>> (f: (A, B? -> Void) -> Void, g: (B, C? -> Void) -> Void) -> (A, C? -> Void) -> Void {
70 | return { x, completion in
71 | f(x) { fx in
72 | if let fx = fx {
73 | g(fx) { result in
74 | completion(result)
75 | }
76 | } else {
77 | completion(nil)
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Filter.swift:
--------------------------------------------------------------------------------
1 | /// Errors that can arise when filtering Futures
2 | public enum FutureFilteringError: ErrorType {
3 | /// When the filter condition is not satisfied
4 | case ConditionUnsatisfied
5 | }
6 |
7 | extension Future {
8 | /**
9 | Filters the Future with a condition
10 |
11 | - parameter filter: The condition closure that determines whether the result of the Future is valid or not
12 |
13 | - result: A new Future that only succeeds if the original Future succeeds with a value that passes the given condition
14 | */
15 | public func filter(filter: T -> Bool) -> Future {
16 | return _map { value, mapped in
17 | if filter(value) {
18 | mapped.succeed(value)
19 | } else {
20 | mapped.fail(FutureFilteringError.ConditionUnsatisfied)
21 | }
22 | }
23 | }
24 |
25 | /**
26 | Filters the Future with a condition Future
27 |
28 | - parameter filter: The condition Future that determines whether the result of the Future is valid or not
29 |
30 | - result: A new Future that only succeeds if the original Future succeeds with a value that succeeds the Future returned by the given condition
31 | */
32 | public func filter(filter: T -> Future) -> Future {
33 | return _map { value, mapped in
34 | filter(value).onCompletion { filterResult in
35 | switch filterResult {
36 | case .Success(let result):
37 | if result {
38 | mapped.succeed(value)
39 | } else {
40 | mapped.fail(FutureFilteringError.ConditionUnsatisfied)
41 | }
42 | case .Error(let error):
43 | mapped.fail(error)
44 | case .Cancelled:
45 | mapped.cancel()
46 | }
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+FlatMap.swift:
--------------------------------------------------------------------------------
1 | /// Errors that can arise when mapping Futures
2 | public enum FutureMappingError: ErrorType {
3 | /// When the value can't be mapped
4 | case CantMapValue
5 | }
6 |
7 | extension Future {
8 | /**
9 | Maps a Future into a Future through a function that takes a value of type T and returns a value of type U?
10 |
11 | - parameter f: The closure that takes a value of type T and returns a value of type U?
12 |
13 | - returns: A new Future that will behave as the original one w.r.t. cancelation and failure, but will succeed with a value of type U obtained through the given closure, unless the latter returns nil. In this case, the new Future will fail
14 | */
15 | public func flatMap(f: T -> U?) -> Future {
16 | return _map { value, mapped in
17 | if let mappedValue = f(value) {
18 | mapped.succeed(mappedValue)
19 | } else {
20 | mapped.fail(FutureMappingError.CantMapValue)
21 | }
22 | }
23 | }
24 |
25 | /**
26 | Maps a Future into a Future through a function that takes a value of type T and returns a Result
27 |
28 | - parameter f: The closure that takes a value of type T and returns a Result
29 |
30 | - returns: A new Future that will behave as the original one w.r.t. cancelation and failure, but will succeed with a value of type U obtained through the given closure if the returned Result is a success. Otherwise, the new Future will fail or get canceled depending on the state of the returned Result
31 | */
32 | public func flatMap(f: T -> Result) -> Future {
33 | return _map { value, mapped in
34 | mapped.mimic(f(value))
35 | }
36 | }
37 |
38 | /**
39 | Maps a Future into a Future through a function that takes a value of type T and returns a Future
40 |
41 | - parameter f: The closure that takes a value of type T and returns a Future
42 |
43 | - returns: A new Future that will behave as the original one w.r.t. cancelation and failure, but will succeed with a value of type U when the given Future will succeed. If the given Future fails or is canceled, the new Future will do so too.
44 | */
45 | public func flatMap(f: T -> Future) -> Future {
46 | return _map { value, mapped in
47 | mapped.mimic(f(value))
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Map.swift:
--------------------------------------------------------------------------------
1 | extension Future {
2 | func _map(handler: (T, Promise) -> Void) -> Future {
3 | let mapped = Promise()
4 |
5 | self.onCompletion { result in
6 | switch result {
7 | case .Success(let value):
8 | handler(value, mapped)
9 | case .Error(let error):
10 | mapped.fail(error)
11 | case .Cancelled:
12 | mapped.cancel()
13 | }
14 | }
15 |
16 | mapped.onCancel(cancel)
17 |
18 | return mapped.future
19 | }
20 |
21 | /**
22 | Maps a Future into a Future through a function that takes a value of type T and returns a value of type U
23 |
24 | - parameter f: The closure that takes a value of type T and returns a value of type U
25 |
26 | - returns: A new Future that will behave as the original one w.r.t. cancelation and failure, but will succeed with a value of type U obtained through the given closure
27 | */
28 | public func map(f: T -> U) -> Future {
29 | return _map { value, mapped in
30 | mapped.succeed(f(value))
31 | }
32 | }
33 |
34 | /**
35 | Maps a Future into a Future through a function that takes a value of type T and returns a value of type U
36 |
37 | - parameter f: The closure that takes a value of type T and returns a value of type U. Please note the closure can throw
38 |
39 | - returns: A new Future that will behave as the original one w.r.t. cancelation and failure, but will succeed with a value of type U obtained through the given closure, unless the latter throws. In this case, the new Future will fail
40 | */
41 | public func map(f: T throws -> U) -> Future {
42 | return _map { value, mapped in
43 | do {
44 | mapped.succeed(try f(value))
45 | } catch {
46 | mapped.fail(error)
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Merge.swift:
--------------------------------------------------------------------------------
1 | extension SequenceType where Generator.Element: Async {
2 | /**
3 | Merges this sequence of Futures into a single one containing the list of the results of each Future
4 |
5 | - returns: A Future that will succeed with the list of results of the single Futures contained in this Sequence. The resulting Future will fail or be canceled if one of the elements of this sequence fails or is canceled
6 | */
7 | public func merge() -> Future<[Generator.Element.Value]> {
8 | return reduce([], combine: { accumulator, value in
9 | accumulator + [value]
10 | })
11 | }
12 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Recover.swift:
--------------------------------------------------------------------------------
1 | extension Future {
2 | private func _recover(handler: Promise -> Void) -> Future {
3 | let recovered = Promise()
4 |
5 | onCompletion { result in
6 | switch result {
7 | case .Success(let value):
8 | recovered.succeed(value)
9 | case .Error:
10 | handler(recovered)
11 | case .Cancelled:
12 | recovered.cancel()
13 | }
14 | }
15 |
16 | return recovered.future
17 | }
18 |
19 | /**
20 | Recovers this Future so that if it fails it can actually use the "rescue value"
21 |
22 | - parameter handler: The closure that provides the rescue value
23 |
24 | - returns: A new Future that will behave as this Future, except when this Future fails. In that case, it will succeed with the rescue value
25 | */
26 | public func recover(handler: Void -> T) -> Future {
27 | return _recover { recovered in
28 | recovered.succeed(handler())
29 | }
30 | }
31 |
32 | /**
33 | Recovers this Future so that if it fails it can actually use the "rescue value"
34 |
35 | - parameter handler: The rescue value
36 |
37 | - returns: A new Future that will behave as this Future, except when this Future fails. In that case, it will succeed with the rescue value
38 | */
39 | public func recover(value: T) -> Future {
40 | return recover({ value })
41 | }
42 |
43 | /**
44 | Recovers this Future so that if it fails it can actually use a "rescue value"
45 |
46 | - parameter handler: The closure that provides a Future that will try to provide a rescue value
47 |
48 | - returns: A new Future that will behave as this Future, except when this Future fails. In that case, it will mimic the outcome of the Future provided by the handler
49 | */
50 | public func recover(handler: Void -> Future) -> Future {
51 | return _recover { recovered in
52 | recovered.mimic(handler())
53 | }
54 | }
55 |
56 | /**
57 | Recovers this Future so that if it fails it can actually use a "rescue value"
58 |
59 | - parameter handler: The closure that provides a Result that will try to provide a rescue value
60 |
61 | - returns: A new Future that will behave as this Future, except when this Future fails. In that case, it will mimic the outcome of the Result provided by the handler
62 | */
63 | public func recover(handler: Void -> Result) -> Future {
64 | return _recover { recovered in
65 | recovered.mimic(handler())
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Reduce.swift:
--------------------------------------------------------------------------------
1 | extension SequenceType where Generator.Element: Async {
2 | /**
3 | Reduces a sequence of Future`` into a single Future`` through a closure that takes a value T and the current accumulated value of the previous iterations (starting from initialValue and following the order of the sequence) and returns a value of type U
4 |
5 | - parameter initialValue: The initial value for the reduction of this sequence
6 | - parameter combine: The closure used to reduce the sequence
7 |
8 | - returns: a new Future`` that will succeed when all the Future`` of this array will succeed, with a value obtained through the execution of the combine closure on each result of the original Futures in the same order. The result will fail or get canceled if one of the original futures fails or gets canceled
9 | */
10 | public func reduce(initialValue: U, combine: (accumulator: U, value: Generator.Element.Value) -> U) -> Future {
11 | let result = reduce(Future(initialValue), combine: { accumulator, value in
12 | accumulator.flatMap { reduced in
13 | value.future.map { mapped in
14 | combine(accumulator: reduced, value: mapped)
15 | }
16 | }
17 | })
18 |
19 | result.onCancel {
20 | self.forEach {
21 | $0.future.cancel()
22 | }
23 | }
24 |
25 | return result
26 | }
27 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Traverse.swift:
--------------------------------------------------------------------------------
1 | extension SequenceType {
2 | /**
3 | Maps this sequence with the provided closure generating Futures, then merges the created Futures into a single one
4 |
5 | - parameter generator: The closure that generates a Future for each element in this sequence
6 |
7 | - returns: A new Future containing the list of results of the single Futures generated through the closure. The resulting Future will fail or be canceled if one of the Futures generated through the closure fails or is canceled
8 | */
9 | public func traverse(generator: Generator.Element -> Future) -> Future<[U]> {
10 | return map(generator).merge()
11 | }
12 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Future+Zip.swift:
--------------------------------------------------------------------------------
1 | extension Future {
2 | /**
3 | Zips this Future with another Future`` to obtain a Future of type (T,U)
4 |
5 | - parameter other: The other Future you want to zip
6 |
7 | - returns: A new Future of type (T, U) that will only succeed if both Futures succeed. It will fail or be canceled accordingly to its components
8 | */
9 | public func zip(other: Future) -> Future<(T, U)> {
10 | return flatMap { thisResult in
11 | other.map { otherResult in
12 | (thisResult, otherResult)
13 | }
14 | }
15 | }
16 |
17 | /**
18 | Zips this Future with a Result`` to obtain a Future of type (T,U)
19 |
20 | - parameter other: The Result you want to zip
21 |
22 | - returns: A new Future of type (T, U) that will only succeed if both this Future and the Result succeed. It will fail or be canceled accordingly to its components
23 | */
24 | public func zip(other: Result) -> Future<(T, U)> {
25 | return other.flatMap { otherResult in
26 | self.map { thisResult in
27 | (thisResult, otherResult)
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/ReadWriteLock.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ReadWriteLock.swift
3 | // ReadWriteLock
4 | //
5 | // Created by John Gallagher on 7/17/14.
6 | // Copyright © 2014-2015 Big Nerd Ranch. Licensed under MIT.
7 | //
8 |
9 | import Foundation
10 |
11 | /// Abstracts a Read/Write lock
12 | public protocol ReadWriteLock {
13 | /**
14 | Executes a given closure with a read lock
15 |
16 | - parameter body: The code to execute with a read lock
17 |
18 | - returns: The result of the given code
19 | */
20 | func withReadLock(@noescape body: () -> T) -> T
21 |
22 | /**
23 | Executes a given closure with a write lock
24 |
25 | - parameter body: The code to execute with a write lock
26 |
27 | - returns: The result of the given code
28 | */
29 | func withWriteLock(@noescape body: () -> T) -> T
30 | }
31 |
32 | /// An implemenation of ReadWriteLock based on pthread, taken from https://github.com/bignerdranch/Deferred
33 | public final class PThreadReadWriteLock: ReadWriteLock {
34 | private var lock: UnsafeMutablePointer
35 |
36 | /// Instantiates a new read/write lock
37 | public init() {
38 | lock = UnsafeMutablePointer.alloc(1)
39 | let status = pthread_rwlock_init(lock, nil)
40 | assert(status == 0)
41 | }
42 |
43 | deinit {
44 | let status = pthread_rwlock_destroy(lock)
45 | assert(status == 0)
46 | lock.dealloc(1)
47 | }
48 |
49 | public func withReadLock(@noescape body: () -> T) -> T {
50 | pthread_rwlock_rdlock(lock)
51 |
52 | defer {
53 | pthread_rwlock_unlock(lock)
54 | }
55 |
56 | return body()
57 | }
58 |
59 | public func withWriteLock(@noescape body: () -> T) -> T {
60 | pthread_rwlock_wrlock(lock)
61 |
62 | defer {
63 | pthread_rwlock_unlock(lock)
64 | }
65 |
66 | return body()
67 | }
68 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Result+Filter.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// Errors that can arise when filtering Results
4 | public enum ResultFilteringError: ErrorType {
5 | /// When the filter condition is not satisfied
6 | case ConditionUnsatisfied
7 | }
8 |
9 | extension Result {
10 | /**
11 | Filters this Result with the given condition
12 |
13 | - parameter condition: The condition you want to apply to the boxed value of this Result
14 |
15 | - returns: A new Result that will behave as this Result w.r.t. cancellation and failure, but will succeed if the boxed value satisfies the given condition, and fail with ResultFilteringError.ConditionUnsatisfied if the condition is not satisfied
16 | */
17 | public func filter(condition: T -> Bool) -> Result {
18 | return _map { value in
19 | if condition(value) {
20 | return .Success(value)
21 | } else {
22 | return .Error(ResultFilteringError.ConditionUnsatisfied)
23 | }
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Result+Map.swift:
--------------------------------------------------------------------------------
1 | /// Errors that can arise when mapping Results
2 | public enum ResultMappingError: ErrorType {
3 | /// When the boxed value can't be mapped
4 | case CantMapValue
5 | }
6 |
7 | extension Result {
8 | func _map(handler: (T, Promise) -> Void) -> Future {
9 | let mapped = Promise()
10 |
11 | switch self {
12 | case .Success(let value):
13 | handler(value, mapped)
14 | case .Error(let error):
15 | mapped.fail(error)
16 | case .Cancelled:
17 | mapped.cancel()
18 | }
19 |
20 | return mapped.future
21 | }
22 |
23 | func _map(handler: T -> Result) -> Result {
24 | switch self {
25 | case .Success(let value):
26 | return handler(value)
27 | case .Error(let error):
28 | return .Error(error)
29 | case .Cancelled:
30 | return .Cancelled
31 | }
32 | }
33 |
34 | /**
35 | Maps this Result using a simple transformation closure
36 |
37 | - parameter handler: The closure to use to map the boxed value of this Result
38 |
39 | - returns: A new Result that will behave as this Result w.r.t. cancellation and failure, but will succeed with a value of type U obtained through the given closure
40 | */
41 | public func map(handler: T -> U) -> Result {
42 | return _map {
43 | .Success(handler($0))
44 | }
45 | }
46 |
47 | /**
48 | Maps this Result using a simple transformation closure
49 |
50 | - parameter handler: The closure to use to map the boxed value of this Result
51 |
52 | - returns: A new Result that will behave as this Result w.r.t. cancellation and failure, but will succeed with a value of type U obtained through the given closure, unless the latter throws. In this case, the new Result will fail
53 | */
54 | public func map(handler: T throws -> U) -> Result {
55 | return _map { value in
56 | do {
57 | let mappedValue = try handler(value)
58 | return .Success(mappedValue)
59 | } catch {
60 | return .Error(error)
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Result+flatMap.swift:
--------------------------------------------------------------------------------
1 | extension Result {
2 | /**
3 | Flat maps this Result with the given handler returning a Future
4 |
5 | - parameter handler: The flat mapping handler that takes the boxed value of this Result and returns a Future
6 |
7 | - returns: A Future that will behave as this Result w.r.t. cancellation and failure, but will behave as the future obtained by calling the handler with the boxed value if this Result is .Success
8 | */
9 | public func flatMap(handler: T -> Future) -> Future {
10 | return _map { value, flatMapped in
11 | flatMapped.mimic(handler(value))
12 | }
13 | }
14 |
15 | /**
16 | Flat maps this Result with the given handler returning another Result
17 |
18 | - parameter handler: The flat mapping handler that takes the boxed value of this Result and returns another Result
19 |
20 | - returns: A new Result that will behave as this Result w.r.t. cancellation and failure, but will behave as the Result obtained by calling the handler with the boxed value if this Result is .Success
21 | */
22 | public func flatMap(handler: T -> Result) -> Result {
23 | return _map(handler)
24 | }
25 |
26 | /**
27 | Flat maps this Result with the given handler returning an optional U
28 |
29 | - parameter handler: The flat mapping handler that takes the boxed value of this Result and returns an optional U
30 |
31 | - returns: A new Result that will behave as this Result w.r.t. cancellation and failure, but will succeed with a value of type U obtained by calling the handler with the boxed value if this Result is .Success, unless the value is nil, in which case it will fail with a ResultMappingError.CantMapValue error
32 | */
33 | public func flatMap(handler: T -> U?) -> Result {
34 | return _map { value in
35 | if let mappedValue = handler(value) {
36 | return .Success(mappedValue)
37 | } else {
38 | return .Error(ResultMappingError.CantMapValue)
39 | }
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/Example/Pods/PiedPiper/PiedPiper/Result.swift:
--------------------------------------------------------------------------------
1 | /// Typical Result enumeration (aka Either)
2 | public enum Result {
3 | /// The result contains a Success value
4 | case Success(T)
5 |
6 | /// The result contains an error
7 | case Error(ErrorType)
8 |
9 | /// The result was cancelled
10 | case Cancelled
11 |
12 | /// The success value of this result, if any
13 | public var value: T? {
14 | if case .Success(let result) = self {
15 | return result
16 | } else {
17 | return nil
18 | }
19 | }
20 |
21 | /// The error of this result, if any
22 | public var error: ErrorType? {
23 | if case .Error(let issue) = self {
24 | return issue
25 | } else {
26 | return nil
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Oatmeal.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Example/Pods/SwiftyJSON/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Ruoyu Fu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Alamofire : NSObject
3 | @end
4 | @implementation PodsDummy_Alamofire
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double AlamofireVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char AlamofireVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap:
--------------------------------------------------------------------------------
1 | framework module Alamofire {
2 | umbrella header "Alamofire-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/Alamofire
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
5 | PODS_ROOT = ${SRCROOT}
6 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
8 | SKIP_INSTALL = YES
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Alamofire/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 | 3.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/AlamofireImage-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_AlamofireImage : NSObject
3 | @end
4 | @implementation PodsDummy_AlamofireImage
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/AlamofireImage-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/AlamofireImage-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double AlamofireImageVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char AlamofireImageVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/AlamofireImage.modulemap:
--------------------------------------------------------------------------------
1 | framework module AlamofireImage {
2 | umbrella header "AlamofireImage-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/AlamofireImage.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/AlamofireImage
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/Alamofire"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/AlamofireImage/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.4.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/Carlos-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Carlos : NSObject
3 | @end
4 | @implementation PodsDummy_Carlos
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/Carlos-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/Carlos-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "NSKeyedUnarchiver+SwiftUtilities.h"
4 |
5 | FOUNDATION_EXPORT double CarlosVersionNumber;
6 | FOUNDATION_EXPORT const unsigned char CarlosVersionString[];
7 |
8 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/Carlos.modulemap:
--------------------------------------------------------------------------------
1 | framework module Carlos {
2 | umbrella header "Carlos-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/Carlos.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/Carlos
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/PiedPiper"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Carlos/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 | 0.8.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/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 | 0.3.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/Oatmeal-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Oatmeal : NSObject
3 | @end
4 | @implementation PodsDummy_Oatmeal
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/Oatmeal-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/Oatmeal-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double OatmealVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char OatmealVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/Oatmeal.modulemap:
--------------------------------------------------------------------------------
1 | framework module Oatmeal {
2 | umbrella header "Oatmeal-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Oatmeal/Oatmeal.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/Oatmeal
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/Alamofire" "$PODS_SHARED_BUILD_DIR/AlamofireImage" "$PODS_SHARED_BUILD_DIR/Carlos" "$PODS_SHARED_BUILD_DIR/PiedPiper" "$PODS_SHARED_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/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 | 0.8.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/PiedPiper-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_PiedPiper : NSObject
3 | @end
4 | @implementation PodsDummy_PiedPiper
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/PiedPiper-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/PiedPiper-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double PiedPiperVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char PiedPiperVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/PiedPiper.modulemap:
--------------------------------------------------------------------------------
1 | framework module PiedPiper {
2 | umbrella header "PiedPiper-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/PiedPiper/PiedPiper.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/PiedPiper
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
5 | PODS_ROOT = ${SRCROOT}
6 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
8 | SKIP_INSTALL = YES
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_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-Oatmeal_Example/Pods-Oatmeal_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Oatmeal_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Oatmeal_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Example/Pods-Oatmeal_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double Pods_Oatmeal_ExampleVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char Pods_Oatmeal_ExampleVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Example/Pods-Oatmeal_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/Alamofire" "$CONFIGURATION_BUILD_DIR/AlamofireImage" "$CONFIGURATION_BUILD_DIR/Carlos" "$CONFIGURATION_BUILD_DIR/Oatmeal" "$CONFIGURATION_BUILD_DIR/PiedPiper" "$CONFIGURATION_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
5 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AlamofireImage/AlamofireImage.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Carlos/Carlos.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Oatmeal/Oatmeal.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PiedPiper/PiedPiper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "AlamofireImage" -framework "Carlos" -framework "Oatmeal" -framework "PiedPiper" -framework "SwiftyJSON"
7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Example/Pods-Oatmeal_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Oatmeal_Example {
2 | umbrella header "Pods-Oatmeal_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Example/Pods-Oatmeal_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/Alamofire" "$CONFIGURATION_BUILD_DIR/AlamofireImage" "$CONFIGURATION_BUILD_DIR/Carlos" "$CONFIGURATION_BUILD_DIR/Oatmeal" "$CONFIGURATION_BUILD_DIR/PiedPiper" "$CONFIGURATION_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
5 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AlamofireImage/AlamofireImage.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Carlos/Carlos.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Oatmeal/Oatmeal.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PiedPiper/PiedPiper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "AlamofireImage" -framework "Carlos" -framework "Oatmeal" -framework "PiedPiper" -framework "SwiftyJSON"
7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_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-Oatmeal_Tests/Pods-Oatmeal_Tests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_Oatmeal_Tests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_Oatmeal_Tests
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Tests/Pods-Oatmeal_Tests-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double Pods_Oatmeal_TestsVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char Pods_Oatmeal_TestsVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Tests/Pods-Oatmeal_Tests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/Alamofire" "$CONFIGURATION_BUILD_DIR/AlamofireImage" "$CONFIGURATION_BUILD_DIR/Carlos" "$CONFIGURATION_BUILD_DIR/Oatmeal" "$CONFIGURATION_BUILD_DIR/PiedPiper" "$CONFIGURATION_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
5 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AlamofireImage/AlamofireImage.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Carlos/Carlos.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Oatmeal/Oatmeal.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PiedPiper/PiedPiper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "AlamofireImage" -framework "Carlos" -framework "Oatmeal" -framework "PiedPiper" -framework "SwiftyJSON"
7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Tests/Pods-Oatmeal_Tests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_Oatmeal_Tests {
2 | umbrella header "Pods-Oatmeal_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-Oatmeal_Tests/Pods-Oatmeal_Tests.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/Alamofire" "$CONFIGURATION_BUILD_DIR/AlamofireImage" "$CONFIGURATION_BUILD_DIR/Carlos" "$CONFIGURATION_BUILD_DIR/Oatmeal" "$CONFIGURATION_BUILD_DIR/PiedPiper" "$CONFIGURATION_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
5 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/AlamofireImage/AlamofireImage.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Carlos/Carlos.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Oatmeal/Oatmeal.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PiedPiper/PiedPiper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
6 | OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "AlamofireImage" -framework "Carlos" -framework "Oatmeal" -framework "PiedPiper" -framework "SwiftyJSON"
7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
8 | PODS_ROOT = ${SRCROOT}/Pods
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/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.3.2
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SwiftyJSON : NSObject
3 | @end
4 | @implementation PodsDummy_SwiftyJSON
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double SwiftyJSONVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap:
--------------------------------------------------------------------------------
1 | framework module SwiftyJSON {
2 | umbrella header "SwiftyJSON-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/SwiftyJSON
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
5 | PODS_ROOT = ${SRCROOT}
6 | PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
8 | SKIP_INSTALL = YES
9 |
--------------------------------------------------------------------------------
/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 | <<<<<<< HEAD
2 | import UIKit
3 | import XCTest
4 | import OatmealFramework
5 |
6 | class Tests: XCTestCase {
7 |
8 | override func setUp() {
9 | super.setUp()
10 | // Put setup code here. This method is called before the invocation of each test method in the class.
11 | }
12 |
13 | override func tearDown() {
14 | // Put teardown code here. This method is called after the invocation of each test method in the class.
15 | super.tearDown()
16 | }
17 |
18 | func testExample() {
19 | // This is an example of a functional test case.
20 | XCTAssert(true, "Pass")
21 | }
22 |
23 | func testPerformanceExample() {
24 | // This is an example of a performance test case.
25 | self.measureBlock() {
26 | // Put the code you want to measure the time of here.
27 | }
28 | }
29 |
30 | =======
31 | // https://github.com/Quick/Quick
32 |
33 | import Quick
34 | import Nimble
35 | import Oatmeal
36 |
37 | class TableOfContentsSpec: QuickSpec {
38 | override func spec() {
39 | describe("these will fail") {
40 |
41 | it("can do maths") {
42 | expect(1) == 2
43 | }
44 |
45 | it("can read") {
46 | expect("number") == "string"
47 | }
48 |
49 | it("will eventually fail") {
50 | expect("time").toEventually( equal("done") )
51 | }
52 |
53 | context("these will pass") {
54 |
55 | it("can do maths") {
56 | expect(23) == 23
57 | }
58 |
59 | it("can read") {
60 | expect("🐮") == "🐮"
61 | }
62 |
63 | it("will eventually pass") {
64 | var time = "passing"
65 |
66 | dispatch_async(dispatch_get_main_queue()) {
67 | time = "done"
68 | }
69 |
70 | waitUntil { done in
71 | NSThread.sleepForTimeInterval(0.5)
72 | expect(time) == "done"
73 |
74 | done()
75 | }
76 | }
77 | }
78 | }
79 | }
80 | >>>>>>> 3feadc1ac1c07cd95104e2d326bcbc82aae70e5e
81 | }
82 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 mikenolimits
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 |
--------------------------------------------------------------------------------
/Oatmeal.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint Oatmeal.podspec' to ensure this is a
3 | # valid spec before submitting.
4 | #
5 | # Any lines starting with a # are optional, but their use is encouraged
6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 |
10 | Pod::Spec.new do |s|
11 | s.name = "Oatmeal"
12 | s.version = "0.3.4"
13 | s.summary = "Oatmeal is a refreshing Swift Framework to make bootstrapping your apps much easier."
14 |
15 | # This description is used to generate tags and improve search results.
16 | # * Think: What does it do? Why did you write it? What is the focus?
17 | # * Try to keep it short, snappy and to the point.
18 | # * Write the description between the DESC delimiters below.
19 | # * Finally, don't worry about the indent, CocoaPods strips it!
20 | s.description = "Oatmeal is a refreshing Swift Framework to make bootstrapping your apps much easier. Mmmkay?"
21 |
22 | s.homepage = "http://getoatmeal.com"
23 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
24 | s.license = 'MIT'
25 | s.author = { "mikenolimits" => "empathynyc@gmail.com" }
26 | s.source = { :git => "https://github.com/OatmealCode/Oatmeal.git", :tag => s.version.to_s }
27 | s.social_media_url = 'https://twitter.com/mikenolimits'
28 |
29 |
30 | s.ios.deployment_target = '8.0'
31 | s.osx.deployment_target = '10.10'
32 | s.tvos.deployment_target = '9.0'
33 |
34 | s.source_files = 'Pod/Classes/**/*.swift'
35 | #s.resource_bundles = {
36 | # 'Oatmeal' => ['Pod/Assets/*.png']
37 | # }
38 |
39 | # s.public_header_files = 'Pod/Classes/**/*.h'
40 | # s.frameworks = 'UIKit', 'MapKit'
41 | s.dependency 'Alamofire'
42 | s.dependency 'AlamofireImage'
43 | s.dependency 'SwiftyJSON'
44 | s.dependency 'Carlos'
45 | end
46 |
--------------------------------------------------------------------------------
/Pod/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OatmealCode/Oatmeal/6d49a9eb5f7ed2bb5e65616e1ef85f199ff9db9e/Pod/Assets/.gitkeep
--------------------------------------------------------------------------------
/Pod/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OatmealCode/Oatmeal/6d49a9eb5f7ed2bb5e65616e1ef85f199ff9db9e/Pod/Classes/.gitkeep
--------------------------------------------------------------------------------
/Pod/Classes/Assets/AtlasPipeline.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AtlasPipeline.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 9/17/15.
6 | //
7 | //
8 |
9 | import Foundation
10 | import SpriteKit
11 |
12 | #if os(OSX)
13 | import AppKit
14 | #endif
15 | #if os(iOS) || os(tvOS)
16 | import UIKit
17 | #endif
18 | #if os(watchOS)
19 | import WatchKit
20 | #endif
21 |
22 | public class AtlasPipeline : ProactiveResolveable
23 | {
24 | public static var entityName : String? = "AtlasPipeline"
25 |
26 | public var atlases : [String:SKTextureAtlas]
27 |
28 | public var config : Configuration?
29 |
30 | public required init()
31 | {
32 | self.atlases = [String:SKTextureAtlas]()
33 | if let config : Configuration = ~Oats()
34 | {
35 | self.config = config
36 | }
37 | }
38 |
39 | public subscript(key:String)->SKTextureAtlas?
40 | {
41 | get{
42 | return self.get(key)
43 | }
44 | set(newValue)
45 | {
46 | if let atlas = newValue
47 | {
48 | atlases[key] = atlas
49 | }
50 | }
51 | }
52 |
53 | public func get(atlasNamed:String)->SKTextureAtlas?
54 | {
55 | if let atlas = atlases[atlasNamed]
56 | {
57 | return atlas
58 | }
59 | return nil
60 | }
61 |
62 | /*
63 | To get easy access to the pipeline, and not to include it as a singleton as defualt we will add it as singleton once it is bound for the first time.
64 | */
65 | public func didBind()
66 | {
67 | self <~> Oats()
68 | }
69 |
70 | public func didResolve()
71 | {
72 | Oats().bindIf({!Oats().has(Configuration.self)},
73 | withMember : Configuration.self,
74 | completion : {
75 | self.config = (~Oats())
76 | }
77 | )
78 | Oats().bindIf({!Oats().has(ImagePipeline.self)},
79 | withMember : ImagePipeline.self,
80 | completion : {}
81 | )
82 | }
83 |
84 | @available(OSX 10.10,iOS 8.0, tvOS 1, *)
85 | public func create(atlasNamed : String, withImages : [String:AnyObject]) -> SKTextureAtlas
86 | {
87 | let dictionary : [String:AnyObject] = withImages
88 | let atlas = SKTextureAtlas(dictionary : dictionary)
89 | self.atlases[atlasNamed] = atlas
90 | return atlas
91 | }
92 | }
--------------------------------------------------------------------------------
/Pod/Classes/Assets/ImagePipeline.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import AlamofireImage
3 |
4 | #if os(OSX)
5 | import AppKit
6 | #endif
7 | #if os(iOS) || os(tvOS)
8 | import UIKit
9 | #endif
10 | #if os(watchOS)
11 | import WatchKit
12 | #endif
13 |
14 | public class ImagePipeline : Resolveable
15 | {
16 | public static var entityName : String? = "imagepipeline"
17 |
18 | public required init()
19 | {
20 |
21 | }
22 |
23 | #if os(OSX)
24 | //Step 1. Check if we can get the image from the cache
25 | public func get(key:String,completion:(response: NSImage?) -> Void)
26 | {
27 | if let networking : Networking = ~Oats()
28 | {
29 | networking.DOWNLOAD(key, completion: {
30 | handler in
31 |
32 | completion(response: handler.image)
33 | })
34 | }
35 | }
36 |
37 | #else
38 | public func get(key:String,completion:(response: UIImage?) -> Void)
39 | {
40 | if let networking : Networking = ~Oats()
41 | {
42 | networking.DOWNLOAD(key, completion: {
43 | handler in
44 |
45 | completion(response: handler.image)
46 | })
47 | }
48 | }
49 | #endif
50 |
51 | }
--------------------------------------------------------------------------------
/Pod/Classes/Cache/FileCache.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FileCache.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 9/14/15.
6 | //
7 | //
8 |
9 | import Foundation
10 | import Carlos
11 | import SwiftyJSON
12 |
13 | public class FileCache : NSObject,Cacheable{
14 |
15 | public static var entityName : String? = "FileCache"
16 |
17 |
18 | public required override init()
19 | {
20 | super.init()
21 |
22 | }
23 |
24 | /**
25 | - parameter key: The Cache Key representing the file location
26 | - returns: the resolved cached object
27 | **/
28 | public func get(key: String,completion:(response: ResponseHandler) -> Void)
29 | {
30 | let cache = DiskCacheLevel()
31 | let request = cache.get(key)
32 | var handler = ResponseHandler()
33 |
34 | request.onSuccess { value in
35 | let json = JSON(data: value)
36 | handler.response = json
37 | handler.responseString = json.rawString()
38 | handler.success = true
39 | completion(response: handler)
40 | }
41 | request.onFailure { error in
42 | handler.success = false
43 | handler.error = error
44 | completion(response: handler)
45 | }
46 | }
47 |
48 | /**
49 | - parameter key: The Cache Key
50 | - parameter value : The object being cached
51 | **/
52 |
53 | public func set(key:String,value:T)
54 | {
55 | let json = value.toJSON()
56 | let fileCache = DiskCacheLevel(capacity: 999999)
57 | if let asString = json.rawString(), encoded = asString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
58 | {
59 | fileCache.set(encoded, forKey: key)
60 | }
61 | }
62 |
63 |
64 |
65 |
66 | }
--------------------------------------------------------------------------------
/Pod/Classes/Cache/MemoryCache.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Cache.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 8/21/15.
6 | //
7 | //
8 |
9 | import Foundation
10 | import Carlos
11 | import SwiftyJSON
12 |
13 | public class MemoryCache : NSObject,Cacheable{
14 |
15 | var log : FileLog?
16 |
17 | public static var entityName : String? = "MemoryCache"
18 |
19 | public var linkToDisk = true
20 |
21 | public required override init()
22 | {
23 | super.init()
24 | }
25 |
26 | /**
27 | - parameter key: The Cache Key
28 | - returns: the resolved cached object
29 | **/
30 | public func get(key: String,completion:(response: ResponseHandler) -> Void)
31 | {
32 |
33 | let cache = MemoryCacheLevel()
34 | let request = cache.get(key)
35 | var handler = ResponseHandler()
36 |
37 | request.onSuccess { value in
38 | let json = JSON(data :value)
39 | handler.response = json
40 | handler.responseString = json.rawString()
41 | handler.success = true
42 | completion(response: handler)
43 | }
44 | request.onFailure { error in
45 |
46 | if let fileCache : FileCache = ~Oats() where self.linkToDisk
47 | {
48 | fileCache.get(key, completion: completion)
49 | }
50 | else
51 | {
52 | handler.success = false
53 | handler.error = error
54 | completion(response: handler)
55 | }
56 | }
57 | }
58 |
59 | /**
60 | - parameter key: The Cache Key
61 | - parameter value : The object being cached
62 | **/
63 | public func set(key:String,value:T)
64 | {
65 | let json = value.toJSON()
66 | let memoryCache = MemoryCacheLevel()
67 | if let asString = json.rawString(), encoded = asString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
68 | {
69 | print("Setting \(asString)")
70 | memoryCache.set(encoded, forKey: key)
71 |
72 | if let fileCache : FileCache = ~Oats() where linkToDisk
73 | {
74 | fileCache.set(key, value: value)
75 | }
76 | }
77 | }
78 |
79 |
80 | }
--------------------------------------------------------------------------------
/Pod/Classes/Config/Setting.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 |
4 | public class Setting : Autoresolveable{
5 |
6 | public var name : String
7 | public var cached : Bool
8 | //Can even be a Dictionary
9 | public var value : Any
10 | /**
11 | namespace supports multiple plist files with name collisions
12 | **/
13 | public var namespace : String
14 |
15 | init(name:String, value : AnyObject, cached: Bool = false, namespace:String = ""){
16 | self.name = name
17 | self.cached = cached
18 | self.value = value
19 | self.namespace = namespace
20 | super.init()
21 | self.customEntityName = name
22 | }
23 |
24 | init(name:String, value : Any,cached : Bool = false, namespace : String = "")
25 | {
26 | self.name = name
27 | self.cached = cached
28 | self.value = value
29 | self.namespace = namespace
30 | super.init()
31 | self.customEntityName = name
32 | }
33 |
34 | public required init()
35 | {
36 | self.name = ""
37 | self.cached = false
38 | self.value = ""
39 | self.namespace = "global"
40 | super.init()
41 | self.customEntityName = name
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/Pod/Classes/Container/ContainerOperators.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContainerOperators.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 8/23/15.
6 | //
7 | //
8 | import SwiftyJSON
9 |
10 |
11 | public typealias completionHandler = (response: ResponseHandler) -> Void
12 | public typealias serializedCompletion = (response: SerializebleObject, success : Bool) -> Void
13 |
14 | prefix operator ~{}
15 | infix operator <~>{associativity left precedence 140}
16 |
17 | public prefix func ~(resolver: Oatmeal) -> T?
18 | {
19 | return resolver.get()
20 | }
21 |
22 | public prefix func ~(key: String) -> Resolveable?
23 | {
24 | return Oats().get(key)
25 | }
26 |
27 | public prefix func ~(json : JSON) -> T?
28 | {
29 | if let Serializer : Serializer = ~Container.App, model : T = Serializer.serialize(json)
30 | {
31 | return model
32 | }
33 | return nil
34 | }
35 |
36 | public prefix func ~(json : String) -> T? {
37 | if let Serializer : Serializer = ~Container.App, model : T = Serializer.serialize(json){
38 | return model
39 | }
40 | return nil
41 | }
42 |
43 | //infix operator ~>{ associativity left precedence 140 }
44 | public func ~>(inout member: T, container: Oatmeal){
45 | container.bind(member)
46 | }
47 |
48 | public func ~>(inout member: T, key: String)
49 | {
50 | Oats().bind(key, member: member.dynamicType)
51 | }
52 |
53 | public func ~>(inout provider: T, container: Oatmeal){
54 | container.register(provider)
55 | }
56 |
57 | public func ~>(inout providers: [T], container: Oatmeal){
58 | container.register(providers)
59 | }
60 |
61 |
62 | public func ~>(events: T?, eventName: String)
63 | {
64 | if let events : Events = ~Container.App{
65 | events.fire(eventName)
66 | }
67 | }
68 |
69 | public func ~>(inout left: T, json: String)->T?{
70 | //Models use the same function signature as Resolveables, which can cause confusion when attempting to toss them into the IoC. We fix this by using the protocol method
71 | if left.bindsToContainer()
72 | {
73 | left ~> "\(left.dynamicType)"
74 | }
75 | if let model : T = ~json{
76 | return model
77 | }
78 | return nil
79 | }
80 |
81 | public func ~>(inout left: T, json: JSON)->T?
82 | {
83 | //Models use the same function signature as Resolveables, which can cause confusion when attempting to toss them into the IoC. We fix this by using the protocol method
84 |
85 | if left.bindsToContainer()
86 | {
87 | left ~> "\(left.dynamicType)"
88 | }
89 | if let model : T = ~json{
90 | return model
91 | }
92 | return nil
93 | }
94 |
95 |
96 | /*
97 | Operator to create a strong reference to the container.
98 | This will bind an entity to the container without deinitializing.
99 | Should be used carefully.
100 | */
101 | public func <~>(singleton: T, container: Oatmeal){
102 | container.bindSingleton(singleton)
103 | }
104 |
105 |
106 | public func Oats()->Oatmeal
107 | {
108 | return Container.App
109 | }
110 |
--------------------------------------------------------------------------------
/Pod/Classes/Container/NullElement.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NullElement.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 8/23/15.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 |
12 | public struct NullElement{
13 |
14 | var description : String
15 | var error : String
16 |
17 | init(description:String, error:String)
18 | {
19 | self.description = description
20 | self.error = error
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Pod/Classes/Container/Provider.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public class Provider : ServiceProvider
4 | {
5 | public var provides : [Resolveable.Type] = [Resolveable.Type]()
6 |
7 |
8 | public init(){
9 |
10 | }
11 |
12 | public func append(newMember : Resolveable.Type)
13 | {
14 | self.provides.append(newMember)
15 | }
16 |
17 | public func register()
18 | {
19 | Oats().register(self)
20 | }
21 |
22 | public func registerCustomTypes() -> [Any.Type]
23 | {
24 | return [Any.Type]()
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/Pod/Classes/ContainerException.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MemberNotFound.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 8/23/15.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public enum ContainerException{
12 |
13 | case DoesntExist(key:String)
14 | case InvalidType(member:Any)
15 |
16 | var key : String {
17 | switch self{
18 | case .DoesntExist(let key):
19 | return key
20 | case .InvalidType(let member):
21 | return String(member)
22 | }
23 | }
24 |
25 |
26 | var err : String
27 | {
28 | switch self{
29 | case .DoesntExist(let key):
30 | return "Member of name \(key) does not exist in the container"
31 | case .InvalidType(let member):
32 | let name = String(member)
33 | return "Member of type \(name) does not exist in the container"
34 | }
35 | }
36 |
37 |
38 | }
--------------------------------------------------------------------------------
/Pod/Classes/Contracts/Autoresolves.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Autoresolves.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 12/15/15.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public protocol Autoresolves : Resolveable
12 | {
13 | /**
14 | - parameter value: The Value being set on the Model
15 | - parameter key : The name of the variable on the model being set
16 | **/
17 |
18 | func setValue(value: AnyObject!, forUndefinedKey key: String)
19 |
20 |
21 | /**
22 |
23 | **/
24 | var customEntityName : String {get set }
25 | }
26 |
--------------------------------------------------------------------------------
/Pod/Classes/Contracts/Cacheable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Cacheable.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 9/14/15.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public protocol Cacheable : Resolveable{
12 |
13 | func get(key: String,completion:(response: ResponseHandler) -> Void)
14 | func set(key:String,value:T)
15 | }
--------------------------------------------------------------------------------
/Pod/Classes/Contracts/DidSerialize .swift:
--------------------------------------------------------------------------------
1 | //
2 | // DidSerialize .swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 3/31/16.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 |
12 | public protocol Serializes
13 | {
14 | func didSerialize()
15 | }
--------------------------------------------------------------------------------
/Pod/Classes/Contracts/Eventable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Events.swift
3 | // Pods
4 | //
5 | // Created by Michael Kantor on 9/14/15.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | protocol Eventable : Resolveable
12 | {
13 | func fire(event : String, payload : [String : AnyObject]?) -> (Bool,Event?)
14 | func listenFor(event : String, global : Bool, handler : (event : Event) -> Void)
15 | func listenFor(event:String,namespace:String,handler : (event : Event) -> Void)
16 | func flush()
17 | func dispose(event : String)
18 | func get(key:String) -> Event?
19 | func has(key:String)->Bool
20 | }
--------------------------------------------------------------------------------
/Pod/Classes/Contracts/Loggable.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 |
4 | public protocol Loggable : ProactiveResolveable
5 | {
6 | func success(message:String)
7 | func success