├── Source
├── ios
│ ├── Carthage
│ │ └── Checkouts
│ │ │ ├── SwiftyJSON
│ │ │ ├── Carthage
│ │ │ │ └── Build
│ │ │ ├── .travis.yml
│ │ │ ├── Example
│ │ │ │ ├── Images.xcassets
│ │ │ │ │ ├── LaunchImage.launchimage
│ │ │ │ │ │ ├── Default@2x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ │ └── Contents.json
│ │ │ │ ├── Info.plist
│ │ │ │ ├── AppDelegate.swift
│ │ │ │ ├── Base.lproj
│ │ │ │ │ ├── LaunchScreen.xib
│ │ │ │ │ └── Main.storyboard
│ │ │ │ └── ViewController.swift
│ │ │ ├── SwiftyJSON.xcodeproj
│ │ │ │ ├── project.xcworkspace
│ │ │ │ │ └── contents.xcworkspacedata
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── xcschemes
│ │ │ │ │ ├── SwiftyJSON OSX.xcscheme
│ │ │ │ │ └── SwiftyJSON iOS.xcscheme
│ │ │ ├── SwiftyJSON.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ ├── .gitignore
│ │ │ ├── SwiftyJSON.podspec
│ │ │ ├── Tests
│ │ │ │ ├── Info-OSX.plist
│ │ │ │ ├── Info-iOS.plist
│ │ │ │ ├── ArrayTests.swift
│ │ │ │ ├── StringTests.swift
│ │ │ │ ├── RawTests.swift
│ │ │ │ ├── DictionaryTests.swift
│ │ │ │ ├── LiteralConvertibleTests.swift
│ │ │ │ ├── PerformanceTests.swift
│ │ │ │ ├── PrintableTests.swift
│ │ │ │ └── RawRepresentableTests.swift
│ │ │ ├── Source
│ │ │ │ ├── Info-OSX.plist
│ │ │ │ ├── Info-iOS.plist
│ │ │ │ └── SwiftyJSON.h
│ │ │ └── LICENSE
│ │ │ └── Alamofire
│ │ │ ├── Example
│ │ │ ├── Images.xcassets
│ │ │ │ ├── Logo.imageset
│ │ │ │ │ ├── Logo.png
│ │ │ │ │ ├── Logo@2x.png
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── AppIcon.appiconset
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchImage.launchimage
│ │ │ │ │ └── Contents.json
│ │ │ ├── Info.plist
│ │ │ ├── HTTPBin.swift
│ │ │ ├── AppDelegate.swift
│ │ │ ├── MasterViewController.swift
│ │ │ └── DetailViewController.swift
│ │ │ ├── Alamofire.xcodeproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ ├── Alamofire OSX.xcscheme
│ │ │ │ └── Alamofire iOS.xcscheme
│ │ │ ├── iOS Example.xcodeproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── iOS Example.xcscheme
│ │ │ ├── Alamofire.playground
│ │ │ ├── contents.xcplayground
│ │ │ └── section-1.swift
│ │ │ ├── .gitignore
│ │ │ ├── Alamofire.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ │ ├── Alamofire.podspec
│ │ │ ├── Tests
│ │ │ ├── Info.plist
│ │ │ ├── BaseTestCase.swift
│ │ │ ├── TLSEvaluationTests.swift
│ │ │ ├── ManagerTests.swift
│ │ │ ├── UploadTests.swift
│ │ │ └── AuthenticationTests.swift
│ │ │ ├── Source
│ │ │ ├── Info.plist
│ │ │ ├── Alamofire.h
│ │ │ ├── Validation.swift
│ │ │ ├── ResponseSerialization.swift
│ │ │ └── Upload.swift
│ │ │ ├── LICENSE
│ │ │ ├── .travis.yml
│ │ │ └── CONTRIBUTING.md
│ ├── .DS_Store
│ ├── srvup
│ │ ├── .DS_Store
│ │ ├── Images.xcassets
│ │ │ ├── pattern.imageset
│ │ │ │ ├── pattern.png
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── appicon_180.png
│ │ │ │ ├── appicon_58-1.png
│ │ │ │ ├── appicon_58.png
│ │ │ │ ├── appicon_80-1.png
│ │ │ │ ├── appicon_80.png
│ │ │ │ ├── appicon_87-1.png
│ │ │ │ ├── appicon_87.png
│ │ │ │ ├── appicon_120-1.png
│ │ │ │ ├── appicon_120-3.png
│ │ │ │ └── Contents.json
│ │ ├── ProjectTableCell.swift
│ │ ├── ViewController.swift
│ │ ├── Info.plist
│ │ ├── UINavButton.swift
│ │ ├── User.swift
│ │ ├── Notification.swift
│ │ ├── AppDelegate.swift
│ │ ├── ProjectViewController.swift
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.xib
│ │ ├── UICommentForm.swift
│ │ ├── ProjectTableViewController.swift
│ │ └── Project.swift
│ ├── Cartfile
│ ├── Cartfile.resolved
│ ├── srvup.xcodeproj
│ │ ├── xcuserdata
│ │ │ └── jmitch.xcuserdatad
│ │ │ │ ├── xcdebugger
│ │ │ │ └── Breakpoints_v2.xcbkptlist
│ │ │ │ └── xcschemes
│ │ │ │ ├── xcschememanagement.plist
│ │ │ │ └── srvup.xcscheme
│ │ └── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcuserdata
│ │ │ └── jmitch.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── xcshareddata
│ │ │ └── srvup.xccheckout
│ └── srvupTests
│ │ ├── Info.plist
│ │ └── srvupTests.swift
└── .DS_Store
├── .DS_Store
├── Guides
├── .DS_Store
└── Getting_Started.md
├── .gitmodules
├── .gitignore
├── Topics.md
└── README.md
/Source/ios/Carthage/Checkouts/SwiftyJSON/Carthage/Build:
--------------------------------------------------------------------------------
1 | ../../../../Carthage/Build
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/.DS_Store
--------------------------------------------------------------------------------
/Guides/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Guides/.DS_Store
--------------------------------------------------------------------------------
/Source/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/.DS_Store
--------------------------------------------------------------------------------
/Source/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/.DS_Store
--------------------------------------------------------------------------------
/Source/ios/srvup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/.DS_Store
--------------------------------------------------------------------------------
/Source/ios/Cartfile:
--------------------------------------------------------------------------------
1 | github "Alamofire/Alamofire" >= 1.2
2 | github "SwiftyJSON/SwiftyJSON" >= 2.2
3 | github "kishikawakatsumi/KeychainAccess" >= 1.2.1
4 |
--------------------------------------------------------------------------------
/Source/ios/Cartfile.resolved:
--------------------------------------------------------------------------------
1 | github "Alamofire/Alamofire" "1.2.3"
2 | github "kishikawakatsumi/KeychainAccess" "v1.2.1"
3 | github "SwiftyJSON/SwiftyJSON" "2.2.0"
4 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Source/srvup-rest-framework"]
2 | path = Source/srvup-rest-framework
3 | url = https://github.com/codingforentrepreneurs/srvup-rest-framework
4 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/pattern.imageset/pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/pattern.imageset/pattern.png
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/xcuserdata/jmitch.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_180.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_58-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_58-1.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_58.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_80-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_80-1.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_80.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_87-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_87-1.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_87.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_120-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_120-1.png
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_120-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/appicon_120-3.png
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | script: "xcodebuild test -workspace SwiftyJSON.xcworkspace -scheme \"SwiftyJSON iOS\" -destination \"platform=iOS Simulator,name=iPhone 5\""
3 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/Logo.imageset/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/Logo.imageset/Logo.png
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/Logo.imageset/Logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/Logo.imageset/Logo@2x.png
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Images.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Images.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/project.xcworkspace/xcuserdata/jmitch.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingforentrepreneurs/Django-to-iOS/HEAD/Source/ios/srvup.xcodeproj/project.xcworkspace/xcuserdata/jmitch.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | .DS_Store
3 | */build/*
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 | *.hmap
18 | *.xccheckout
19 |
20 | #CocoaPods
21 | Pods
22 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac 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 | *.moved-aside
17 | DerivedData
18 | *.hmap
19 | *.ipa
20 | *.xcuserstate
21 |
22 | # Carthage
23 | Carthage/Build
24 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/Logo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Logo.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x",
11 | "filename" : "Logo@2x.png"
12 | }
13 | ],
14 | "info" : {
15 | "version" : 1,
16 | "author" : "xcode"
17 | }
18 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/pattern.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "pattern.png"
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 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.playground/section-1.swift:
--------------------------------------------------------------------------------
1 | import XCPlayground
2 | import Foundation
3 | import Alamofire
4 |
5 | // Allow network requests to complete
6 | XCPSetExecutionShouldContinueIndefinitely()
7 |
8 | Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"])
9 | .responseString { (request, response, string, error) in
10 | println(request)
11 | println(response)
12 | println(string)
13 | }
14 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Alamofire'
3 | s.version = '1.2.3'
4 | s.license = 'MIT'
5 | s.summary = 'Elegant HTTP Networking in Swift'
6 | s.homepage = 'https://github.com/Alamofire/Alamofire'
7 | s.social_media_url = 'http://twitter.com/mattt'
8 | s.authors = { 'Mattt Thompson' => 'm@mattt.me' }
9 | s.source = { :git => 'https://github.com/Alamofire/Alamofire.git', :tag => s.version }
10 |
11 | s.ios.deployment_target = '8.0'
12 | s.osx.deployment_target = '10.9'
13 |
14 | s.source_files = 'Source/*.swift'
15 |
16 | s.requires_arc = true
17 | end
18 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "SwiftyJSON"
3 | s.version = "2.2.0"
4 | s.summary = "SwiftyJSON makes it easy to deal with JSON data in Swift"
5 | s.homepage = "https://github.com/SwiftyJSON/SwiftyJSON"
6 | s.license = { :type => "MIT" }
7 | s.authors = { "lingoer" => "lingoerer@gmail.com", "tangplin" => "tangplin@gmail.com" }
8 |
9 | s.requires_arc = true
10 | s.osx.deployment_target = "10.9"
11 | s.ios.deployment_target = "8.0"
12 | s.source = { :git => "https://github.com/SwiftyJSON/SwiftyJSON.git", :tag => "2.2.0"}
13 | s.source_files = "Source/*.swift"
14 | end
15 |
--------------------------------------------------------------------------------
/Source/ios/srvup/ProjectTableCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProjectTableCell.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/16/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProjectTableCell: UITableViewCell {
12 |
13 | @IBOutlet weak var projectImage: UIImageView!
14 | @IBOutlet weak var projectLabel: UILabel!
15 | override func awakeFromNib() {
16 | super.awakeFromNib()
17 | // Initialization code
18 | }
19 |
20 | override func setSelected(selected: Bool, animated: Bool) {
21 | super.setSelected(selected, animated: animated)
22 |
23 | // Configure the view for the selected state
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/xcuserdata/jmitch.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | srvup.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 0F0E01FA1B2DF3B500D35686
16 |
17 | primary
18 |
19 |
20 | 0F0E020F1B2DF3B500D35686
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Source/ios/srvupTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.codingforentrepreneurs.$(PRODUCT_NAME:rfc1034identifier)
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 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.alamofire.$(PRODUCT_NAME:rfc1034identifier)
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 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/Info-OSX.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.swiftyjson.$(PRODUCT_NAME:rfc1034identifier)
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 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/Info-iOS.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.swiftyjson.${PRODUCT_NAME:rfc1034identifier}
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 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Source/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.alamofire.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.2.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | Notes/
9 | Videos/
10 | # Distribution / packaging
11 | .Python
12 | env/
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *,cover
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 |
55 | # Sphinx documentation
56 | docs/_build/
57 |
58 | # PyBuilder
59 | target/
60 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Source/Info-OSX.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.swiftyjson.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Source/Info-iOS.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.swiftyjson.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Source/ios/srvupTests/srvupTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // srvupTests.swift
3 | // srvupTests
4 | //
5 | // Created by Justin Mitchel on 6/14/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import XCTest
11 |
12 | class srvupTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | XCTAssert(true, "Pass")
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock() {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/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" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "ipad",
20 | "size" : "29x29",
21 | "scale" : "1x"
22 | },
23 | {
24 | "idiom" : "ipad",
25 | "size" : "29x29",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "ipad",
30 | "size" : "40x40",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "40x40",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "76x76",
41 | "scale" : "1x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "76x76",
46 | "scale" : "2x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/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 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014–2015 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 |
--------------------------------------------------------------------------------
/Source/ios/srvup/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/15/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 |
16 | self.someFunc("Justin", age: nil, completionHandler: isComplete)
17 | self.newFunc(newCompletionH)
18 | // Do any additional setup after loading the view.
19 | }
20 |
21 | override func didReceiveMemoryWarning() {
22 | super.didReceiveMemoryWarning()
23 | // Dispose of any resources that can be recreated.
24 | }
25 |
26 | func someFunc(name:String, age:Int?, completionHandler:(isDone:Bool)-> Void) -> String {
27 | println("hello there \(name)")
28 |
29 | completionHandler(isDone: true)
30 | return "hello there \(name)"
31 | }
32 |
33 | func isComplete(done:Bool) -> Void {
34 | println(done)
35 | }
36 |
37 | func newFunc(completionHandler:()->Void) {
38 | completionHandler()
39 | }
40 |
41 | func newCompletionH() -> Void {
42 | println("new one has ran")
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | },
18 | {
19 | "orientation" : "portrait",
20 | "idiom" : "ipad",
21 | "extent" : "full-screen",
22 | "minimum-system-version" : "7.0",
23 | "scale" : "1x"
24 | },
25 | {
26 | "orientation" : "landscape",
27 | "idiom" : "ipad",
28 | "extent" : "full-screen",
29 | "minimum-system-version" : "7.0",
30 | "scale" : "1x"
31 | },
32 | {
33 | "orientation" : "portrait",
34 | "idiom" : "ipad",
35 | "extent" : "full-screen",
36 | "minimum-system-version" : "7.0",
37 | "scale" : "2x"
38 | },
39 | {
40 | "orientation" : "landscape",
41 | "idiom" : "ipad",
42 | "extent" : "full-screen",
43 | "minimum-system-version" : "7.0",
44 | "scale" : "2x"
45 | }
46 | ],
47 | "info" : {
48 | "version" : 1,
49 | "author" : "xcode"
50 | }
51 | }
--------------------------------------------------------------------------------
/Source/ios/srvup/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.codingforentrepreneurs.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "extent" : "full-screen",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "filename" : "Default@2x.png",
15 | "minimum-system-version" : "7.0",
16 | "orientation" : "portrait",
17 | "scale" : "2x"
18 | },
19 | {
20 | "orientation" : "portrait",
21 | "idiom" : "ipad",
22 | "extent" : "full-screen",
23 | "minimum-system-version" : "7.0",
24 | "scale" : "1x"
25 | },
26 | {
27 | "orientation" : "landscape",
28 | "idiom" : "ipad",
29 | "extent" : "full-screen",
30 | "minimum-system-version" : "7.0",
31 | "scale" : "1x"
32 | },
33 | {
34 | "orientation" : "portrait",
35 | "idiom" : "ipad",
36 | "extent" : "full-screen",
37 | "minimum-system-version" : "7.0",
38 | "scale" : "2x"
39 | },
40 | {
41 | "orientation" : "landscape",
42 | "idiom" : "ipad",
43 | "extent" : "full-screen",
44 | "minimum-system-version" : "7.0",
45 | "scale" : "2x"
46 | }
47 | ],
48 | "info" : {
49 | "version" : 1,
50 | "author" : "xcode"
51 | }
52 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Source/Alamofire.h:
--------------------------------------------------------------------------------
1 | // Alamofire.h
2 | //
3 | // Copyright (c) 2014–2015 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
24 |
25 | FOUNDATION_EXPORT double AlamofireVersionNumber;
26 | FOUNDATION_EXPORT const unsigned char AlamofireVersionString[];
27 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/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 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/BaseTestCase.swift:
--------------------------------------------------------------------------------
1 | // DownloadTests.swift
2 | //
3 | // Copyright (c) 2014–2015 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 Alamofire
24 | import Foundation
25 | import XCTest
26 |
27 | class BaseTestCase: XCTestCase {
28 | let defaultTimeout: NSTimeInterval = 10
29 | }
30 |
--------------------------------------------------------------------------------
/Source/ios/srvup/UINavButton.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UINavButton.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/18/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 |
13 | public class UINavButton: UIButton {
14 | init(title:String, direction:UIButtonDirection, parentView:UIView?) {
15 | let diameter = CGFloat(50)
16 | let radius = diameter/2.0
17 | let xOffset = CGFloat(5)
18 | let yOffset = CGFloat(20)
19 | var newFrame = CGRectMake(xOffset, yOffset, diameter, diameter)
20 | switch direction{
21 | case .Right:
22 | if parentView != nil {
23 | newFrame = CGRectMake(parentView!.frame.width - diameter - xOffset, yOffset, diameter, diameter)
24 | }
25 | default:
26 | newFrame = CGRectMake(xOffset, yOffset, diameter, diameter)
27 | }
28 |
29 | super.init(frame: newFrame)
30 |
31 | self.setTitle(title, forState: UIControlState.Normal)
32 | self.backgroundColor = UIColor(red: 0/255.0, green: 88/255.0, blue: 128/255.0, alpha: 0.75)
33 | self.layer.cornerRadius = radius
34 | self.layer.masksToBounds = true
35 | }
36 |
37 | required public init(coder aDecoder: NSCoder) {
38 | fatalError("init(coder:) has not been implemented")
39 | }
40 |
41 | }
42 |
43 | public enum UIButtonDirection {
44 | case Left, Right
45 | }
--------------------------------------------------------------------------------
/Topics.md:
--------------------------------------------------------------------------------
1 | #Django to iOS || Project Topics
2 | An overview of what we will be covering in this course.
3 |
4 |
5 | 1. Create an iOS App using Swift and Django:
6 | - Swift version 1.2 for iOS 8
7 | - Django version 1.8 with Python 2.7 (or 3.4)
8 | - Django to iOS [Getting Started Guide](https://github.com/codingforentrepreneurs/Django-to-iOS/blob/master/Guides/Getting_Started.md)
9 |
10 | 2. Use a Django-based RESTful API :
11 | - Srvup Rest Framework ([code](https://github.com/codingforentrepreneurs/srvup-rest-framework)): A [tutorial](https://joincfe.com/projects/django-rest-framework/) on the Django Rest Framework.
12 |
13 | 3. Integrating the following Swift Frameworks/Packages:
14 | - [Alamofire](https://github.com/Alamofire/Alamofire): "Elegant HTTP Networking in Swift"
15 | - [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON): "The better way to deal with JSON data in Swift" (Also avialable: [Alamofire-SwiftyJSON](https://github.com/SwiftyJSON/Alamofire-SwiftyJSON))
16 | - [KeychainAccess](https://github.com/kishikawakatsumi/KeychainAccess): "Simple Swift wrapper for Keychain that works on iOS and OS X"
17 |
18 | 4. Recommended Completion:
19 | - Try Django 1.8 ([tutorial](https://www.youtube.com/playlist?list=PLEsfXFp6DpzRcd-q4vR5qAgOZUuz8041S))
20 | - Srvup Membership ([tutorial](https://joincfe.com/projects/srvup-membership/))
21 | - Django Rest Framework ([tutorial](https://joincfe.com/projects/django-rest-framework/))
22 | - 30 Days of Swift ([tutorial](https://joincfe.com/projects/30-days-swift))
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.h:
--------------------------------------------------------------------------------
1 | // SwiftyJSON.h
2 | //
3 | // Copyright (c) 2014 Ruoyu Fu, Pinglin Tang
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 | //! Project version number for SwiftyJSON.
26 | FOUNDATION_EXPORT double SwiftyJSONVersionNumber;
27 |
28 | //! Project version string for SwiftyJSON.
29 | FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[];
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.swiftyjson.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/project.xcworkspace/xcshareddata/srvup.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 12017FB0-D28E-4841-A273-181E26662885
9 | IDESourceControlProjectName
10 | srvup
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 76AA870655452D480FC21CD8404DB387B1626C6C
14 | https://github.com/codingforentrepreneurs/Django-to-iOS.git
15 |
16 | IDESourceControlProjectPath
17 | Source/ios/srvup.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 76AA870655452D480FC21CD8404DB387B1626C6C
21 | ../../../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/codingforentrepreneurs/Django-to-iOS.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 76AA870655452D480FC21CD8404DB387B1626C6C
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 76AA870655452D480FC21CD8404DB387B1626C6C
36 | IDESourceControlWCCName
37 | Django-to-iOS
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: beta-xcode6.3
3 | env:
4 | global:
5 | - LC_CTYPE=en_US.UTF-8
6 | - LANG=en_US.UTF-8
7 | matrix:
8 | - DESTINATION="OS=8.1,name=iPhone 5S" SCHEME="Alamofire iOS" SDK=iphonesimulator8.3 BUILD_EXAMPLE="YES" POD_LINT="NO"
9 | - DESTINATION="OS=8.2,name=iPhone 6" SCHEME="Alamofire iOS" SDK=iphonesimulator8.3 BUILD_EXAMPLE="YES" POD_LINT="NO"
10 | - DESTINATION="OS=8.3,name=iPhone 6 Plus" SCHEME="Alamofire iOS" SDK=iphonesimulator8.3 BUILD_EXAMPLE="YES" POD_LINT="NO"
11 | - DESTINATION="arch=x86_64" SCHEME="Alamofire OSX" SDK=macosx10.10 BUILD_EXAMPLE="NO" POD_LINT="YES"
12 | before_install:
13 | - gem install cocoapods --no-rdoc --no-ri --no-document --quiet
14 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet
15 | script:
16 | - set -o pipefail
17 | - xcodebuild -project Alamofire.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
18 | -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c
19 | - xcodebuild -project Alamofire.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
20 | -configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c
21 | - if [ $BUILD_EXAMPLE == "YES" ]; then
22 | xcodebuild -project "iOS Example.xcodeproj" -scheme "iOS Example" -sdk "$SDK" -destination "$DESTINATION"
23 | -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
24 | fi
25 | - if [ $BUILD_EXAMPLE == "YES" ]; then
26 | xcodebuild -project "iOS Example.xcodeproj" -scheme "iOS Example" -sdk "$SDK" -destination "$DESTINATION"
27 | -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
28 | fi
29 | - if [ $POD_LINT == "YES" ]; then
30 | pod lib lint --quick;
31 | fi
32 |
--------------------------------------------------------------------------------
/Source/ios/srvup/User.swift:
--------------------------------------------------------------------------------
1 | //
2 | // User.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/18/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Alamofire
11 | import KeychainAccess
12 |
13 | class User: NSObject {
14 | let projectsURL = "http://127.0.0.1:8000/api2/projects/?format=json"
15 | let keychain = Keychain(service: "com.codingforentrepreneurs.srvup")
16 |
17 | func checkToken() {
18 | let token = self.keychain["token"]
19 | if token != nil {
20 | let url = NSURL(string: self.projectsURL)
21 | var mutableURLRequest = NSMutableURLRequest(URL:url!)
22 | mutableURLRequest.setValue("JWT \(token!)", forHTTPHeaderField: "Authorization")
23 | mutableURLRequest.HTTPMethod = "GET"
24 | var manager = Alamofire.Manager.sharedInstance
25 |
26 | var getProjectsRequest = manager.request(mutableURLRequest)
27 |
28 | getProjectsRequest.response({ (request, response, data, error) -> Void in
29 | let statusCode = response?.statusCode
30 | if statusCode != 200 {
31 | self.logoutUser()
32 | }
33 | })
34 |
35 | } else {
36 | println("No token")
37 | }
38 |
39 |
40 | }
41 |
42 | func logoutUser() {
43 | self.keychain["token"] = nil
44 | let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
45 | let navController = appDelegate.window!.rootViewController as! UINavigationController
46 |
47 | navController.popToRootViewControllerAnimated(true)
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.alamofire.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | Alamofire
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UIStatusBarTintParameters
32 |
33 | UINavigationBar
34 |
35 | Style
36 | UIBarStyleDefault
37 | Translucent
38 |
39 |
40 |
41 | UISupportedInterfaceOrientations
42 |
43 | UIInterfaceOrientationPortrait
44 | UIInterfaceOrientationLandscapeLeft
45 | UIInterfaceOrientationLandscapeRight
46 |
47 | UISupportedInterfaceOrientations~ipad
48 |
49 | UIInterfaceOrientationPortrait
50 | UIInterfaceOrientationPortraitUpsideDown
51 | UIInterfaceOrientationLandscapeLeft
52 | UIInterfaceOrientationLandscapeRight
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/HTTPBin.swift:
--------------------------------------------------------------------------------
1 | // MasterViewController.swift
2 | //
3 | // Copyright (c) 2014–2015 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 | import Alamofire
25 |
26 | enum HTTPBinRoute: URLStringConvertible {
27 | case Method(Alamofire.Method)
28 | case BasicAuth(String, String)
29 |
30 | var URLString: String {
31 | let baseURLString = "http://httpbin.org/"
32 | let path: String = {
33 | switch self {
34 | case .Method(let method):
35 | return "/\(method.rawValue.lowercaseString)"
36 | case .BasicAuth(let user, let password):
37 | return "/basic-auth/\(user)/\(password)"
38 | }
39 | }()
40 |
41 | return NSURL(string: path, relativeToURL: NSURL(string: baseURLString))!.absoluteString!
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/ArrayTests.swift:
--------------------------------------------------------------------------------
1 | // ArrayTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class ArrayTests: XCTestCase {
27 |
28 | func testSingleDimensionalArraysGetter() {
29 | let array = ["1","2", "a", "B", "D"]
30 | let json = JSON(array)
31 | XCTAssertEqual((json.array![0] as JSON).string!, "1")
32 | XCTAssertEqual((json.array![1] as JSON).string!, "2")
33 | XCTAssertEqual((json.array![2] as JSON).string!, "a")
34 | XCTAssertEqual((json.array![3] as JSON).string!, "B")
35 | XCTAssertEqual((json.array![4] as JSON).string!, "D")
36 | }
37 |
38 | func testSingleDimensionalArraysSetter() {
39 | let array = ["1","2", "a", "B", "D"]
40 | var json = JSON(array)
41 | json.arrayObject = ["111", "222"]
42 | XCTAssertEqual((json.array![0] as JSON).string!, "111")
43 | XCTAssertEqual((json.array![1] as JSON).string!, "222")
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | // SwiftyJSON.h
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 UIKit
24 | import SwiftyJSON
25 |
26 | @UIApplicationMain
27 | class AppDelegate: UIResponder, UIApplicationDelegate {
28 |
29 | var window: UIWindow?
30 |
31 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
32 |
33 | let navigationController = self.window?.rootViewController as! UINavigationController
34 | let viewController = navigationController.topViewController as! ViewController
35 |
36 | if let file = NSBundle(forClass:AppDelegate.self).pathForResource("SwiftyJSONTests", ofType: "json") {
37 | let data = NSData(contentsOfFile: file)!
38 | let json = JSON(data:data)
39 | viewController.json = json
40 | } else {
41 | viewController.json = JSON.nullJSON
42 | }
43 |
44 | return true
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/TLSEvaluationTests.swift:
--------------------------------------------------------------------------------
1 | // DownloadTests.swift
2 | //
3 | // Copyright (c) 2014–2015 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 Alamofire
24 | import Foundation
25 | import XCTest
26 |
27 | class TLSEvaluationTestCase: BaseTestCase {
28 | func testThatExpiredSSLCertificateFailsEvaluation() {
29 | // Given
30 | let URL = "https://testssl-expire.disig.sk/"
31 | let expectation = expectationWithDescription("\(URL)")
32 |
33 | var error: NSError?
34 |
35 | // When
36 | Alamofire.request(.GET, URL)
37 | .response { _, _, _, responseError in
38 | error = responseError
39 | expectation.fulfill()
40 | }
41 |
42 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
43 |
44 | // Then
45 | XCTAssertNotNil(error, "error should not be nil")
46 | XCTAssertEqual(error?.code ?? -1, NSURLErrorServerCertificateUntrusted, "error should be NSURLErrorServerCertificateUntrusted")
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Notification.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Notification.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/23/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class Notification: NSObject {
12 |
13 | func notify(message:String, delay:Double, inSpeed:Double, outSpeed:Double) {
14 | let notification = UIView()
15 | let notificationText = UITextView()
16 | let application = UIApplication.sharedApplication()
17 | let window = application.keyWindow!
18 | self.fadeIn(notification, speed: inSpeed)
19 | notification.frame = CGRectMake(0, 0, window.frame.width, 50)
20 | notification.backgroundColor = .redColor()
21 | notification.addSubview(notificationText)
22 | notificationText.frame = CGRectMake(0, 0, notification.frame.width, 30)
23 | notificationText.frame.origin.y = (notification.frame.height - notificationText.frame.height)/2.0
24 | notificationText.text = message
25 | notificationText.textAlignment = .Center
26 | notificationText.font = UIFont.systemFontOfSize(18.0)
27 | notificationText.textColor = .whiteColor()
28 | notificationText.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.0)
29 |
30 | window.addSubview(notification)
31 |
32 | let seconds = delay
33 | let delayNanoSeconds = seconds * Double(NSEC_PER_SEC)
34 | let now = DISPATCH_TIME_NOW
35 | var theTimeToDispatch = dispatch_time(now, Int64(delayNanoSeconds))
36 |
37 | dispatch_after(theTimeToDispatch, dispatch_get_main_queue()) { () -> Void in
38 | self.fadeOut(notification, speed:outSpeed)
39 | // self.notification.removeFromSuperview()
40 | }
41 | }
42 |
43 | func fadeIn(theView:UIView, speed:Double) {
44 | theView.alpha = 0
45 | UIView.animateWithDuration(speed, animations: { () -> Void in
46 | theView.alpha = 1
47 | })
48 | }
49 |
50 | func fadeOut(theView:UIView, speed:Double) {
51 | UIView.animateWithDuration(speed, animations: { () -> Void in
52 | theView.alpha = 0
53 | })
54 |
55 | }
56 |
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/StringTests.swift:
--------------------------------------------------------------------------------
1 | // StringTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class StringTests: XCTestCase {
27 |
28 | func testString() {
29 | //getter
30 | var json = JSON("abcdefg hijklmn;opqrst.?+_()")
31 | XCTAssertEqual(json.string!, "abcdefg hijklmn;opqrst.?+_()")
32 | XCTAssertEqual(json.stringValue, "abcdefg hijklmn;opqrst.?+_()")
33 |
34 | json.string = "12345?67890.@#"
35 | XCTAssertEqual(json.string!, "12345?67890.@#")
36 | XCTAssertEqual(json.stringValue, "12345?67890.@#")
37 | }
38 |
39 | func testURL() {
40 | let json = JSON("http://github.com")
41 | XCTAssertEqual(json.URL!, NSURL(string:"http://github.com")!)
42 | }
43 |
44 | func testURLPercentEscapes() {
45 | let emDash = "\\u2014"
46 | let urlString = "http://examble.com/unencoded" + emDash + "string"
47 | let encodedURLString = urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
48 | let json = JSON(urlString)
49 | XCTAssertEqual(json.URL!, NSURL(string: encodedURLString!)!, "Wrong unpacked ")
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Source/ios/srvup/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/14/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import KeychainAccess
11 |
12 | @UIApplicationMain
13 | class AppDelegate: UIResponder, UIApplicationDelegate {
14 | // let keychain = Keychain(service: "com.codingforentrepreneurs.srvup")
15 | var window: UIWindow?
16 |
17 |
18 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
19 | // Override point for customization after application launch.
20 | // println(self.keychain["token"])
21 | return true
22 | }
23 |
24 | func applicationWillResignActive(application: UIApplication) {
25 | // 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.
26 | // 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.
27 | }
28 |
29 | func applicationDidEnterBackground(application: UIApplication) {
30 | // 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.
31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
32 | }
33 |
34 | func applicationWillEnterForeground(application: UIApplication) {
35 | // 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.
36 | }
37 |
38 | func applicationDidBecomeActive(application: UIApplication) {
39 | // 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.
40 | }
41 |
42 | func applicationWillTerminate(application: UIApplication) {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 |
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/Source/ios/srvup/ProjectViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProjectViewController.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/15/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProjectViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
12 | var projects = [Project]()
13 | let tableView = UITableView()
14 |
15 | override func viewDidLoad() {
16 | super.viewDidLoad()
17 | let titleText = UILabel(frame: CGRectMake(0, 0, self.view.frame.width, 100))
18 | titleText.text = "Projects - \(self.projects.count)"
19 | titleText.textAlignment = NSTextAlignment.Center
20 |
21 | self.view.addSubview(titleText)
22 |
23 | if self.projects.count > 0 {
24 | for i in projects {
25 | println(i.title)
26 | }
27 | }
28 |
29 | self.tableView.frame = CGRectMake(0, self.view.frame.height/4.0, self.view.frame.width, self.view.frame.height * 3/4.0)
30 | self.tableView.delegate = self
31 | self.tableView.dataSource = self
32 | self.view.addSubview(self.tableView)
33 |
34 | // Do any additional setup after loading the view.
35 | }
36 |
37 | func numberOfSectionsInTableView(tableView: UITableView) -> Int {
38 | return 1
39 | }
40 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
41 | let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
42 |
43 | cell.textLabel?.text = "\(indexPath.row + 1) - \(self.projects[indexPath.row].title)"
44 | return cell
45 | }
46 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
47 | return self.projects.count
48 | }
49 |
50 | // numberOfRowsInSection
51 |
52 |
53 | override func didReceiveMemoryWarning() {
54 | super.didReceiveMemoryWarning()
55 | // Dispose of any resources that can be recreated.
56 | }
57 |
58 |
59 | /*
60 | // MARK: - Navigation
61 |
62 | // In a storyboard-based application, you will often want to do a little preparation before navigation
63 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
64 | // Get the new view controller using segue.destinationViewController.
65 | // Pass the selected object to the new view controller.
66 | }
67 | */
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | // AppDelegate.swift
2 | //
3 | // Copyright (c) 2014–2015 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 UIKit
24 |
25 | @UIApplicationMain
26 | class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
27 |
28 | var window: UIWindow?
29 |
30 | // MARK: - UIApplicationDelegate
31 |
32 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
33 | let splitViewController = self.window!.rootViewController as! UISplitViewController
34 | let navigationController = splitViewController.viewControllers.last as! UINavigationController
35 | navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
36 | splitViewController.delegate = self
37 |
38 | return true
39 | }
40 |
41 | // MARK: - UISplitViewControllerDelegate
42 |
43 | func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController!, ontoPrimaryViewController primaryViewController: UIViewController!) -> Bool {
44 | if let secondaryAsNavController = secondaryViewController as? UINavigationController {
45 | if let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController {
46 | return topAsDetailController.request == nil
47 | }
48 | }
49 |
50 | return false
51 | }
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/Source/ios/srvup/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "appicon_58-1.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "appicon_87-1.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "40x40",
17 | "idiom" : "iphone",
18 | "filename" : "appicon_80-1.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "appicon_120-3.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "60x60",
29 | "idiom" : "iphone",
30 | "filename" : "appicon_120-1.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "appicon_180.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "idiom" : "ipad",
41 | "size" : "40x40",
42 | "scale" : "1x"
43 | },
44 | {
45 | "size" : "40x40",
46 | "idiom" : "ipad",
47 | "filename" : "appicon_80.png",
48 | "scale" : "2x"
49 | },
50 | {
51 | "size" : "24x24",
52 | "idiom" : "watch",
53 | "scale" : "2x",
54 | "role" : "notificationCenter",
55 | "subtype" : "38mm"
56 | },
57 | {
58 | "size" : "27.5x27.5",
59 | "idiom" : "watch",
60 | "scale" : "2x",
61 | "role" : "notificationCenter",
62 | "subtype" : "42mm"
63 | },
64 | {
65 | "size" : "29x29",
66 | "idiom" : "watch",
67 | "filename" : "appicon_58.png",
68 | "role" : "companionSettings",
69 | "scale" : "2x"
70 | },
71 | {
72 | "size" : "29x29",
73 | "idiom" : "watch",
74 | "filename" : "appicon_87.png",
75 | "role" : "companionSettings",
76 | "scale" : "3x"
77 | },
78 | {
79 | "size" : "40x40",
80 | "idiom" : "watch",
81 | "scale" : "2x",
82 | "role" : "appLauncher",
83 | "subtype" : "38mm"
84 | },
85 | {
86 | "size" : "44x44",
87 | "idiom" : "watch",
88 | "scale" : "2x",
89 | "role" : "longLook",
90 | "subtype" : "42mm"
91 | },
92 | {
93 | "size" : "86x86",
94 | "idiom" : "watch",
95 | "scale" : "2x",
96 | "role" : "quickLook",
97 | "subtype" : "38mm"
98 | },
99 | {
100 | "size" : "98x98",
101 | "idiom" : "watch",
102 | "scale" : "2x",
103 | "role" : "quickLook",
104 | "subtype" : "42mm"
105 | }
106 | ],
107 | "info" : {
108 | "version" : 1,
109 | "author" : "xcode"
110 | }
111 | }
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/RawTests.swift:
--------------------------------------------------------------------------------
1 | // RawTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class RawTests: XCTestCase {
27 |
28 | func testArray() {
29 | let json:JSON = [1, "2", 3.12, NSNull(), true, ["name": "Jack"]]
30 | let data = json.rawData()
31 | let string = json.rawString()
32 | XCTAssertTrue (data != nil)
33 | XCTAssertTrue (string!.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > 0)
34 | println(string!)
35 | }
36 |
37 | func testDictionary() {
38 | let json:JSON = ["number":111111.23456789, "name":"Jack", "list":[1,2,3,4], "bool":false, "null":NSNull()]
39 | let data = json.rawData()
40 | let string = json.rawString()
41 | XCTAssertTrue (data != nil)
42 | XCTAssertTrue (string!.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > 0)
43 | println(string!)
44 | }
45 |
46 | func testString() {
47 | let json:JSON = "I'm a json"
48 | println(json.rawString())
49 | XCTAssertTrue(json.rawString() == "I'm a json")
50 | }
51 |
52 | func testNumber() {
53 | let json:JSON = 123456789.123
54 | println(json.rawString())
55 | XCTAssertTrue(json.rawString() == "123456789.123")
56 | }
57 |
58 | func testBool() {
59 | let json:JSON = true
60 | println(json.rawString())
61 | XCTAssertTrue(json.rawString() == "true")
62 | }
63 |
64 | func testNull() {
65 | let json:JSON = nil
66 | println(json.rawString())
67 | XCTAssertTrue(json.rawString() == "null")
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/DictionaryTests.swift:
--------------------------------------------------------------------------------
1 | // DictionaryTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class DictionaryTests: XCTestCase {
27 |
28 | func testGetter() {
29 | let dictionary = ["number":9823.212, "name":"NAME", "list":[1234, 4.212], "object":["sub_number":877.2323, "sub_name":"sub_name"], "bool":true]
30 | let json = JSON(dictionary)
31 | //dictionary
32 | XCTAssertEqual((json.dictionary!["number"]! as JSON).double!, 9823.212)
33 | XCTAssertEqual((json.dictionary!["name"]! as JSON).string!, "NAME")
34 | XCTAssertEqual(((json.dictionary!["list"]! as JSON).array![0] as JSON).int!, 1234)
35 | XCTAssertEqual(((json.dictionary!["list"]! as JSON).array![1] as JSON).double!, 4.212)
36 | XCTAssertEqual((((json.dictionary!["object"]! as JSON).dictionaryValue)["sub_number"]! as JSON).double!, 877.2323)
37 | XCTAssertTrue(json.dictionary!["null"] == nil)
38 | //dictionaryValue
39 | XCTAssertEqual(((((json.dictionaryValue)["object"]! as JSON).dictionaryValue)["sub_name"]! as JSON).string!, "sub_name")
40 | XCTAssertEqual((json.dictionaryValue["bool"]! as JSON).bool!, true)
41 | XCTAssertTrue(json.dictionaryValue["null"] == nil)
42 | XCTAssertTrue(JSON.nullJSON.dictionaryValue == [:])
43 | //dictionaryObject
44 | XCTAssertEqual(json.dictionaryObject!["number"]! as! Double, 9823.212)
45 | XCTAssertTrue(json.dictionaryObject!["null"] == nil)
46 | XCTAssertTrue(JSON.nullJSON.dictionaryObject == nil)
47 | }
48 |
49 | func testSetter() {
50 | var json:JSON = ["test":"case"]
51 | XCTAssertEqual(json.dictionaryObject! as! [String : String], ["test":"case"])
52 | json.dictionaryObject = ["name":"NAME"]
53 | XCTAssertEqual(json.dictionaryObject! as! [String : String], ["name":"NAME"])
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Source/ios/srvup/UICommentForm.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UICommentForm.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/26/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class UICommentForm: UIView {
12 |
13 | init(parentViewController:UIViewController, textArea:UITextView, textAreaPlaceholder:String, textAreaDelegate: UITextViewDelegate, formAction:Selector){
14 | let frame = CGRectMake(0, 0, parentViewController.view.frame.width, parentViewController.view.frame.height)
15 | super.init(frame: frame)
16 |
17 | let image = UIImage(named: "pattern")
18 | let bgImage = UIColor(patternImage: image!)
19 | let bgView = UIView()
20 | bgView.frame = self.frame
21 | bgView.backgroundColor = bgImage
22 | bgView.layer.zPosition = -100
23 | bgView.userInteractionEnabled = false
24 | self.addSubview(bgView)
25 | self.backgroundColor = UIColor(red: 0, green: 88/255.0, blue: 128/255.0, alpha: 1.0)
26 |
27 |
28 |
29 | // self.backgroundColor = .greenColor()
30 |
31 |
32 | let topOffset = CGFloat(25)
33 | let xOffset = CGFloat(10)
34 | let spacingE = CGFloat(10)
35 |
36 |
37 | // title
38 | let label = UILabel()
39 | label.text = "Add new Comment"
40 | label.frame = CGRectMake(xOffset, topOffset + spacingE, self.frame.width - (xOffset * 2), 30)
41 | label.textColor = .whiteColor()
42 |
43 |
44 | // text area field
45 |
46 |
47 | textArea.editable = true
48 | textArea.text = textAreaPlaceholder
49 | textArea.delegate = textAreaDelegate
50 | textArea.frame = CGRectMake(xOffset, label.frame.origin.y + label.frame.height + spacingE, label.frame.width, 250)
51 | // submit button
52 |
53 | let submitBtn = UIButton()
54 | submitBtn.frame = CGRectMake(xOffset,textArea.frame.origin.y + textArea.frame.height + spacingE, textArea.frame.width, 30)
55 | submitBtn.setTitle("Submit", forState: UIControlState.Normal)
56 | submitBtn.addTarget(parentViewController, action: formAction, forControlEvents: UIControlEvents.TouchUpInside)
57 | submitBtn.tag = 1
58 |
59 | // cancel button
60 | let cancelBtn = UIButton()
61 | cancelBtn.frame = CGRectMake(xOffset, submitBtn.frame.origin.y + submitBtn.frame.height + spacingE, submitBtn.frame.width, 30)
62 | cancelBtn.setTitle("Cancel", forState: UIControlState.Normal)
63 | cancelBtn.addTarget(parentViewController, action: formAction, forControlEvents: UIControlEvents.TouchUpInside)
64 | cancelBtn.tag = 2
65 | self.addSubview(label)
66 | self.addSubview(textArea)
67 | self.addSubview(submitBtn)
68 | self.addSubview(cancelBtn)
69 |
70 | }
71 |
72 | required init(coder aDecoder: NSCoder) {
73 | fatalError("init(coder:) has not been implemented")
74 | }
75 |
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/LiteralConvertibleTests.swift:
--------------------------------------------------------------------------------
1 | // LiteralConvertibleTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class LiteralConvertibleTests: XCTestCase {
27 |
28 | func testNumber() {
29 | var json:JSON = 1234567890.876623
30 | XCTAssertEqual(json.int!, 1234567890)
31 | XCTAssertEqual(json.intValue, 1234567890)
32 | XCTAssertEqual(json.double!, 1234567890.876623)
33 | XCTAssertEqual(json.doubleValue, 1234567890.876623)
34 | XCTAssertTrue(json.float! == 1234567890.876623)
35 | XCTAssertTrue(json.floatValue == 1234567890.876623)
36 | }
37 |
38 | func testBool() {
39 | var jsonTrue:JSON = true
40 | XCTAssertEqual(jsonTrue.bool!, true)
41 | XCTAssertEqual(jsonTrue.boolValue, true)
42 | var jsonFalse:JSON = false
43 | XCTAssertEqual(jsonFalse.bool!, false)
44 | XCTAssertEqual(jsonFalse.boolValue, false)
45 | }
46 |
47 | func testString() {
48 | var json:JSON = "abcd efg, HIJK;LMn"
49 | XCTAssertEqual(json.string!, "abcd efg, HIJK;LMn")
50 | XCTAssertEqual(json.stringValue, "abcd efg, HIJK;LMn")
51 | }
52 |
53 | func testNil() {
54 | var jsonNil_1:JSON = nil
55 | XCTAssert(jsonNil_1 == nil)
56 | var jsonNil_2:JSON = JSON(NSNull)
57 | XCTAssert(jsonNil_2 != nil)
58 | var jsonNil_3:JSON = JSON([1:2])
59 | XCTAssert(jsonNil_3 != nil)
60 | }
61 |
62 | func testArray() {
63 | var json:JSON = [1,2,"4",5,"6"]
64 | XCTAssertEqual(json.array!, [1,2,"4",5,"6"])
65 | XCTAssertEqual(json.arrayValue, [1,2,"4",5,"6"])
66 | }
67 |
68 | func testDictionary() {
69 | var json:JSON = ["1":2,"2":2,"three":3,"list":["aa","bb","dd"]]
70 | XCTAssertEqual(json.dictionary!, ["1":2,"2":2,"three":3,"list":["aa","bb","dd"]])
71 | XCTAssertEqual(json.dictionaryValue, ["1":2,"2":2,"three":3,"list":["aa","bb","dd"]])
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/MasterViewController.swift:
--------------------------------------------------------------------------------
1 | // MasterViewController.swift
2 | //
3 | // Copyright (c) 2014–2015 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 UIKit
24 | import Alamofire
25 |
26 | class MasterViewController: UITableViewController {
27 |
28 | @IBOutlet weak var titleImageView: UIImageView!
29 |
30 | var detailViewController: DetailViewController? = nil
31 | var objects = NSMutableArray()
32 |
33 | override func awakeFromNib() {
34 | super.awakeFromNib()
35 |
36 | self.navigationItem.titleView = self.titleImageView
37 | }
38 |
39 | // MARK: - UIViewController
40 |
41 | override func viewDidLoad() {
42 | super.viewDidLoad()
43 |
44 | if let split = self.splitViewController {
45 | let controllers = split.viewControllers
46 | self.detailViewController = controllers.last?.topViewController as? DetailViewController
47 | }
48 | }
49 |
50 | // MARK: - UIStoryboardSegue
51 |
52 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
53 | if let detailViewController = segue.destinationViewController.topViewController as? DetailViewController {
54 | func requestForSegue(segue: UIStoryboardSegue) -> Request? {
55 | switch segue.identifier as String! {
56 | case "GET":
57 | return Alamofire.request(.GET, "http://httpbin.org/get")
58 | case "POST":
59 | return Alamofire.request(.POST, "http://httpbin.org/post")
60 | case "PUT":
61 | return Alamofire.request(.PUT, "http://httpbin.org/put")
62 | case "DELETE":
63 | return Alamofire.request(.DELETE, "http://httpbin.org/delete")
64 | default:
65 | return nil
66 | }
67 | }
68 |
69 | if let request = requestForSegue(segue) {
70 | detailViewController.request = request
71 | }
72 | }
73 | }
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/ManagerTests.swift:
--------------------------------------------------------------------------------
1 | // RequestTests.swift
2 | //
3 | // Copyright (c) 2014–2015 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 Alamofire
24 | import Foundation
25 | import XCTest
26 |
27 | class ManagerTestCase: BaseTestCase {
28 | func testSetStartRequestsImmediatelyToFalseAndResumeRequest() {
29 | // Given
30 | let manager = Alamofire.Manager()
31 | manager.startRequestsImmediately = false
32 |
33 | let URL = NSURL(string: "http://httpbin.org/get")!
34 | let URLRequest = NSURLRequest(URL: URL)
35 |
36 | let expectation = expectationWithDescription("\(URL)")
37 |
38 | var response: NSHTTPURLResponse?
39 |
40 | // When
41 | manager.request(URLRequest)
42 | .response { _, responseResponse, _, _ in
43 | response = responseResponse
44 | expectation.fulfill()
45 | }
46 | .resume()
47 |
48 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
49 |
50 | // Then
51 | XCTAssertNotNil(response, "response should not be nil")
52 | XCTAssertTrue(response?.statusCode == 200, "response status code should be 200")
53 | }
54 |
55 | func testReleasingManagerWithPendingRequestDeinitializesSuccessfully() {
56 | // Given
57 | var manager: Manager? = Alamofire.Manager()
58 | manager?.startRequestsImmediately = false
59 |
60 | let URL = NSURL(string: "http://httpbin.org/get")!
61 | let URLRequest = NSURLRequest(URL: URL)
62 |
63 | // When
64 | let request = manager?.request(URLRequest)
65 | manager = nil
66 |
67 | // Then
68 | XCTAssertTrue(request?.task.state == .Suspended, "request task state should be '.Suspended'")
69 | XCTAssertNil(manager, "manager should be nil")
70 | }
71 |
72 | func testReleasingManagerWithPendingCanceledRequestDeinitializesSuccessfully() {
73 | // Given
74 | var manager: Manager? = Alamofire.Manager()
75 | manager!.startRequestsImmediately = false
76 |
77 | let URL = NSURL(string: "http://httpbin.org/get")!
78 | let URLRequest = NSURLRequest(URL: URL)
79 |
80 | // When
81 | let request = manager!.request(URLRequest)
82 | request.cancel()
83 | manager = nil
84 |
85 | // Then
86 | let state = request.task.state
87 | XCTAssertTrue(state == .Canceling || state == .Completed, "state should be .Canceling or .Completed")
88 | XCTAssertNil(manager, "manager should be nil")
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/PerformanceTests.swift:
--------------------------------------------------------------------------------
1 | // PerformanceTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class PerformanceTests: XCTestCase {
27 |
28 | var testData: NSData!
29 |
30 | override func setUp() {
31 | super.setUp()
32 |
33 | if let file = NSBundle(forClass:PerformanceTests.self).pathForResource("Tests", ofType: "json") {
34 | self.testData = NSData(contentsOfFile: file)
35 | } else {
36 | XCTFail("Can't find the test JSON file")
37 | }
38 | }
39 |
40 | override func tearDown() {
41 | // Put teardown code here. This method is called after the invocation of each test method in the class.
42 | super.tearDown()
43 | }
44 |
45 | func testInitPerformance() {
46 | self.measureBlock() {
47 | for _ in 1...100 {
48 | let json = JSON(data:self.testData)
49 | XCTAssertTrue(json != JSON.nullJSON)
50 | }
51 | }
52 | }
53 |
54 | func testObjectMethodPerformance() {
55 | var json = JSON(data:self.testData)
56 | self.measureBlock() {
57 | for _ in 1...100 {
58 | let object:AnyObject? = json.object
59 | XCTAssertTrue(object != nil)
60 | }
61 | }
62 | }
63 |
64 | func testArrayMethodPerformance() {
65 | let json = JSON(data:self.testData)
66 | self.measureBlock() {
67 | for _ in 1...100 {
68 | autoreleasepool{
69 | let array = json.array
70 | XCTAssertTrue(array?.count > 0)
71 | }
72 | }
73 | }
74 | }
75 |
76 | func testDictionaryMethodPerformance() {
77 | let json = JSON(data:testData)[0]
78 | self.measureBlock() {
79 | for _ in 1...100 {
80 | autoreleasepool{
81 | var dictionary = json.dictionary
82 | XCTAssertTrue(dictionary?.count > 0)
83 | }
84 | }
85 | }
86 | }
87 |
88 | func testRawStringMethodPerformance() {
89 | let json = JSON(data:testData)
90 | self.measureBlock() {
91 | for _ in 1...100 {
92 | autoreleasepool{
93 | var string = json.rawString()
94 | XCTAssertTrue(string != nil)
95 | }
96 | }
97 | }
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/PrintableTests.swift:
--------------------------------------------------------------------------------
1 | // PrintableTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class PrintableTests: XCTestCase {
27 | func testNumber() {
28 | var json:JSON = 1234567890.876623
29 | XCTAssertEqual(json.description, "1234567890.876623")
30 | XCTAssertEqual(json.debugDescription, "1234567890.876623")
31 | }
32 |
33 | func testBool() {
34 | var jsonTrue:JSON = true
35 | XCTAssertEqual(jsonTrue.description, "true")
36 | XCTAssertEqual(jsonTrue.debugDescription, "true")
37 | var jsonFalse:JSON = false
38 | XCTAssertEqual(jsonFalse.description, "false")
39 | XCTAssertEqual(jsonFalse.debugDescription, "false")
40 | }
41 |
42 | func testString() {
43 | var json:JSON = "abcd efg, HIJK;LMn"
44 | XCTAssertEqual(json.description, "abcd efg, HIJK;LMn")
45 | XCTAssertEqual(json.debugDescription, "abcd efg, HIJK;LMn")
46 | }
47 |
48 | func testNil() {
49 | var jsonNil_1:JSON = nil
50 | XCTAssertEqual(jsonNil_1.description, "null")
51 | XCTAssertEqual(jsonNil_1.debugDescription, "null")
52 | var jsonNil_2:JSON = JSON(NSNull())
53 | XCTAssertEqual(jsonNil_2.description, "null")
54 | XCTAssertEqual(jsonNil_2.debugDescription, "null")
55 | }
56 |
57 | func testArray() {
58 | var json:JSON = [1,2,"4",5,"6"]
59 | var description = json.description.stringByReplacingOccurrencesOfString("\n", withString: "")
60 | description = description.stringByReplacingOccurrencesOfString(" ", withString: "")
61 | XCTAssertEqual(description, "[1,2,\"4\",5,\"6\"]")
62 | XCTAssertTrue(json.description.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > 0)
63 | XCTAssertTrue(json.debugDescription.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > 0)
64 | }
65 |
66 | func testDictionary() {
67 | var json:JSON = ["1":2,"2":"two", "3":3]
68 | var debugDescription = json.debugDescription.stringByReplacingOccurrencesOfString("\n", withString: "")
69 | debugDescription = debugDescription.stringByReplacingOccurrencesOfString(" ", withString: "")
70 | XCTAssertTrue(json.description.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > 0)
71 | XCTAssertTrue(debugDescription.rangeOfString("\"1\":2", options: NSStringCompareOptions.CaseInsensitiveSearch) != nil)
72 | XCTAssertTrue(debugDescription.rangeOfString("\"2\":\"two\"", options: NSStringCompareOptions.CaseInsensitiveSearch) != nil)
73 | XCTAssertTrue(debugDescription.rangeOfString("\"3\":3", options: NSStringCompareOptions.CaseInsensitiveSearch) != nil)
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | This document contains information and guidelines about contributing to this project.
4 | Please read it before you start participating.
5 |
6 | **Topics**
7 |
8 | * [Asking Questions](#asking-questions)
9 | * [Reporting Security Issues](#reporting-security-issues)
10 | * [Reporting Issues](#reporting-other-issues)
11 | * [Developers Certificate of Origin](#developers-certificate-of-origin)
12 | * [Code of Conduct](#code-of-conduct)
13 |
14 | ## Asking Questions
15 |
16 | We don't use GitHub as a support forum.
17 | For any usage questions that are not specific to the project itself,
18 | please ask on [Stack Overflow](https://stackoverflow.com) instead.
19 | By doing so, you'll be more likely to quickly solve your problem,
20 | and you'll allow anyone else with the same question to find the answer.
21 | This also allows maintainers to focus on improving the project for others.
22 |
23 | ## Reporting Security Issues
24 |
25 | The Alamofire Software Foundation takes security seriously.
26 | If you discover a security issue, please bring it to our attention right away!
27 |
28 | Please **DO NOT** file a public issue,
29 | instead send your report privately to .
30 | This will help ensure that any vulnerabilities that _are_ found
31 | can be [disclosed responsibly](http://en.wikipedia.org/wiki/Responsible_disclosure)
32 | to any affected parties.
33 |
34 | ## Reporting Other Issues
35 |
36 | A great way to contribute to the project
37 | is to send a detailed issue when you encounter an problem.
38 | We always appreciate a well-written, thorough bug report.
39 |
40 | Check that the project issues database
41 | doesn't already include that problem or suggestion before submitting an issue.
42 | If you find a match, add a quick "+1" or "I have this problem too."
43 | Doing this helps prioritize the most common problems and requests.
44 |
45 | When reporting issues, please include the following:
46 |
47 | * The version of Xcode you're using
48 | * The version of iOS or OS X you're targeting
49 | * The full output of any stack trace or compiler error
50 | * A code snippet that reproduces the described behavior, if applicable
51 | * Any other details that would be useful in understanding the problem
52 |
53 | This information will help us review and fix your issue faster.
54 |
55 | ## Developer's Certificate of Origin 1.1
56 |
57 | By making a contribution to this project, I certify that:
58 |
59 | - (a) The contribution was created in whole or in part by me and I
60 | have the right to submit it under the open source license
61 | indicated in the file; or
62 |
63 | - (b) The contribution is based upon previous work that, to the best
64 | of my knowledge, is covered under an appropriate open source
65 | license and I have the right under that license to submit that
66 | work with modifications, whether created in whole or in part
67 | by me, under the same open source license (unless I am
68 | permitted to submit under a different license), as indicated
69 | in the file; or
70 |
71 | - (c) The contribution was provided directly to me by some other
72 | person who certified (a), (b) or (c) and I have not modified
73 | it.
74 |
75 | - (d) I understand and agree that this project and the contribution
76 | are public and that a record of the contribution (including all
77 | personal information I submit with it, including my sign-off) is
78 | maintained indefinitely and may be redistributed consistent with
79 | this project or the open source license(s) involved.
80 |
81 | ## Code of Conduct
82 |
83 | The Code of Conduct governs how we behave in public or in private
84 | whenever the project will be judged by our actions.
85 | We expect it to be honored by everyone who contributes to this project.
86 |
87 | See [CONDUCT.md](https://github.com/Alamofire/Foundation/blob/master/CONDUCT.md) for details.
88 |
89 | ---
90 |
91 | *Some of the ideas and wording for the statements above were based on work by the [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) and [Linux](http://elinux.org/Developer_Certificate_Of_Origin) communities. We commend them for their efforts to facilitate collaboration in their projects.*
92 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/ViewController.swift:
--------------------------------------------------------------------------------
1 | // SwiftyJSON.h
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 UIKit
24 | import SwiftyJSON
25 |
26 | class ViewController: UITableViewController {
27 |
28 | var json: JSON = JSON.nullJSON
29 |
30 | // MARK: - Table view data source
31 |
32 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
33 | return 1
34 | }
35 |
36 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
37 | switch self.json.type {
38 | case Type.Array, Type.Dictionary:
39 | return self.json.count
40 | default:
41 | return 1
42 | }
43 | }
44 |
45 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
46 | let cell = tableView.dequeueReusableCellWithIdentifier("JSONCell", forIndexPath: indexPath) as! UITableViewCell
47 |
48 | var row = indexPath.row
49 |
50 | switch self.json.type {
51 | case .Array:
52 | cell.textLabel?.text = "\(row)"
53 | cell.detailTextLabel?.text = self.json.arrayValue.description
54 | case .Dictionary:
55 | let key: AnyObject = (self.json.object as! NSDictionary).allKeys[row]
56 | let value = self.json[key as! String]
57 | cell.textLabel?.text = "\(key)"
58 | cell.detailTextLabel?.text = value.description
59 | default:
60 | cell.textLabel?.text = ""
61 | cell.detailTextLabel?.text = self.json.description
62 | }
63 |
64 | return cell
65 | }
66 |
67 | // MARK: - Navigation
68 |
69 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
70 |
71 | var object: AnyObject
72 | switch UIDevice.currentDevice().systemVersion.compare("8.0.0", options: NSStringCompareOptions.NumericSearch) {
73 | case .OrderedSame, .OrderedDescending:
74 | object = segue.destinationViewController.topViewController
75 | case .OrderedAscending:
76 | object = segue.destinationViewController
77 | }
78 |
79 | if let nextController = object as? ViewController {
80 |
81 | if let indexPath = self.tableView.indexPathForSelectedRow() {
82 | var row = indexPath.row
83 | var nextJson: JSON = JSON.nullJSON
84 |
85 | switch self.json.type {
86 | case .Array:
87 | nextJson = self.json[row]
88 | case .Dictionary where row < self.json.dictionaryValue.count:
89 | let key = self.json.dictionaryValue.keys.array[row]
90 | if let value = self.json.dictionary?[key] {
91 | nextJson = value
92 | }
93 | default:
94 | print("")
95 | }
96 | nextController.json = nextJson
97 | print(nextJson)
98 | }
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Source/ios/srvup.xcodeproj/xcuserdata/jmitch.xcuserdatad/xcschemes/srvup.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire OSX.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/xcshareddata/xcschemes/SwiftyJSON OSX.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/xcshareddata/xcschemes/SwiftyJSON iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
94 |
100 |
101 |
102 |
103 |
105 |
106 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Tests/RawRepresentableTests.swift:
--------------------------------------------------------------------------------
1 | // RawRepresentableTests.swift
2 | //
3 | // Copyright (c) 2014 Pinglin Tang
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 XCTest
24 | import SwiftyJSON
25 |
26 | class RawRepresentableTests: XCTestCase {
27 |
28 | func testNumber() {
29 | var json:JSON = JSON(rawValue: 948394394.347384 as NSNumber)!
30 | XCTAssertEqual(json.int!, 948394394)
31 | XCTAssertEqual(json.intValue, 948394394)
32 | XCTAssertEqual(json.double!, 948394394.347384)
33 | XCTAssertEqual(json.doubleValue, 948394394.347384)
34 | XCTAssertTrue(json.float! == 948394394.347384)
35 | XCTAssertTrue(json.floatValue == 948394394.347384)
36 |
37 | var object: AnyObject = json.rawValue
38 | XCTAssertEqual(object as! Int, 948394394)
39 | XCTAssertEqual(object as! Double, 948394394.347384)
40 | XCTAssertTrue(object as! Float == 948394394.347384)
41 | XCTAssertEqual(object as! NSNumber, 948394394.347384)
42 | }
43 |
44 | func testBool() {
45 | var jsonTrue:JSON = JSON(rawValue: true as NSNumber)!
46 | XCTAssertEqual(jsonTrue.bool!, true)
47 | XCTAssertEqual(jsonTrue.boolValue, true)
48 |
49 | var jsonFalse:JSON = JSON(rawValue: false)!
50 | XCTAssertEqual(jsonFalse.bool!, false)
51 | XCTAssertEqual(jsonFalse.boolValue, false)
52 |
53 | var objectTrue: AnyObject = jsonTrue.rawValue
54 | XCTAssertEqual(objectTrue as! Int, 1)
55 | XCTAssertEqual(objectTrue as! Double, 1.0)
56 | XCTAssertEqual(objectTrue as! Bool, true)
57 | XCTAssertEqual(objectTrue as! NSNumber, NSNumber(bool: true))
58 |
59 | var objectFalse: AnyObject = jsonFalse.rawValue
60 | XCTAssertEqual(objectFalse as! Int, 0)
61 | XCTAssertEqual(objectFalse as! Double, 0.0)
62 | XCTAssertEqual(objectFalse as! Bool, false)
63 | XCTAssertEqual(objectFalse as! NSNumber, NSNumber(bool: false))
64 | }
65 |
66 | func testString() {
67 | let string = "The better way to deal with JSON data in Swift."
68 | if let json:JSON = JSON(rawValue: string) {
69 | XCTAssertEqual(json.string!, string)
70 | XCTAssertEqual(json.stringValue, string)
71 | XCTAssertTrue(json.array == nil)
72 | XCTAssertTrue(json.dictionary == nil)
73 | XCTAssertTrue(json.null == nil)
74 | XCTAssertTrue(json.error == nil)
75 | XCTAssertTrue(json.type == .String)
76 | XCTAssertEqual(json.object as! String, string)
77 | } else {
78 | XCTFail("Should not run into here")
79 | }
80 |
81 | let object: AnyObject = JSON(rawValue: string)!.rawValue
82 | XCTAssertEqual(object as! String, string)
83 | }
84 |
85 | func testNil() {
86 | if let json = JSON(rawValue: NSObject()) {
87 | XCTFail("Should not run into here")
88 | }
89 | }
90 |
91 | func testArray() {
92 | let array = [1,2,"3",4102,"5632", "abocde", "!@# $%^&*()"] as NSArray
93 | if let json:JSON = JSON(rawValue: array) {
94 | XCTAssertEqual(json, JSON(array))
95 | }
96 |
97 | let object: AnyObject = JSON(rawValue: array)!.rawValue
98 | XCTAssertTrue(array == object as! NSArray)
99 | }
100 |
101 | func testDictionary() {
102 | let dictionary = ["1":2,"2":2,"three":3,"list":["aa","bb","dd"]] as NSDictionary
103 | if let json:JSON = JSON(rawValue: dictionary) {
104 | XCTAssertEqual(json, JSON(dictionary))
105 | }
106 |
107 | let object: AnyObject = JSON(rawValue: dictionary)!.rawValue
108 | XCTAssertTrue(dictionary == object as! NSDictionary)
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Source/ios/srvup/ProjectTableViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProjectTableViewController.swift
3 | // srvup
4 | //
5 | // Created by Justin Mitchel on 6/16/15.
6 | // Copyright (c) 2015 Coding for Entrepreneurs. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | import KeychainAccess
12 |
13 | class ProjectTableViewController: UITableViewController {
14 | var projects = [Project]()
15 | let keychain = Keychain(service: "com.codingforentrepreneurs.srvup")
16 |
17 | let user = User()
18 |
19 | override func viewWillAppear(animated: Bool) {
20 | user.checkToken()
21 | }
22 |
23 |
24 | override func viewDidLoad() {
25 | super.viewDidLoad()
26 |
27 | self.view.backgroundColor = .blackColor()
28 | self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None
29 |
30 | let btn = UINavButton(title: "Logout", direction: UIButtonDirection.Right, parentView: self.tableView)
31 | btn.addTarget(self, action: "doLogout:", forControlEvents: UIControlEvents.TouchUpInside)
32 | btn.titleLabel?.adjustsFontSizeToFitWidth = true
33 | self.tableView.addSubview(btn)
34 |
35 |
36 | // Uncomment the following line to preserve selection between presentations
37 | // self.clearsSelectionOnViewWillAppear = false
38 |
39 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
40 | // self.navigationItem.rightBarButtonItem = self.editButtonItem()
41 | }
42 |
43 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
44 | tableView.deselectRowAtIndexPath(indexPath, animated: true)
45 | }
46 | override func didReceiveMemoryWarning() {
47 | super.didReceiveMemoryWarning()
48 | // Dispose of any resources that can be recreated.
49 | }
50 |
51 | // MARK: - Table view data source
52 |
53 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
54 | // #warning Potentially incomplete method implementation.
55 | // Return the number of sections.
56 | return 1
57 | }
58 |
59 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
60 | // #warning Incomplete method implementation.
61 | // Return the number of rows in the section.
62 | return self.projects.count
63 | }
64 |
65 |
66 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
67 | let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! ProjectTableCell
68 | let project = self.projects[indexPath.row]
69 | // Configure the cell...
70 | // cell.textLabel?.text = "\(indexPath.row + 1) - \(self.projects[indexPath.row].title)"
71 | if project.imageUrlString != nil {
72 | let imageUrl = NSURL(string: project.imageUrlString!)
73 | let data = NSData(contentsOfURL: imageUrl!)
74 | let image = UIImage(data: data!)
75 | // let imageView = UIimageView()
76 | cell.projectImage.image = image
77 | }
78 | cell.backgroundColor = self.view.backgroundColor
79 | cell.projectLabel.text = "\(project.title)"
80 | return cell
81 | }
82 |
83 |
84 |
85 | func doLogout(sender:AnyObject) {
86 | // println("logout")
87 | self.keychain["token"] = nil
88 | self.navigationController?.popViewControllerAnimated(true)
89 | self.dismissViewControllerAnimated(true, completion: nil)
90 |
91 | }
92 |
93 | /*
94 | // Override to support conditional editing of the table view.
95 | override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
96 | // Return NO if you do not want the specified item to be editable.
97 | return true
98 | }
99 | */
100 |
101 | /*
102 | // Override to support editing the table view.
103 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
104 | if editingStyle == .Delete {
105 | // Delete the row from the data source
106 | tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
107 | } else if editingStyle == .Insert {
108 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
109 | }
110 | }
111 | */
112 |
113 | /*
114 | // Override to support rearranging the table view.
115 | override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
116 |
117 | }
118 | */
119 |
120 | /*
121 | // Override to support conditional rearranging of the table view.
122 | override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
123 | // Return NO if you do not want the item to be re-orderable.
124 | return true
125 | }
126 | */
127 |
128 |
129 | // MARK: - Navigation
130 |
131 | // In a storyboard-based application, you will often want to do a little preparation before navigation
132 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
133 | let vc = segue.destinationViewController as! LectureListTableViewController
134 | let indexPath = self.tableView.indexPathForSelectedRow()
135 | let project = self.projects[indexPath!.row]
136 | vc.project = project
137 |
138 | }
139 |
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Example/DetailViewController.swift:
--------------------------------------------------------------------------------
1 | // DetailViewController.swift
2 | //
3 | // Copyright (c) 2014–2015 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 UIKit
24 | import Alamofire
25 |
26 | class DetailViewController: UITableViewController {
27 | enum Sections: Int {
28 | case Headers, Body
29 | }
30 |
31 | var request: Alamofire.Request? {
32 | didSet {
33 | oldValue?.cancel()
34 |
35 | self.title = self.request?.description
36 | self.refreshControl?.endRefreshing()
37 | self.headers.removeAll()
38 | self.body = nil
39 | self.elapsedTime = nil
40 | }
41 | }
42 |
43 | var headers: [String: String] = [:]
44 | var body: String?
45 | var elapsedTime: NSTimeInterval?
46 |
47 | override func awakeFromNib() {
48 | super.awakeFromNib()
49 | self.refreshControl?.addTarget(self, action: "refresh", forControlEvents: .ValueChanged)
50 |
51 | }
52 |
53 | // MARK: - UIViewController
54 |
55 | override func viewDidAppear(animated: Bool) {
56 | super.viewDidAppear(animated)
57 |
58 | self.refresh()
59 | }
60 |
61 | // MARK: - IBAction
62 |
63 | @IBAction func refresh() {
64 | if self.request == nil {
65 | return
66 | }
67 |
68 | self.refreshControl?.beginRefreshing()
69 |
70 | let start = CACurrentMediaTime()
71 | self.request?.responseString { (request, response, body, error) in
72 | let end = CACurrentMediaTime()
73 | self.elapsedTime = end - start
74 |
75 | for (field, value) in response!.allHeaderFields {
76 | self.headers["\(field)"] = "\(value)"
77 | }
78 |
79 | self.body = body
80 |
81 | self.tableView.reloadData()
82 | self.refreshControl?.endRefreshing()
83 | }
84 | }
85 |
86 | // MARK: UITableViewDataSource
87 |
88 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
89 | switch Sections(rawValue: section)! {
90 | case .Headers:
91 | return self.headers.count
92 | case .Body:
93 | return self.body == nil ? 0 : 1
94 | default:
95 | return 0
96 | }
97 | }
98 |
99 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
100 |
101 | switch Sections(rawValue: indexPath.section)! {
102 | case .Headers:
103 | let cell = self.tableView.dequeueReusableCellWithIdentifier("Header") as! UITableViewCell
104 | let field = self.headers.keys.array.sorted(<)[indexPath.row]
105 | let value = self.headers[field]
106 |
107 | cell.textLabel?.text = field
108 | cell.detailTextLabel!.text = value
109 |
110 | return cell
111 | case .Body:
112 | let cell = self.tableView.dequeueReusableCellWithIdentifier("Body") as! UITableViewCell
113 |
114 | cell.textLabel?.text = self.body
115 |
116 | return cell
117 | }
118 | }
119 |
120 | // MARK: UITableViewDelegate
121 |
122 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
123 | return 2
124 | }
125 |
126 | override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String {
127 | if self.tableView(tableView, numberOfRowsInSection: section) == 0 {
128 | return ""
129 | }
130 |
131 | switch Sections(rawValue: section)! {
132 | case .Headers:
133 | return "Headers"
134 | case .Body:
135 | return "Body"
136 | }
137 | }
138 |
139 | override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
140 | switch Sections(rawValue: indexPath.section)! {
141 | case .Body:
142 | return 300
143 | default:
144 | return tableView.rowHeight
145 | }
146 | }
147 |
148 | override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String {
149 | if Sections(rawValue: section)! == .Body && self.elapsedTime != nil {
150 | let numberFormatter = NSNumberFormatter()
151 | numberFormatter.numberStyle = .DecimalStyle
152 |
153 | return "Elapsed Time: \(numberFormatter.stringFromNumber(self.elapsedTime!)) sec"
154 | }
155 |
156 | return ""
157 | }
158 | }
159 |
160 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/SwiftyJSON/Example/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Source/Validation.swift:
--------------------------------------------------------------------------------
1 | // Alamofire.swift
2 | //
3 | // Copyright (c) 2014–2015 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 | extension Request {
26 |
27 | /**
28 | A closure used to validate a request that takes a URL request and URL response, and returns whether the request was valid.
29 | */
30 | public typealias Validation = (NSURLRequest, NSHTTPURLResponse) -> Bool
31 |
32 | /**
33 | Validates the request, using the specified closure.
34 |
35 | If validation fails, subsequent calls to response handlers will have an associated error.
36 |
37 | :param: validation A closure to validate the request.
38 |
39 | :returns: The request.
40 | */
41 | public func validate(validation: Validation) -> Self {
42 | delegate.queue.addOperationWithBlock {
43 | if self.response != nil && self.delegate.error == nil {
44 | if !validation(self.request, self.response!) {
45 | self.delegate.error = NSError(domain: AlamofireErrorDomain, code: -1, userInfo: nil)
46 | }
47 | }
48 | }
49 |
50 | return self
51 | }
52 |
53 | // MARK: - Status Code
54 |
55 | /**
56 | Validates that the response has a status code in the specified range.
57 |
58 | If validation fails, subsequent calls to response handlers will have an associated error.
59 |
60 | :param: range The range of acceptable status codes.
61 |
62 | :returns: The request.
63 | */
64 | public func validate(statusCode acceptableStatusCode: S) -> Self {
65 | return validate { _, response in
66 | return contains(acceptableStatusCode, response.statusCode)
67 | }
68 | }
69 |
70 | // MARK: - Content-Type
71 |
72 | private struct MIMEType {
73 | let type: String
74 | let subtype: String
75 |
76 | init?(_ string: String) {
77 | let components = string.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).substringToIndex(string.rangeOfString(";")?.endIndex ?? string.endIndex).componentsSeparatedByString("/")
78 |
79 | if let type = components.first,
80 | subtype = components.last
81 | {
82 | self.type = type
83 | self.subtype = subtype
84 | } else {
85 | return nil
86 | }
87 | }
88 |
89 | func matches(MIME: MIMEType) -> Bool {
90 | switch (type, subtype) {
91 | case (MIME.type, MIME.subtype), (MIME.type, "*"), ("*", MIME.subtype), ("*", "*"):
92 | return true
93 | default:
94 | return false
95 | }
96 | }
97 | }
98 |
99 | /**
100 | Validates that the response has a content type in the specified array.
101 |
102 | If validation fails, subsequent calls to response handlers will have an associated error.
103 |
104 | :param: contentType The acceptable content types, which may specify wildcard types and/or subtypes.
105 |
106 | :returns: The request.
107 | */
108 | public func validate(contentType acceptableContentTypes: S) -> Self {
109 | return validate { _, response in
110 | if let responseContentType = response.MIMEType,
111 | responseMIMEType = MIMEType(responseContentType)
112 | {
113 | for contentType in acceptableContentTypes {
114 | if let acceptableMIMEType = MIMEType(contentType)
115 | where acceptableMIMEType.matches(responseMIMEType)
116 | {
117 | return true
118 | }
119 | }
120 | }
121 |
122 | return false
123 | }
124 | }
125 |
126 | // MARK: - Automatic
127 |
128 | /**
129 | Validates that the response has a status code in the default acceptable range of 200...299, and that the content type matches any specified in the Accept HTTP header field.
130 |
131 | If validation fails, subsequent calls to response handlers will have an associated error.
132 |
133 | :returns: The request.
134 | */
135 | public func validate() -> Self {
136 | let acceptableStatusCodes: Range = 200..<300
137 | let acceptableContentTypes: [String] = {
138 | if let accept = self.request.valueForHTTPHeaderField("Accept") {
139 | return accept.componentsSeparatedByString(",")
140 | }
141 |
142 | return ["*/*"]
143 | }()
144 |
145 | return validate(statusCode: acceptableStatusCodes).validate(contentType: acceptableContentTypes)
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/UploadTests.swift:
--------------------------------------------------------------------------------
1 | // UploadTests.swift
2 | //
3 | // Copyright (c) 2014–2015 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 Alamofire
24 | import Foundation
25 | import XCTest
26 |
27 | class UploadResponseTestCase: BaseTestCase {
28 | func testUploadRequest() {
29 | // Given
30 | let URLString = "http://httpbin.org/post"
31 | let data = "Lorem ipsum dolor sit amet".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
32 |
33 | let expectation = expectationWithDescription("Upload request should succeed: \(URLString)")
34 |
35 | var request: NSURLRequest?
36 | var response: NSHTTPURLResponse?
37 | var error: NSError?
38 |
39 | // When
40 | Alamofire.upload(.POST, URLString, data)
41 | .response { responseRequest, responseResponse, _, responseError in
42 | request = responseRequest
43 | response = responseResponse
44 | error = responseError
45 |
46 | expectation.fulfill()
47 | }
48 |
49 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
50 |
51 | // Then
52 | XCTAssertNotNil(request, "request should not be nil")
53 | XCTAssertNotNil(response, "response should not be nil")
54 | XCTAssertNil(error, "error should be nil")
55 | }
56 |
57 | func testUploadRequestWithProgress() {
58 | // Given
59 | let URLString = "http://httpbin.org/post"
60 | let data: NSData = {
61 | var text = ""
62 | for _ in 1...3_000 {
63 | text += "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
64 | }
65 |
66 | return text.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
67 | }()
68 |
69 | let expectation = expectationWithDescription("Bytes upload progress should be reported: \(URLString)")
70 |
71 | var byteValues: [(bytes: Int64, totalBytes: Int64, totalBytesExpected: Int64)] = []
72 | var progressValues: [(completedUnitCount: Int64, totalUnitCount: Int64)] = []
73 | var responseRequest: NSURLRequest?
74 | var responseResponse: NSHTTPURLResponse?
75 | var responseData: AnyObject?
76 | var responseError: NSError?
77 |
78 | // When
79 | let upload = Alamofire.upload(.POST, URLString, data)
80 | upload.progress { bytesWritten, totalBytesWritten, totalBytesExpectedToWrite in
81 | let bytes = (bytes: bytesWritten, totalBytes: totalBytesWritten, totalBytesExpected: totalBytesExpectedToWrite)
82 | byteValues.append(bytes)
83 |
84 | let progress = (completedUnitCount: upload.progress.completedUnitCount, totalUnitCount: upload.progress.totalUnitCount)
85 | progressValues.append(progress)
86 | }
87 | upload.response { request, response, data, error in
88 | responseRequest = request
89 | responseResponse = response
90 | responseData = data
91 | responseError = error
92 |
93 | expectation.fulfill()
94 | }
95 |
96 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
97 |
98 | // Then
99 | XCTAssertNotNil(responseRequest, "response request should not be nil")
100 | XCTAssertNotNil(responseResponse, "response response should not be nil")
101 | XCTAssertNotNil(responseData, "response data should not be nil")
102 | XCTAssertNil(responseError, "response error should be nil")
103 |
104 | XCTAssertEqual(byteValues.count, progressValues.count, "byteValues count should equal progressValues count")
105 |
106 | if byteValues.count == progressValues.count {
107 | for index in 0.. UIImage? {
33 | if self.imageUrlString != nil {
34 | let url = NSURL(string: self.imageUrlString!)!
35 | let imageData = NSData(contentsOfURL: url)!
36 | let image = UIImage(data: imageData)
37 | return image
38 | }
39 |
40 | return nil
41 | }
42 |
43 | func createLectures(theArray:[JSON]) {
44 | if self.lectureSet.count == 0 && theArray.count > 0 {
45 | for i in theArray {
46 | var lecture = Lecture(title: i["title"].string!, url: i["url"].string!, id: i["id"].int!, slug: i["slug"].string!, order: i["order"].int!, embedCode: i["embed_code"].string!)
47 |
48 | lecture.shareMessage = i["share_message"].string
49 | lecture.timestamp = i["timestamp"].string
50 | if i["comment_set"].array != nil {
51 | lecture.commentSet = i["comment_set"].array!
52 | }
53 | if i["free_preview"].bool != nil {
54 | lecture.freePreview = i["free_preview"].bool!
55 | }
56 | self.lectureSet.append(lecture)
57 | }
58 | }
59 |
60 | }
61 |
62 | }
63 |
64 | class Lecture: NSObject {
65 | var title: String
66 | var url: String
67 | var id: Int
68 | var slug: String
69 | var order: Int
70 | var embedCode: String
71 | var freePreview = false
72 | var shareMessage: String?
73 | var timestamp: String?
74 | var commentSet = [JSON]()
75 |
76 | init(title:String, url:String, id:Int, slug:String, order:Int, embedCode:String) {
77 | self.title = title
78 | self.url = url
79 | self.id = id
80 | self.slug = slug
81 | self.order = order
82 | self.embedCode = embedCode
83 | }
84 | func updateLectureComments(completion:(success:Bool)->Void){
85 | let keychain = Keychain(service: "com.codingforentrepreneurs.srvup")
86 | let token = keychain["token"]
87 | if token != nil {
88 | var manager = Alamofire.Manager.sharedInstance
89 | manager.session.configuration.HTTPAdditionalHeaders = [
90 | "Authorization": "JWT \(token!)"
91 | ]
92 | let getCommentsRequest = manager.request(Method.GET, self.url, parameters:nil, encoding: ParameterEncoding.JSON)
93 | getCommentsRequest.responseJSON(options: nil, completionHandler: { (request, response, data, error) -> Void in
94 | let statusCode = response?.statusCode
95 | if (200 ... 299 ~= statusCode!) && (data != nil) {
96 | let jsonData = JSON(data!)
97 | let commentSet = jsonData["comment_set"].array
98 | if commentSet != nil {
99 | self.commentSet = commentSet!
100 | }
101 |
102 | completion(success: true)
103 | } else {
104 | completion(success: false)
105 |
106 | }
107 | })
108 |
109 |
110 |
111 | } else {
112 | println("No token")
113 | }
114 |
115 | }
116 | func addComment(commentText:String, parent:Int?, completion:(success:Bool, dataSent:JSON?)->Void){
117 | let commentCreateUrlString = "http://127.0.0.1:8000/api2/comment/create/"
118 | let keychain = Keychain(service: "com.codingforentrepreneurs.srvup")
119 | let token = keychain["token"]
120 | let user = keychain["user"]
121 | let userid = keychain["userid"]
122 | if token != nil && userid != nil {
123 | var manager = Alamofire.Manager.sharedInstance
124 | manager.session.configuration.HTTPAdditionalHeaders = [
125 | "Authorization": "JWT \(token!)"
126 | ]
127 |
128 | var params = ["text" : commentText, "video": "\(self.id)", "user": "\(userid!)"]
129 |
130 | if parent != nil {
131 | params = ["text" : commentText, "video": "\(self.id)", "user": "\(userid!)", "parent": "\(parent!)"]
132 | }
133 |
134 | let addCommentRequest = manager.request(Method.POST, commentCreateUrlString, parameters:params, encoding: ParameterEncoding.JSON)
135 | println(self.commentSet.count)
136 | addCommentRequest.responseJSON(options: nil, completionHandler: { (request, response, data, error) -> Void in
137 | let statusCode = response?.statusCode
138 |
139 | // 201
140 | println(response)
141 | println(data)
142 | println(error)
143 | if (200 ... 299 ~= statusCode!) && (data != nil) {
144 | let jsonData = JSON(data!)
145 | self.commentSet.insert(jsonData, atIndex: 0)
146 | // self.commentSet.append(jsonData)
147 | let newData = ["text": "\(commentText)", "user":"\(user!)"]
148 | completion(success: true, dataSent:JSON(newData))
149 | } else {
150 | completion(success: false, dataSent:nil)
151 |
152 | }
153 | })
154 |
155 |
156 |
157 | } else {
158 | println("No token")
159 | }
160 | }
161 |
162 |
163 |
164 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 | # Django to iOS
5 |
6 | Integrating a Django project with iOS has never been easier because of Swift, Alamofire, and the Django Rest Framework (DRF). Using these three, we can (1) Build an API (DRF), (2) Interact with the API (Alamofire), and (3) Build iOS Apps (Swift).
7 |
8 | This course is all about building an iOS app on top of a pre-existing Django app. We teach you step-by-step in video tutorials [https://codingforentrepreneurs.com/projects/django-ios/](https://codingforentrepreneurs.com/projects/django-ios/)
9 |
10 | The backend for the app is located [here](https://github.com/codingforentrepreneurs/srvup-rest-framework)
11 |
12 | We will continue to update the final code as it is needed. Below you will find the reference code that corresponds to any given lecture in the course.
13 |
14 | Enjoy!
15 |
16 |
17 |
18 |
19 | ## Lecture Code & Reference
20 |
21 | Getting Started Guide: [here](https://github.com/codingforentrepreneurs/Django-to-iOS/blob/master/Guides/Getting_Started.md)
22 |
23 | [4 - Implement Django](../../tree/b08e31255d4050c08eb72d5b6fa293a5d425a13e)
24 |
25 | [5 - Authentication](../../tree/95bd79655371e29575c5f0a1c627c49566fed55a)
26 |
27 | [6 - Status Code Switch Statement](../../tree/d24b9a4b26242223b21123f97c5829733dae7433)
28 |
29 | [7 - SwiftyJSON](../../tree/79cb36858afbdf82fe6908ef1e096440185bccb8)
30 |
31 | [8 - KeychainAccess](../../tree/1bab11e88fba027ae84325a6ab59dd5a06638d2a)
32 |
33 | [9 - Using an Auth Header with Alamofire](../../tree/d88bd5a9eca12a048b9dd636b7961ef7132887a7)
34 |
35 | [10 - Completion Handlers](../../tree/5d9be63eb6e44d989df3800999045d7c1910e898)
36 |
37 | [11 - Auth Methods](../../tree/a9c2ad658c4009b17433015dbfb4202173078179)
38 |
39 | [12 - UI Text Fields And A Button](../../tree/e9b67db31492cfe9b3695824754427169bf2a347)
40 |
41 | [13 - Validate Login Form](../../tree/d2c905e5e68cdfb931219ddc4bb5e29e0dc24b9f)
42 |
43 | [14 - Improve Form UI](../../tree/a399e8ec2ed70517c6f6ea20db5b3efe8e60030e)
44 |
45 | [15 - Perfom Segue](../../tree/478176e4c5f32d37a9266e60ffa576a78511307b)
46 |
47 | [16 - Project Model](../../tree/29034c22e2ffdef742223db6af9c40aa00529fa1)
48 |
49 | [17 - Results as Project Instances](../../tree/5ff7ec5ded5ea6f1f76f5aceaba1d84870ae5511)
50 |
51 | [18 - Prepare for Segue](../../tree/00eecd223caad227ebfaaaa2712b838ce799c733)
52 |
53 | [19 - UITableView in a View Controller](../../tree/c99397e4207701f942f6d1bd20d47551d59748ae)
54 |
55 | [20 - UI Table View Controller](../../tree/cc7751d7d2afe23f1bc3fa5000a2d71a55139dcc)
56 |
57 | [21 - Video Set](../../tree/a7ba3dde63fdbe3da9f73328382890f2fc7be3a0)
58 |
59 | [22 - Lecture Model](../../tree/9038a72207add228b703bd362ebd7a0046c40cdb)
60 |
61 | [23 - Create Lectures Method](../../tree/be3314f7fe45591556285382ee79ffdfbd9b223f)
62 |
63 | [24 - Custom Tables Cells for Images and Text](../../tree/c239b7736ea842f84976c6ce79505dfa484d2040)
64 |
65 | [25 - Lecture List Table VC](../../tree/88fd4131b2b169f26782881c9d96db38ec1aefb9)
66 |
67 | [26 - UI Alert View](../../tree/11e9cd88fecb11d80d2f3f65750b1b2ce3e4ef33)
68 |
69 | [27 - Table Header View](../../tree/55b6b57d675e7ea5119a168a1a2712e480977dbf)
70 |
71 | [28 - Video View Controller](../../tree/39592992bc502e1a38df909f8feefb0db9c30d25)
72 |
73 | [29 - UI Web View](../../tree/e3c7c3d50041573ceb11da6efd7b542bad8a06d1)
74 |
75 | [30 - Auto Login with Token](../../tree/b2fede449633f9f3b8cb0ef62a5011fb6857314e)
76 |
77 | [31 - Custom UI Nav Button](../../tree/b8c82cac66aed4e350525fbfc90a27dbc7413519)
78 |
79 | [32 - UINavButton Direction](../../tree/736d472cfb4281fc86663438bd0977dc5ac66d8d)
80 |
81 | [33 - Add Functionality to UI Nav Buttons](../../tree/8d90c05d15aeb2ebb60661c2b47154820d46a19c)
82 |
83 | [34 - UI Navigation Controller](../../tree/1655dd498f44af9f7a36f21f4d2a4d6ea17fb316)
84 |
85 | [35 - Check Token or Logout User](../../tree/92513be5916e703b980c903f4d00c12d1a7ad128)
86 |
87 | [36 - New Comment Form](../../tree/61cdc18a5e4b84c7da1917e0003563fa965b39ce)
88 |
89 | [37 - UI Functionality to Comment Form](../../tree/2354587f3f3b06959ab0d9f45e2f8e99eb891e89)
90 |
91 | [38 - Another Token Auth Request with Alamofire](../../tree/32b30ae71240e043dd45139394ee2355b66daa65)
92 |
93 | [39 - Save New Comment on the Server](../../tree/e016d2890c084b740b3f395e7e6bee10fafff5d2)
94 |
95 | [40 - Completion Handler for Successful Comment Creation](../../tree/32d0c9e933cb4a907d191506aa8890fc07c3da58)
96 |
97 | [41 - Comment Completion Handler Part 2](../../tree/d739bc61f1222f08c800824fa7a06dbf0f698809)
98 |
99 | [42 - Handling Comment Failure](../../tree/f4d09dce6ee743d88634e66a1c9186c52603fac9)
100 |
101 | [43 - Trigger Noification & Time Delay](../../tree/0aa914fe6cdcd894335b33bddbd5a1b6422abded)
102 |
103 | [44 - Animate Noifcations](../../tree/84ff9436dafa3b471e55f00cfc9a7602df9b816d)
104 |
105 | [45 - Comments Table View Controller](../../tree/38fb0af9f7ce75d8f320fbeb604b417a2afc8378)
106 |
107 | [46 - Cell Height based on Cell Text](../../tree/ae76d33c5a7d4127cae5e7999ea59ee0149ae8dd)
108 |
109 | [47 - Scroll to FooterView](../../tree/6bf80a6948d5efbd76acb4aa7109ee195524643d)
110 |
111 | [48 - Notification Class](../../tree/86ec55179f930a73b79ab912ea6133da2c4cdaf1)
112 |
113 | [49 - Update Comment Adding](../../tree/a0741e1eef968cd89a422493965622bfbba8455a)
114 |
115 | [50 - Comment Form in Footer](../../tree/56eb92e15ec195f9361b0842d101c1536799e527)
116 |
117 | [51 - Pull to Refresh Data with UIRefreshControl](../../tree/a6a6a5e1ccb679cae20a9db6e4d55744fe2bb05a)
118 |
119 | [52 - Add Video to Comment Table View](../../tree/2227b2bec1f27465c2cb643697f936468c9ccfdb)
120 |
121 | [53 - The Video Table View Controller](../../tree/19963eacb5c226427ae3095a9769c6c3609f103d)
122 |
123 | [54 - Deselect Row before Segue](../../tree/e3139ffcd6b576205842cf7025ff9d16d8570061)
124 |
125 | [55 - Project Description in Header View](../../tree/764dc72d7dce62f6733953f52b66464d1bfc7b85)
126 |
127 | [56 - Facebook Share Button](../../tree/97793adbe9faa485d42fbc29a723e3b64722208a)
128 |
129 | [57 - Background Image with Pattern](../../tree/c4a4f8db59f0933085ed69f2a83eccfedbe6c77d)
130 |
131 | [58 - Change Auth Messages to Notifications](../../tree/48bc438c497d2ec9a5b8b0cb9eb6e7ffad1f0c41)
132 |
133 | [59 - Auth View Controller Updates](../../tree/38e83eb0201977f5ff5cc2eef85e1cd2c29bb678)
134 |
135 | [60 - Update Launch Screen](../../tree/2d3e87046cd4c5b8cd1ad63205900f9c938f0dc2)
136 |
137 | [61 - Lecture List Table Branding](../../tree/758da085afccc930ae35b76b67eaceba914c2e51)
138 |
139 | [62 - Parent ID for Adding Comments](../../tree/1c2442d8bb219015c74ccdc6f69dcb71e7b5f8ad)
140 |
141 | [63 - Response Table View Controller](../../tree/5d2f31284e16cff6a190272d0f9ca955e7508568)
142 |
143 | [64 - Insert Response Comment](../../tree/d4910c4a5c8ecab190b68ef0b17e099107157775)
144 |
145 | [65 - Auto Adjusting Response Header View](../../tree/fea91707bf80ecb5d8eaa3d87d2e61c01e681f93)
146 |
147 | [66 - Update ScrollTo Functions](../../tree/9b8119377b5df8c7f4815dd517f8c670a69eb760)
148 |
149 | [67 - Comment Form Class](../../tree/b8e23f815dfcda82986bb180acedf789470c415a)
150 |
151 | [68-70 - Minor Code Changes](../../tree/ea7a7ba43113703409db786b87931eadc6bbccba)
152 |
153 |
154 |
155 |
156 |
157 |
158 |
--------------------------------------------------------------------------------
/Guides/Getting_Started.md:
--------------------------------------------------------------------------------
1 | #Django to iOS || Getting Started Guide
2 |
3 | ## System requirements
4 | - [Mac OS X](http://www.apple.com/osx/)
5 | - [Xcode](https://developer.apple.com/xcode/) version 6+
6 | - Carthage Installed. [Installation Guide](https://github.com/codingforentrepreneurs/Guides/blob/master/install_carthage.md)
7 | - Carthage Errors? Try using Cocoapods. [Installation Guide](https://github.com/codingforentrepreneurs/Guides/blob/master/install_cocoapods.md)
8 | - Django & Virtualenv Installed.
9 | - CFE [Video Tutorial](http://joincfe.com/projects/#setup)
10 | - CFE Github [Installation Guide](https://github.com/codingforentrepreneurs/Guides/blob/master/install_django_mac_linux.md)
11 |
12 |
13 |
14 |
15 | ### iOS
16 | 1. Create a new iOS Project:
17 | 1. Open `Xcode` > `File` > `New Project`
18 | 2. Select iOS Project template `Single View Application`, click `Next`
19 | 3. Fill in the following:
20 | ```
21 | Product Name: CFE
22 | Organization Name: Coding For Entrepreneurs
23 | Organization Identifier: com.codingforentrepreneurs
24 | ```
25 |
26 | 4. Select `Swift` as the Language
27 | 5. Deselect `Core Data` (unless you know how to use it of course)
28 | 6. Create in a location of your choice. For example:
29 | `Desktop`
30 | 7. This will create a new folder on your desktop based on the name of your project. In this example, it will read as `CFE`
31 |
32 |
33 |
34 | 2. Install `Alamofire`, `KeychainAccess`, and `SwiftyJSON`:
35 |
36 | Using Carthage, we're going to install these frameworks for our project. This is not the only way to install these frameworks but Carthage makes our life easy. Let's get started:
37 |
38 | 1. Create a new file called `Cartfile` with no extension in your project's directory. This is the same place you'll see your `.xcodeproj` file. In our example above, it will be `CFE.xcodeproj`.
39 |
40 | 2. In the cartfile, you'll add:
41 |
42 | ```
43 | github "Alamofire/Alamofire" >= 1.2
44 | github "SwiftyJSON/SwiftyJSON" >= 2.2
45 | github "kishikawakatsumi/KeychainAccess" >= 1.2.1
46 | ```
47 | *Note*: This github repositories have been tested by Carthage as working packages. If you use Carthage, there's a chance that other non-tested packages will fail to install properly.
48 |
49 | 3. Open the Terminal Application (Applications > Utilities > Terminal)
50 | 4. Navigate to our XCode Project folder (where `CFE.xcodeproj` is located):
51 |
52 | ```
53 | cd Desktop
54 | cd CFE
55 | # If you list out the directly you should see:
56 | $ ls
57 | Cartfile
58 | CFE
59 | CFE.xcodeproj
60 | CFETESTS
61 | ```
62 | 5. Run Carthage Update
63 |
64 | ```
65 | carthage update
66 | ```
67 |
68 | 6. Link Frameworks:
69 | 1. "Srvup" > "General" -> "Linked Frameworks and Libraries"
70 | 2. Add "Alamofire", "KeychainAccess", and "SwiftyJSON"
71 |
72 | 7. Add Compiling Scripts:
73 | 1. "Srvup" > "Build Phases" -> "+"
74 | 2. Enter the following:
75 | Shell: `/bin/sh`
76 | 1: `/usr/local/bin/carthage copy-frameworks`
77 | 3. Input Files:
78 | `$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework`
79 | `$(SRCROOT)/Carthage/Build/iOS/KeychainAccess.framework`
80 | `$(SRCROOT)/Carthage/Build/iOS/SwiftyJSON.framework`
81 |
82 |
83 |
84 |
85 | ### Django
86 | 1. Download a RESTful API Django Project:
87 | In this step, we download and install the "Srvup Rest Framework" project on github as our Django Starting point.
88 |
89 | This is a large project so if you want to learn how to build all parts visit the following:
90 | - Srvup Membership: A Django Project ([Tutorial](https://joincfe.com/projects/srvup-membership/) | [Code](https://github.com/codingforentrepreneurs/srvup-membership))
91 | - Srvup Rest Framework: A Django Rest Framework Course ([Tutorial](https://joincfe.com/projects/django-rest-framework/) | [Code](https://github.com/codingforentrepreneurs/srvup-rest-framework))
92 |
93 | To download, you have 3 options:
94 | 1. Add the Srvup Rest Framework project as a submodule to your project:
95 | ```
96 | git submodule add https://github.com/codingforentrepreneurs/srvup-rest-framework
97 | ```
98 | 2. Clone the Srvup Rest Framework anywhere on your computer:
99 | ```
100 | git clone https://github.com/codingforentrepreneurs/srvup-rest-framework
101 | ```
102 | 3. Download as a zip: [https://github.com/codingforentrepreneurs/srvup-membership/archive/master.zip](https://github.com/codingforentrepreneurs/srvup-membership/archive/master.zip)
103 |
104 |
105 | 2. Create a virtualenv & install requirements within your 'srvup-rest-framework' project:
106 | Assuming you downloaded/stored it on the desktop, you'd do the following:
107 | ```
108 | $ cd desktop
109 | $ cd srvup-rest-framework
110 | $ virtualenv .
111 | $ source bin/activate
112 | (srvup-rest-framework)$
113 |
114 | (srvup-rest-framework)$ ls
115 | LICENSE lib srvup.sublime-workspace
116 | README.md requirements.txt static
117 | bin src
118 | include srvup.sublime-project
119 |
120 | (srvup-rest-framework)$ pip install -r requirements.txt
121 | ```
122 |
123 | Don't have virtualenv installed? Choose one of these:
124 | - CFE [Video Tutorial](http://joincfe.com/projects/#setup)
125 | - CFE Github [Installation Guide](https://github.com/codingforentrepreneurs/Guides/blob/master/install_django_mac_linux.md)
126 |
127 | Don't have git installed? Install via Heroku Toolbelt - [http://toolbelt.heroku.com](http://toolbelt.heroku.com).
128 |
129 | * Note, if you ever notice the srvup-rest-framework is running poorly, try to update the submodule with: `git submodule update --remote --merge`
130 |
131 |
132 |
133 |
134 | 3. Create new Superuser & Run Django App:
135 | ```
136 | (srvup-rest-framework)$ cd src
137 |
138 | (srvup-rest-framework)$ ls
139 | accounts db_blank.sqlite3 notifications
140 | analytics db_github.sqlite3 srvup
141 | billing jquery_test templates
142 | comments manage.py videos
143 |
144 | (srvup-rest-framework)$ python manage.py createsuperuser
145 | Username: anythingelse
146 | Email: anything@gmail.com
147 | Password: 123
148 | Password (again): 123
149 | Customer created with id = XXXXXXXX
150 | Superuser created successfully.
151 |
152 | (srvup-rest-framework)$ python manage.py makemigrations
153 | No changes detected
154 |
155 | (srvup-rest-framework)$ python manage.py migrate
156 | Operations to perform:
157 | Synchronize unmigrated apps: staticfiles, corsheaders, messages, crispy_forms, rest_framework
158 | Apply all migrations: videos, billing, notifications, admin, sessions, auth, analytics, contenttypes, accounts, comments
159 | Synchronizing apps without migrations:
160 | Creating tables...
161 | Running deferred SQL...
162 | Installing custom SQL...
163 | Running migrations:
164 | No migrations to apply.
165 |
166 |
167 | (srvup-rest-framework)$ python manage.py runserver
168 |
169 | Performing system checks...
170 |
171 | System check identified no issues (0 silenced).
172 | July 01, 2015 - 10:10:10
173 | Django version 1.8.2, using settings 'srvup.settings'
174 | Starting development server at http://127.0.0.1:8000/
175 | Quit the server with CONTROL-C.
176 |
177 | ```
178 |
179 | Did it all work? If so, you're ready to go. If not, you might have to try installing again. Ensure each step is accurate.
180 |
181 |
182 |
183 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Source/ResponseSerialization.swift:
--------------------------------------------------------------------------------
1 | // Alamofire.swift
2 | //
3 | // Copyright (c) 2014–2015 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 | // MARK: String
26 |
27 | extension Request {
28 | /**
29 | Creates a response serializer that returns a string initialized from the response data with the specified string encoding.
30 |
31 | :param: encoding The string encoding. If `nil`, the string encoding will be determined from the server response, falling back to the default HTTP default character set, ISO-8859-1.
32 |
33 | :returns: A string response serializer.
34 | */
35 | public class func stringResponseSerializer(var encoding: NSStringEncoding? = nil) -> Serializer {
36 | return { _, response, data in
37 | if data == nil || data?.length == 0 {
38 | return (nil, nil)
39 | }
40 |
41 | if encoding == nil {
42 | if let encodingName = response?.textEncodingName {
43 | encoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(encodingName))
44 | }
45 | }
46 |
47 | let string = NSString(data: data!, encoding: encoding ?? NSISOLatin1StringEncoding)
48 |
49 | return (string, nil)
50 | }
51 | }
52 |
53 | /**
54 | Adds a handler to be called once the request has finished.
55 |
56 | :param: encoding The string encoding. If `nil`, the string encoding will be determined from the server response, falling back to the default HTTP default character set, ISO-8859-1.
57 | :param: completionHandler A closure to be executed once the request has finished. The closure takes 4 arguments: the URL request, the URL response, if one was received, the string, if one could be created from the URL response and data, and any error produced while creating the string.
58 |
59 | :returns: The request.
60 | */
61 | public func responseString(encoding: NSStringEncoding? = nil, completionHandler: (NSURLRequest, NSHTTPURLResponse?, String?, NSError?) -> Void) -> Self {
62 | return response(serializer: Request.stringResponseSerializer(encoding: encoding), completionHandler: { request, response, string, error in
63 | completionHandler(request, response, string as? String, error)
64 | })
65 | }
66 | }
67 |
68 | // MARK: - JSON
69 |
70 | extension Request {
71 | /**
72 | Creates a response serializer that returns a JSON object constructed from the response data using `NSJSONSerialization` with the specified reading options.
73 |
74 | :param: options The JSON serialization reading options. `.AllowFragments` by default.
75 |
76 | :returns: A JSON object response serializer.
77 | */
78 | public class func JSONResponseSerializer(options: NSJSONReadingOptions = .AllowFragments) -> Serializer {
79 | return { request, response, data in
80 | if data == nil || data?.length == 0 {
81 | return (nil, nil)
82 | }
83 |
84 | var serializationError: NSError?
85 | let JSON: AnyObject? = NSJSONSerialization.JSONObjectWithData(data!, options: options, error: &serializationError)
86 |
87 | return (JSON, serializationError)
88 | }
89 | }
90 |
91 | /**
92 | Adds a handler to be called once the request has finished.
93 |
94 | :param: options The JSON serialization reading options. `.AllowFragments` by default.
95 | :param: completionHandler A closure to be executed once the request has finished. The closure takes 4 arguments: the URL request, the URL response, if one was received, the JSON object, if one could be created from the URL response and data, and any error produced while creating the JSON object.
96 |
97 | :returns: The request.
98 | */
99 | public func responseJSON(options: NSJSONReadingOptions = .AllowFragments, completionHandler: (NSURLRequest, NSHTTPURLResponse?, AnyObject?, NSError?) -> Void) -> Self {
100 | return response(serializer: Request.JSONResponseSerializer(options: options), completionHandler: { request, response, JSON, error in
101 | completionHandler(request, response, JSON, error)
102 | })
103 | }
104 | }
105 |
106 | // MARK: - Property List
107 |
108 | extension Request {
109 | /**
110 | Creates a response serializer that returns an object constructed from the response data using `NSPropertyListSerialization` with the specified reading options.
111 |
112 | :param: options The property list reading options. `0` by default.
113 |
114 | :returns: A property list object response serializer.
115 | */
116 | public class func propertyListResponseSerializer(options: NSPropertyListReadOptions = 0) -> Serializer {
117 | return { request, response, data in
118 | if data == nil || data?.length == 0 {
119 | return (nil, nil)
120 | }
121 |
122 | var propertyListSerializationError: NSError?
123 | let plist: AnyObject? = NSPropertyListSerialization.propertyListWithData(data!, options: options, format: nil, error: &propertyListSerializationError)
124 |
125 | return (plist, propertyListSerializationError)
126 | }
127 | }
128 |
129 | /**
130 | Adds a handler to be called once the request has finished.
131 |
132 | :param: options The property list reading options. `0` by default.
133 | :param: completionHandler A closure to be executed once the request has finished. The closure takes 4 arguments: the URL request, the URL response, if one was received, the property list, if one could be created from the URL response and data, and any error produced while creating the property list.
134 |
135 | :returns: The request.
136 | */
137 | public func responsePropertyList(options: NSPropertyListReadOptions = 0, completionHandler: (NSURLRequest, NSHTTPURLResponse?, AnyObject?, NSError?) -> Void) -> Self {
138 | return response(serializer: Request.propertyListResponseSerializer(options: options), completionHandler: { request, response, plist, error in
139 | completionHandler(request, response, plist, error)
140 | })
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Source/Upload.swift:
--------------------------------------------------------------------------------
1 | // Alamofire.swift
2 | //
3 | // Copyright (c) 2014–2015 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 | extension Manager {
26 | private enum Uploadable {
27 | case Data(NSURLRequest, NSData)
28 | case File(NSURLRequest, NSURL)
29 | case Stream(NSURLRequest, NSInputStream)
30 | }
31 |
32 | private func upload(uploadable: Uploadable) -> Request {
33 | var uploadTask: NSURLSessionUploadTask!
34 | var HTTPBodyStream: NSInputStream?
35 |
36 | switch uploadable {
37 | case .Data(let request, let data):
38 | dispatch_sync(queue) {
39 | uploadTask = self.session.uploadTaskWithRequest(request, fromData: data)
40 | }
41 | case .File(let request, let fileURL):
42 | dispatch_sync(queue) {
43 | uploadTask = self.session.uploadTaskWithRequest(request, fromFile: fileURL)
44 | }
45 | case .Stream(let request, var stream):
46 | dispatch_sync(queue) {
47 | uploadTask = self.session.uploadTaskWithStreamedRequest(request)
48 | }
49 | HTTPBodyStream = stream
50 | }
51 |
52 | let request = Request(session: session, task: uploadTask)
53 | if HTTPBodyStream != nil {
54 | request.delegate.taskNeedNewBodyStream = { _, _ in
55 | return HTTPBodyStream
56 | }
57 | }
58 | delegate[request.delegate.task] = request.delegate
59 |
60 | if startRequestsImmediately {
61 | request.resume()
62 | }
63 |
64 | return request
65 | }
66 |
67 | // MARK: File
68 |
69 | /**
70 | Creates a request for uploading a file to the specified URL request.
71 |
72 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
73 |
74 | :param: URLRequest The URL request
75 | :param: file The file to upload
76 |
77 | :returns: The created upload request.
78 | */
79 | public func upload(URLRequest: URLRequestConvertible, file: NSURL) -> Request {
80 | return upload(.File(URLRequest.URLRequest, file))
81 | }
82 |
83 | /**
84 | Creates a request for uploading a file to the specified URL request.
85 |
86 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
87 |
88 | :param: method The HTTP method.
89 | :param: URLString The URL string.
90 | :param: file The file to upload
91 |
92 | :returns: The created upload request.
93 | */
94 | public func upload(method: Method, _ URLString: URLStringConvertible, file: NSURL) -> Request {
95 | return upload(URLRequest(method, URLString), file: file)
96 | }
97 |
98 | // MARK: Data
99 |
100 | /**
101 | Creates a request for uploading data to the specified URL request.
102 |
103 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
104 |
105 | :param: URLRequest The URL request
106 | :param: data The data to upload
107 |
108 | :returns: The created upload request.
109 | */
110 | public func upload(URLRequest: URLRequestConvertible, data: NSData) -> Request {
111 | return upload(.Data(URLRequest.URLRequest, data))
112 | }
113 |
114 | /**
115 | Creates a request for uploading data to the specified URL request.
116 |
117 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
118 |
119 | :param: method The HTTP method.
120 | :param: URLString The URL string.
121 | :param: data The data to upload
122 |
123 | :returns: The created upload request.
124 | */
125 | public func upload(method: Method, _ URLString: URLStringConvertible, data: NSData) -> Request {
126 | return upload(URLRequest(method, URLString), data: data)
127 | }
128 |
129 | // MARK: Stream
130 |
131 | /**
132 | Creates a request for uploading a stream to the specified URL request.
133 |
134 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
135 |
136 | :param: URLRequest The URL request
137 | :param: stream The stream to upload
138 |
139 | :returns: The created upload request.
140 | */
141 | public func upload(URLRequest: URLRequestConvertible, stream: NSInputStream) -> Request {
142 | return upload(.Stream(URLRequest.URLRequest, stream))
143 | }
144 |
145 | /**
146 | Creates a request for uploading a stream to the specified URL request.
147 |
148 | If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned.
149 |
150 | :param: method The HTTP method.
151 | :param: URLString The URL string.
152 | :param: stream The stream to upload.
153 |
154 | :returns: The created upload request.
155 | */
156 | public func upload(method: Method, _ URLString: URLStringConvertible, stream: NSInputStream) -> Request {
157 | return upload(URLRequest(method, URLString), stream: stream)
158 | }
159 | }
160 |
161 | // MARK: -
162 |
163 | extension Request {
164 |
165 | // MARK: - UploadTaskDelegate
166 |
167 | class UploadTaskDelegate: DataTaskDelegate {
168 | var uploadTask: NSURLSessionUploadTask? { return task as? NSURLSessionUploadTask }
169 | var uploadProgress: ((Int64, Int64, Int64) -> Void)!
170 |
171 | // MARK: - NSURLSessionTaskDelegate
172 |
173 | // MARK: Override Closures
174 |
175 | var taskDidSendBodyData: ((NSURLSession, NSURLSessionTask, Int64, Int64, Int64) -> Void)?
176 |
177 | // MARK: Delegate Methods
178 |
179 | func URLSession(session: NSURLSession, task: NSURLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {
180 | if taskDidSendBodyData != nil {
181 | taskDidSendBodyData!(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)
182 | } else {
183 | progress.totalUnitCount = totalBytesExpectedToSend
184 | progress.completedUnitCount = totalBytesSent
185 |
186 | uploadProgress?(bytesSent, totalBytesSent, totalBytesExpectedToSend)
187 | }
188 | }
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/Source/ios/Carthage/Checkouts/Alamofire/Tests/AuthenticationTests.swift:
--------------------------------------------------------------------------------
1 | // DownloadTests.swift
2 | //
3 | // Copyright (c) 2014–2015 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 Alamofire
24 | import Foundation
25 | import XCTest
26 |
27 | class AuthenticationTestCase: BaseTestCase {
28 | // MARK: Properties
29 |
30 | let user = "user"
31 | let password = "password"
32 | var URLString = ""
33 |
34 | // MARK: Setup and Teardown
35 |
36 | override func tearDown() {
37 | super.tearDown()
38 |
39 | let credentialStorage = NSURLCredentialStorage.sharedCredentialStorage()
40 | let allCredentials = credentialStorage.allCredentials as! [NSURLProtectionSpace: AnyObject]
41 |
42 | for (protectionSpace, credentials) in allCredentials {
43 | if let credentials = credentials as? [String: NSURLCredential] {
44 | for (user, credential) in credentials {
45 | credentialStorage.removeCredential(credential, forProtectionSpace: protectionSpace)
46 | }
47 | }
48 | }
49 | }
50 | }
51 |
52 | // MARK: -
53 |
54 | class BasicAuthenticationTestCase: AuthenticationTestCase {
55 | // MARK: Setup and Teardown
56 |
57 | override func setUp() {
58 | super.setUp()
59 | self.URLString = "http://httpbin.org/basic-auth/\(user)/\(password)"
60 | }
61 |
62 | // MARK: Tests
63 |
64 | func testHTTPBasicAuthenticationWithInvalidCredentials() {
65 | // Given
66 | let expectation = expectationWithDescription("\(self.URLString) 401")
67 |
68 | var request: NSURLRequest?
69 | var response: NSHTTPURLResponse?
70 | var data: AnyObject?
71 | var error: NSError?
72 |
73 | // When
74 | Alamofire.request(.GET, self.URLString)
75 | .authenticate(user: "invalid", password: "credentials")
76 | .response { responseRequest, responseResponse, responseData, responseError in
77 | request = responseRequest
78 | response = responseResponse
79 | data = responseData
80 | error = responseError
81 |
82 | expectation.fulfill()
83 | }
84 |
85 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
86 |
87 | // Then
88 | XCTAssertNotNil(request, "request should not be nil")
89 | XCTAssertNil(response, "response should be nil")
90 | XCTAssertNotNil(data, "data should not be nil")
91 | XCTAssertNotNil(error, "error should not be nil")
92 | XCTAssertEqual(error?.code ?? 0, -999, "error should be NSURLErrorDomain Code -999 'cancelled'")
93 | }
94 |
95 | func testHTTPBasicAuthenticationWithValidCredentials() {
96 | // Given
97 | let expectation = expectationWithDescription("\(self.URLString) 200")
98 |
99 | var request: NSURLRequest?
100 | var response: NSHTTPURLResponse?
101 | var data: AnyObject?
102 | var error: NSError?
103 |
104 | // When
105 | Alamofire.request(.GET, self.URLString)
106 | .authenticate(user: self.user, password: self.password)
107 | .response { responseRequest, responseResponse, responseData, responseError in
108 | request = responseRequest
109 | response = responseResponse
110 | data = responseData
111 | error = responseError
112 |
113 | expectation.fulfill()
114 | }
115 |
116 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
117 |
118 | // Then
119 | XCTAssertNotNil(request, "request should not be nil")
120 | XCTAssertNotNil(response, "response should not be nil")
121 | XCTAssertEqual(response?.statusCode ?? 0, 200, "response status code should be 200")
122 | XCTAssertNotNil(data, "data should not be nil")
123 | XCTAssertNil(error, "error should be nil")
124 | }
125 | }
126 |
127 | // MARK: -
128 |
129 | class HTTPDigestAuthenticationTestCase: AuthenticationTestCase {
130 | // MARK: Properties
131 |
132 | let qop = "auth"
133 |
134 | // MARK: Setup and Teardown
135 |
136 | override func setUp() {
137 | super.setUp()
138 | self.URLString = "http://httpbin.org/digest-auth/\(qop)/\(user)/\(password)"
139 | }
140 |
141 | // MARK: Tests
142 |
143 | func testHTTPDigestAuthenticationWithInvalidCredentials() {
144 | // Given
145 | let expectation = expectationWithDescription("\(self.URLString) 401")
146 |
147 | var request: NSURLRequest?
148 | var response: NSHTTPURLResponse?
149 | var data: AnyObject?
150 | var error: NSError?
151 |
152 | // When
153 | Alamofire.request(.GET, self.URLString)
154 | .authenticate(user: "invalid", password: "credentials")
155 | .response { responseRequest, responseResponse, responseData, responseError in
156 | request = responseRequest
157 | response = responseResponse
158 | data = responseData
159 | error = responseError
160 |
161 | expectation.fulfill()
162 | }
163 |
164 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
165 |
166 | // Then
167 | XCTAssertNotNil(request, "request should not be nil")
168 | XCTAssertNil(response, "response should be nil")
169 | XCTAssertNotNil(data, "data should not be nil")
170 | XCTAssertNotNil(error, "error should not be nil")
171 | XCTAssertEqual(error?.code ?? 0, -999, "error should be NSURLErrorDomain Code -999 'cancelled'")
172 | }
173 |
174 | func testHTTPDigestAuthenticationWithValidCredentials() {
175 | // Given
176 | let expectation = expectationWithDescription("\(self.URLString) 200")
177 |
178 | var request: NSURLRequest?
179 | var response: NSHTTPURLResponse?
180 | var data: AnyObject?
181 | var error: NSError?
182 |
183 | // When
184 | Alamofire.request(.GET, self.URLString)
185 | .authenticate(user: self.user, password: self.password)
186 | .response { responseRequest, responseResponse, responseData, responseError in
187 | request = responseRequest
188 | response = responseResponse
189 | data = responseData
190 | error = responseError
191 |
192 | expectation.fulfill()
193 | }
194 |
195 | waitForExpectationsWithTimeout(self.defaultTimeout, handler: nil)
196 |
197 | // Then
198 | XCTAssertNotNil(request, "request should not be nil")
199 | XCTAssertNotNil(response, "response should not be nil")
200 | XCTAssertEqual(response?.statusCode ?? 0, 200, "response status code should be 200")
201 | XCTAssertNotNil(data, "data should not be nil")
202 | XCTAssertNil(error, "error should be nil")
203 | }
204 | }
205 |
--------------------------------------------------------------------------------