├── .gitignore
├── .swift-version
├── Example
├── FayeSwift.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── FayeSwift-Example.xcscheme
│ └── xcuserdata
│ │ └── haris.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── FayeSwift.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── haris.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── FayeSwift
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ └── ViewController.swift
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Local Podspecs
│ │ └── FayeSwift.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcuserdata
│ │ │ └── haris.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── Pods-FayeSwift_Example.xcscheme
│ │ │ ├── Pods-FayeSwift_Tests.xcscheme
│ │ │ ├── Starscream.xcscheme
│ │ │ ├── SwiftyJSON.xcscheme
│ │ │ └── xcschememanagement.plist
│ ├── Starscream
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── SSLSecurity.swift
│ │ │ └── WebSocket.swift
│ ├── SwiftyJSON
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ └── SwiftyJSON.swift
│ └── Target Support Files
│ │ ├── FayeSwift
│ │ ├── FayeSwift-dummy.m
│ │ ├── FayeSwift-prefix.pch
│ │ ├── FayeSwift-umbrella.h
│ │ ├── FayeSwift.modulemap
│ │ ├── FayeSwift.xcconfig
│ │ └── Info.plist
│ │ ├── Pods-FayeSwift_Example
│ │ ├── Info.plist
│ │ ├── Pods-FayeSwift_Example-acknowledgements.markdown
│ │ ├── Pods-FayeSwift_Example-acknowledgements.plist
│ │ ├── Pods-FayeSwift_Example-dummy.m
│ │ ├── Pods-FayeSwift_Example-frameworks.sh
│ │ ├── Pods-FayeSwift_Example-resources.sh
│ │ ├── Pods-FayeSwift_Example-umbrella.h
│ │ ├── Pods-FayeSwift_Example.debug.xcconfig
│ │ ├── Pods-FayeSwift_Example.modulemap
│ │ └── Pods-FayeSwift_Example.release.xcconfig
│ │ ├── Pods-FayeSwift_Tests
│ │ ├── Info.plist
│ │ ├── Pods-FayeSwift_Tests-acknowledgements.markdown
│ │ ├── Pods-FayeSwift_Tests-acknowledgements.plist
│ │ ├── Pods-FayeSwift_Tests-dummy.m
│ │ ├── Pods-FayeSwift_Tests-frameworks.sh
│ │ ├── Pods-FayeSwift_Tests-resources.sh
│ │ ├── Pods-FayeSwift_Tests-umbrella.h
│ │ ├── Pods-FayeSwift_Tests.debug.xcconfig
│ │ ├── Pods-FayeSwift_Tests.modulemap
│ │ └── Pods-FayeSwift_Tests.release.xcconfig
│ │ ├── Starscream
│ │ ├── Info.plist
│ │ ├── Starscream-dummy.m
│ │ ├── Starscream-prefix.pch
│ │ ├── Starscream-umbrella.h
│ │ ├── Starscream.modulemap
│ │ └── Starscream.xcconfig
│ │ └── SwiftyJSON
│ │ ├── Info.plist
│ │ ├── SwiftyJSON-dummy.m
│ │ ├── SwiftyJSON-prefix.pch
│ │ ├── SwiftyJSON-umbrella.h
│ │ ├── SwiftyJSON.modulemap
│ │ └── SwiftyJSON.xcconfig
├── Tests
│ ├── Info.plist
│ └── Tests.swift
└── build
│ └── Pods.build
│ └── Debug-iphoneos
│ ├── Pods-FayeSwift_Example.build
│ ├── DerivedSources
│ │ └── Pods_FayeSwift_Example_vers.c
│ ├── Objects-normal
│ │ ├── arm64
│ │ │ └── Pods_FayeSwift_Example.LinkFileList
│ │ └── armv7
│ │ │ └── Pods_FayeSwift_Example.LinkFileList
│ ├── Pods_FayeSwift_Example-all-non-framework-target-headers.hmap
│ ├── Pods_FayeSwift_Example-all-target-headers.hmap
│ ├── Pods_FayeSwift_Example-generated-files.hmap
│ ├── Pods_FayeSwift_Example-own-target-headers.hmap
│ ├── Pods_FayeSwift_Example-project-headers.hmap
│ ├── Pods_FayeSwift_Example.hmap
│ ├── dgph
│ └── module.modulemap
│ ├── Pods-FayeSwift_Tests.build
│ ├── DerivedSources
│ │ └── Pods_FayeSwift_Tests_vers.c
│ ├── Objects-normal
│ │ ├── arm64
│ │ │ └── Pods_FayeSwift_Tests.LinkFileList
│ │ └── armv7
│ │ │ └── Pods_FayeSwift_Tests.LinkFileList
│ ├── Pods_FayeSwift_Tests-all-non-framework-target-headers.hmap
│ ├── Pods_FayeSwift_Tests-all-target-headers.hmap
│ ├── Pods_FayeSwift_Tests-generated-files.hmap
│ ├── Pods_FayeSwift_Tests-own-target-headers.hmap
│ ├── Pods_FayeSwift_Tests-project-headers.hmap
│ ├── Pods_FayeSwift_Tests.hmap
│ ├── dgph
│ └── module.modulemap
│ ├── Starscream.build
│ ├── DerivedSources
│ │ └── Starscream_vers.c
│ ├── Objects-normal
│ │ ├── arm64
│ │ │ ├── Starscream-OutputFileMap.json
│ │ │ └── Starscream.LinkFileList
│ │ └── armv7
│ │ │ ├── Starscream-OutputFileMap.json
│ │ │ └── Starscream.LinkFileList
│ ├── Starscream-all-non-framework-target-headers.hmap
│ ├── Starscream-all-target-headers.hmap
│ ├── Starscream-generated-files.hmap
│ ├── Starscream-own-target-headers.hmap
│ ├── Starscream-project-headers.hmap
│ ├── Starscream.hmap
│ ├── dgph
│ ├── module.modulemap
│ ├── swift-overrides.hmap
│ ├── unextended-module-overlay.yaml
│ └── unextended-module.modulemap
│ └── SwiftyJSON.build
│ ├── DerivedSources
│ └── SwiftyJSON_vers.c
│ ├── Objects-normal
│ ├── arm64
│ │ ├── SwiftyJSON-OutputFileMap.json
│ │ └── SwiftyJSON.LinkFileList
│ └── armv7
│ │ ├── SwiftyJSON-OutputFileMap.json
│ │ └── SwiftyJSON.LinkFileList
│ ├── SwiftyJSON-all-non-framework-target-headers.hmap
│ ├── SwiftyJSON-all-target-headers.hmap
│ ├── SwiftyJSON-generated-files.hmap
│ ├── SwiftyJSON-own-target-headers.hmap
│ ├── SwiftyJSON-project-headers.hmap
│ ├── SwiftyJSON.hmap
│ ├── dgph
│ ├── module.modulemap
│ ├── swift-overrides.hmap
│ ├── unextended-module-overlay.yaml
│ └── unextended-module.modulemap
├── FayeSwift.podspec
├── License
├── Package.swift
├── Pod
├── Assets
│ └── .gitkeep
└── Classes
│ └── .gitkeep
├── Readme.md
├── Sources
├── FayeClient+Action.swift
├── FayeClient+Bayuex.swift
├── FayeClient+Helper.swift
├── FayeClient+Parsing.swift
├── FayeClient+Subscriptions.swift
├── FayeClient+Transport.swift
├── FayeClient.swift
├── FayeClientDelegate.swift
├── FayeSubscriptionModel.swift
├── NSError+Helper.swift
├── StringExtensions.swift
├── Transport.swift
└── WebsocketTransport.swift
├── _Pods.xcodeproj
├── faye_publish.js
├── faye_server.js
├── package.json
└── swift-logo.png
/.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 |
23 | #Carthage
24 | Carthage/Build
25 |
26 | #Node modules
27 | node_modules
28 |
--------------------------------------------------------------------------------
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.0
2 |
--------------------------------------------------------------------------------
/Example/FayeSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/FayeSwift.xcodeproj/xcshareddata/xcschemes/FayeSwift-Example.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 |
67 |
68 |
78 |
80 |
86 |
87 |
88 |
89 |
90 |
91 |
97 |
99 |
105 |
106 |
107 |
108 |
110 |
111 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/Example/FayeSwift.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SuppressBuildableAutocreation
6 |
7 | 607FACCF1AFB9204008FA782
8 |
9 | primary
10 |
11 |
12 | 607FACE41AFB9204008FA782
13 |
14 | primary
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Example/FayeSwift.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/FayeSwift.xcworkspace/xcuserdata/haris.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/FayeSwift.xcworkspace/xcuserdata/haris.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Example/FayeSwift/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // FayeSwift
4 | //
5 | // Created by Haris Amin on 01/25/2016.
6 | // Copyright (c) 2016 Haris Amin. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Example/FayeSwift/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Example/FayeSwift/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 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Example/FayeSwift/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Example/FayeSwift/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Example/FayeSwift/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // FayeSwift
4 | //
5 | // Created by Haris Amin on 01/25/2016.
6 | // Copyright (c) 2016 Haris Amin. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import FayeSwift
11 |
12 | class ViewController: UIViewController, UITextFieldDelegate, FayeClientDelegate {
13 |
14 | @IBOutlet weak var textField: UITextField!
15 | @IBOutlet weak var textView: UITextView!
16 |
17 | /// Example FayeClient
18 | let client:FayeClient = FayeClient(aFayeURLString: "ws://localhost:5222/faye", channel: "/cool")
19 |
20 | // MARK:
21 | // MARK: Lifecycle
22 |
23 | override func viewDidLoad() {
24 | super.viewDidLoad()
25 |
26 | client.delegate = self;
27 | client.transportHeaders = ["X-Custom-Header": "Custom Value"]
28 | client.connectToServer()
29 |
30 | let channelBlock:ChannelSubscriptionBlock = {(messageDict) -> Void in
31 | if let text = messageDict["text"] {
32 | print("Here is the Block message: \(text)")
33 | }
34 | }
35 | _ = client.subscribeToChannel("/awesome", block: channelBlock)
36 |
37 | let delayTime = DispatchTime.now() + Double(Int64(5 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
38 | DispatchQueue.main.asyncAfter(deadline: delayTime) {
39 | self.client.unsubscribeFromChannel("/awesome")
40 | }
41 |
42 | DispatchQueue.main.asyncAfter(deadline: delayTime) {
43 | let model = FayeSubscriptionModel(subscription: "/awesome", clientId: nil)
44 |
45 | _ = self.client.subscribeToChannel(model, block: { [unowned self] messages in
46 | print("awesome response: \(messages)")
47 |
48 | self.client.sendPing("Ping".data(using: String.Encoding.utf8)!, completion: {
49 | print("got pong")
50 | })
51 | })
52 | }
53 | }
54 |
55 | // MARK:
56 | // MARK: TextfieldDelegate
57 |
58 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
59 | client.sendMessage(["text" : textField.text!], channel: "/cool")
60 | return false;
61 | }
62 |
63 | // MARK:
64 | // MARK: FayeClientDelegate
65 |
66 | func connectedtoser(_ client: FayeClient) {
67 | print("Connected to Faye server")
68 | }
69 |
70 | func connectionFailed(_ client: FayeClient) {
71 | print("Failed to connect to Faye server!")
72 | }
73 |
74 | func disconnectedFromServer(_ client: FayeClient) {
75 | print("Disconnected from Faye server")
76 | }
77 |
78 | func didSubscribeToChannel(_ client: FayeClient, channel: String) {
79 | print("Subscribed to channel \(channel)")
80 | }
81 |
82 | func didUnsubscribeFromChannel(_ client: FayeClient, channel: String) {
83 | print("Unsubscribed from channel \(channel)")
84 | }
85 |
86 | func subscriptionFailedWithError(_ client: FayeClient, error: subscriptionError) {
87 | print("Subscription failed")
88 | }
89 |
90 | func messageReceived(_ client: FayeClient, messageDict: NSDictionary, channel: String) {
91 | if let text = messageDict["text"] {
92 | print("Here is the message: \(text)")
93 | }
94 | }
95 |
96 | func pongReceived(_ client: FayeClient) {
97 | print("pong")
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 |
3 | use_frameworks!
4 | inhibit_all_warnings!
5 | platform :ios, '8.0'
6 |
7 | target 'FayeSwift_Example' do
8 | pod 'FayeSwift', :path => '../'
9 | end
10 |
11 | target 'FayeSwift_Tests' do
12 | pod 'FayeSwift', :path => '../'
13 | end
14 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FayeSwift (0.2.0):
3 | - Starscream (~> 2.0)
4 | - SwiftyJSON (~> 3.1)
5 | - Starscream (2.0.2)
6 | - SwiftyJSON (3.1.3)
7 |
8 | DEPENDENCIES:
9 | - FayeSwift (from `../`)
10 |
11 | EXTERNAL SOURCES:
12 | FayeSwift:
13 | :path: "../"
14 |
15 | SPEC CHECKSUMS:
16 | FayeSwift: b7889c3df7d9b37fa88253a4c9fbb6fcb4404993
17 | Starscream: 6c135a34e0a6e60cedaa0b30db67a4c05cf7cd38
18 | SwiftyJSON: 38a8ea2006779c0fc4c310cb2ee8195327740faf
19 |
20 | PODFILE CHECKSUM: cda739a33c3a43c81b405d9eee2a84c5b9d19f1b
21 |
22 | COCOAPODS: 1.1.1
23 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/FayeSwift.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "FayeSwift",
3 | "version": "0.2.0",
4 | "summary": "A pure Swift Faye (Bayeux) Client",
5 | "description": "A Pure Swift Client Library for the Faye (Bayeux/Comet) Pub-Sub messaging server.\nThis client has been tested with the Faye (http://faye.jcoglan.com) implementation of the\nBayeux protocol. Currently only supports Websocket transport.",
6 | "homepage": "https://github.com/hamin/FayeSwift",
7 | "license": "MIT",
8 | "authors": {
9 | "Haris Amin": "aminharis7@gmail.com"
10 | },
11 | "source": {
12 | "git": "https://github.com/hamin/FayeSwift.git",
13 | "tag": "0.2.0"
14 | },
15 | "social_media_url": "https://twitter.com/harisamin",
16 | "requires_arc": true,
17 | "platforms": {
18 | "osx": "10.9",
19 | "ios": "8.0",
20 | "tvos": "9.0"
21 | },
22 | "source_files": "Sources/*.swift",
23 | "dependencies": {
24 | "Starscream": [
25 | "~> 2.0"
26 | ],
27 | "SwiftyJSON": [
28 | "~> 3.1"
29 | ]
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FayeSwift (0.2.0):
3 | - Starscream (~> 2.0)
4 | - SwiftyJSON (~> 3.1)
5 | - Starscream (2.0.2)
6 | - SwiftyJSON (3.1.3)
7 |
8 | DEPENDENCIES:
9 | - FayeSwift (from `../`)
10 |
11 | EXTERNAL SOURCES:
12 | FayeSwift:
13 | :path: "../"
14 |
15 | SPEC CHECKSUMS:
16 | FayeSwift: b7889c3df7d9b37fa88253a4c9fbb6fcb4404993
17 | Starscream: 6c135a34e0a6e60cedaa0b30db67a4c05cf7cd38
18 | SwiftyJSON: 38a8ea2006779c0fc4c310cb2ee8195327740faf
19 |
20 | PODFILE CHECKSUM: cda739a33c3a43c81b405d9eee2a84c5b9d19f1b
21 |
22 | COCOAPODS: 1.1.1
23 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/Pods-FayeSwift_Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
66 |
67 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/Pods-FayeSwift_Tests.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
66 |
67 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/Starscream.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/SwiftyJSON.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcuserdata/haris.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | FayeSwift.xcscheme
8 |
9 | isShown
10 |
11 |
12 | Pods-FayeSwift_Example.xcscheme
13 |
14 | isShown
15 |
16 |
17 | Pods-FayeSwift_Tests.xcscheme
18 |
19 | isShown
20 |
21 |
22 | Starscream.xcscheme
23 |
24 | isShown
25 |
26 |
27 | SwiftyJSON.xcscheme
28 |
29 | isShown
30 |
31 |
32 |
33 | SuppressBuildableAutocreation
34 |
35 | 5C1F57BFFCD92868AF3442E38186A537
36 |
37 | primary
38 |
39 |
40 | 5C48D6CAB4FBFA5BB8EFCD0C0947DF9D
41 |
42 | primary
43 |
44 |
45 | 90E7E0DDBF3230E4EE01FAA926FC8C1C
46 |
47 | primary
48 |
49 |
50 | BC253BAFB43EC448547D4A2394ACD810
51 |
52 | primary
53 |
54 |
55 | BCC8AE0600D381881B2B45F29D3A3294
56 |
57 | primary
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/Example/Pods/Starscream/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | Copyright (c) 2014-2016 Dalton Cherry.
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 |
9 | 1. Definitions.
10 |
11 | "License" shall mean the terms and conditions for use, reproduction,
12 | and distribution as defined by Sections 1 through 9 of this document.
13 |
14 | "Licensor" shall mean the copyright owner or entity authorized by
15 | the copyright owner that is granting the License.
16 |
17 | "Legal Entity" shall mean the union of the acting entity and all
18 | other entities that control, are controlled by, or are under common
19 | control with that entity. For the purposes of this definition,
20 | "control" means (i) the power, direct or indirect, to cause the
21 | direction or management of such entity, whether by contract or
22 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | outstanding shares, or (iii) beneficial ownership of such entity.
24 |
25 | "You" (or "Your") shall mean an individual or Legal Entity
26 | exercising permissions granted by this License.
27 |
28 | "Source" form shall mean the preferred form for making modifications,
29 | including but not limited to software source code, documentation
30 | source, and configuration files.
31 |
32 | "Object" form shall mean any form resulting from mechanical
33 | transformation or translation of a Source form, including but
34 | not limited to compiled object code, generated documentation,
35 | and conversions to other media types.
36 |
37 | "Work" shall mean the work of authorship, whether in Source or
38 | Object form, made available under the License, as indicated by a
39 | copyright notice that is included in or attached to the work
40 | (an example is provided in the Appendix below).
41 |
42 | "Derivative Works" shall mean any work, whether in Source or Object
43 | form, that is based on (or derived from) the Work and for which the
44 | editorial revisions, annotations, elaborations, or other modifications
45 | represent, as a whole, an original work of authorship. For the purposes
46 | of this License, Derivative Works shall not include works that remain
47 | separable from, or merely link (or bind by name) to the interfaces of,
48 | the Work and Derivative Works thereof.
49 |
50 | "Contribution" shall mean any work of authorship, including
51 | the original version of the Work and any modifications or additions
52 | to that Work or Derivative Works thereof, that is intentionally
53 | submitted to Licensor for inclusion in the Work by the copyright owner
54 | or by an individual or Legal Entity authorized to submit on behalf of
55 | the copyright owner. For the purposes of this definition, "submitted"
56 | means any form of electronic, verbal, or written communication sent
57 | to the Licensor or its representatives, including but not limited to
58 | communication on electronic mailing lists, source code control systems,
59 | and issue tracking systems that are managed by, or on behalf of, the
60 | Licensor for the purpose of discussing and improving the Work, but
61 | excluding communication that is conspicuously marked or otherwise
62 | designated in writing by the copyright owner as "Not a Contribution."
63 |
64 | "Contributor" shall mean Licensor and any individual or Legal Entity
65 | on behalf of whom a Contribution has been received by Licensor and
66 | subsequently incorporated within the Work.
67 |
68 | 2. Grant of Copyright License. Subject to the terms and conditions of
69 | this License, each Contributor hereby grants to You a perpetual,
70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | copyright license to reproduce, prepare Derivative Works of,
72 | publicly display, publicly perform, sublicense, and distribute the
73 | Work and such Derivative Works in Source or Object form.
74 |
75 | 3. Grant of Patent License. Subject to the terms and conditions of
76 | this License, each Contributor hereby grants to You a perpetual,
77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | (except as stated in this section) patent license to make, have made,
79 | use, offer to sell, sell, import, and otherwise transfer the Work,
80 | where such license applies only to those patent claims licensable
81 | by such Contributor that are necessarily infringed by their
82 | Contribution(s) alone or by combination of their Contribution(s)
83 | with the Work to which such Contribution(s) was submitted. If You
84 | institute patent litigation against any entity (including a
85 | cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | or a Contribution incorporated within the Work constitutes direct
87 | or contributory patent infringement, then any patent licenses
88 | granted to You under this License for that Work shall terminate
89 | as of the date such litigation is filed.
90 |
91 | 4. Redistribution. You may reproduce and distribute copies of the
92 | Work or Derivative Works thereof in any medium, with or without
93 | modifications, and in Source or Object form, provided that You
94 | meet the following conditions:
95 |
96 | (a) You must give any other recipients of the Work or
97 | Derivative Works a copy of this License; and
98 |
99 | (b) You must cause any modified files to carry prominent notices
100 | stating that You changed the files; and
101 |
102 | (c) You must retain, in the Source form of any Derivative Works
103 | that You distribute, all copyright, patent, trademark, and
104 | attribution notices from the Source form of the Work,
105 | excluding those notices that do not pertain to any part of
106 | the Derivative Works; and
107 |
108 | (d) If the Work includes a "NOTICE" text file as part of its
109 | distribution, then any Derivative Works that You distribute must
110 | include a readable copy of the attribution notices contained
111 | within such NOTICE file, excluding those notices that do not
112 | pertain to any part of the Derivative Works, in at least one
113 | of the following places: within a NOTICE text file distributed
114 | as part of the Derivative Works; within the Source form or
115 | documentation, if provided along with the Derivative Works; or,
116 | within a display generated by the Derivative Works, if and
117 | wherever such third-party notices normally appear. The contents
118 | of the NOTICE file are for informational purposes only and
119 | do not modify the License. You may add Your own attribution
120 | notices within Derivative Works that You distribute, alongside
121 | or as an addendum to the NOTICE text from the Work, provided
122 | that such additional attribution notices cannot be construed
123 | as modifying the License.
124 |
125 | You may add Your own copyright statement to Your modifications and
126 | may provide additional or different license terms and conditions
127 | for use, reproduction, or distribution of Your modifications, or
128 | for any such Derivative Works as a whole, provided Your use,
129 | reproduction, and distribution of the Work otherwise complies with
130 | the conditions stated in this License.
131 |
132 | 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | any Contribution intentionally submitted for inclusion in the Work
134 | by You to the Licensor shall be under the terms and conditions of
135 | this License, without any additional terms or conditions.
136 | Notwithstanding the above, nothing herein shall supersede or modify
137 | the terms of any separate license agreement you may have executed
138 | with Licensor regarding such Contributions.
139 |
140 | 6. Trademarks. This License does not grant permission to use the trade
141 | names, trademarks, service marks, or product names of the Licensor,
142 | except as required for reasonable and customary use in describing the
143 | origin of the Work and reproducing the content of the NOTICE file.
144 |
145 | 7. Disclaimer of Warranty. Unless required by applicable law or
146 | agreed to in writing, Licensor provides the Work (and each
147 | Contributor provides its Contributions) on an "AS IS" BASIS,
148 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | implied, including, without limitation, any warranties or conditions
150 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | PARTICULAR PURPOSE. You are solely responsible for determining the
152 | appropriateness of using or redistributing the Work and assume any
153 | risks associated with Your exercise of permissions under this License.
154 |
155 | 8. Limitation of Liability. In no event and under no legal theory,
156 | whether in tort (including negligence), contract, or otherwise,
157 | unless required by applicable law (such as deliberate and grossly
158 | negligent acts) or agreed to in writing, shall any Contributor be
159 | liable to You for damages, including any direct, indirect, special,
160 | incidental, or consequential damages of any character arising as a
161 | result of this License or out of the use or inability to use the
162 | Work (including but not limited to damages for loss of goodwill,
163 | work stoppage, computer failure or malfunction, or any and all
164 | other commercial damages or losses), even if such Contributor
165 | has been advised of the possibility of such damages.
166 |
167 | 9. Accepting Warranty or Additional Liability. While redistributing
168 | the Work or Derivative Works thereof, You may choose to offer,
169 | and charge a fee for, acceptance of support, warranty, indemnity,
170 | or other liability obligations and/or rights consistent with this
171 | License. However, in accepting such obligations, You may act only
172 | on Your own behalf and on Your sole responsibility, not on behalf
173 | of any other Contributor, and only if You agree to indemnify,
174 | defend, and hold each Contributor harmless for any liability
175 | incurred by, or claims asserted against, such Contributor by reason
176 | of your accepting any such warranty or additional liability.
--------------------------------------------------------------------------------
/Example/Pods/Starscream/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | Starscream is a conforming WebSocket ([RFC 6455](http://tools.ietf.org/html/rfc6455)) client library in Swift for iOS and OSX.
4 |
5 | It's Objective-C counter part can be found here: [Jetfire](https://github.com/acmacalister/jetfire)
6 |
7 | ## Features
8 |
9 | - Conforms to all of the base [Autobahn test suite](http://autobahn.ws/testsuite/).
10 | - Nonblocking. Everything happens in the background, thanks to GCD.
11 | - TLS/WSS support.
12 | - Simple concise codebase at just a few hundred LOC.
13 |
14 | ## Swift 2.3
15 |
16 | See release/tag 1.1.4 for Swift 2.3 support.
17 |
18 | ## Example
19 |
20 | First thing is to import the framework. See the Installation instructions on how to add the framework to your project.
21 |
22 | ```swift
23 | import Starscream
24 | ```
25 |
26 | Once imported, you can open a connection to your WebSocket server. Note that `socket` is probably best as a property, so it doesn't get deallocated right after being setup.
27 |
28 | ```swift
29 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!)
30 | socket.delegate = self
31 | socket.connect()
32 | ```
33 |
34 | After you are connected, there are some delegate methods that we need to implement.
35 |
36 | ### websocketDidConnect
37 |
38 | websocketDidConnect is called as soon as the client connects to the server.
39 |
40 | ```swift
41 | func websocketDidConnect(socket: WebSocket) {
42 | print("websocket is connected")
43 | }
44 | ```
45 |
46 | ### websocketDidDisconnect
47 |
48 | websocketDidDisconnect is called as soon as the client is disconnected from the server.
49 |
50 | ```swift
51 | func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
52 | print("websocket is disconnected: \(error?.localizedDescription)")
53 | }
54 | ```
55 |
56 | ### websocketDidReceiveMessage
57 |
58 | websocketDidReceiveMessage is called when the client gets a text frame from the connection.
59 |
60 | ```swift
61 | func websocketDidReceiveMessage(socket: WebSocket, text: String) {
62 | print("got some text: \(text)")
63 | }
64 | ```
65 |
66 | ### websocketDidReceiveData
67 |
68 | websocketDidReceiveData is called when the client gets a binary frame from the connection.
69 |
70 | ```swift
71 | func websocketDidReceiveData(socket: WebSocket, data: Data) {
72 | print("got some data: \(data.count)")
73 | }
74 | ```
75 |
76 | ### Optional: websocketDidReceivePong *(required protocol: WebSocketPongDelegate)*
77 |
78 | websocketDidReceivePong is called when the client gets a pong response from the connection. You need to implement the WebSocketPongDelegate protocol and set an additional delegate, eg: ` socket.pongDelegate = self`
79 |
80 | ```swift
81 | func websocketDidReceivePong(socket: WebSocket, data: Data?) {
82 | print("Got pong! Maybe some data: \(data?.count)")
83 | }
84 | ```
85 |
86 | Or you can use closures.
87 |
88 | ```swift
89 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!)
90 | //websocketDidConnect
91 | socket.onConnect = {
92 | print("websocket is connected")
93 | }
94 | //websocketDidDisconnect
95 | socket.onDisconnect = { (error: NSError?) in
96 | print("websocket is disconnected: \(error?.localizedDescription)")
97 | }
98 | //websocketDidReceiveMessage
99 | socket.onText = { (text: String) in
100 | print("got some text: \(text)")
101 | }
102 | //websocketDidReceiveData
103 | socket.onData = { (data: Data) in
104 | print("got some data: \(data.count)")
105 | }
106 | //you could do onPong as well.
107 | socket.connect()
108 | ```
109 |
110 | One more: you can listen to socket connection and disconnection via notifications. Starscream posts `WebsocketDidConnectNotification` and `WebsocketDidDisconnectNotification`. You can find an `NSError` that caused the disconection by accessing `WebsocketDisconnectionErrorKeyName` on notification `userInfo`.
111 |
112 |
113 | ## The delegate methods give you a simple way to handle data from the server, but how do you send data?
114 |
115 | ### write a binary frame
116 |
117 | The writeData method gives you a simple way to send `Data` (binary) data to the server.
118 |
119 | ```swift
120 | socket.write(data: data) //write some Data over the socket!
121 | ```
122 |
123 | ### write a string frame
124 |
125 | The writeString method is the same as writeData, but sends text/string.
126 |
127 | ```swift
128 | socket.write(string: "Hi Server!") //example on how to write text over the socket!
129 | ```
130 |
131 | ### write a ping frame
132 |
133 | The writePing method is the same as write, but sends a ping control frame.
134 |
135 | ```swift
136 | socket.write(ping: Data()) //example on how to write a ping control frame over the socket!
137 | ```
138 |
139 | ### disconnect
140 |
141 | The disconnect method does what you would expect and closes the socket.
142 |
143 | ```swift
144 | socket.disconnect()
145 | ```
146 |
147 | ### isConnected
148 |
149 | Returns if the socket is connected or not.
150 |
151 | ```swift
152 | if socket.isConnected {
153 | // do cool stuff.
154 | }
155 | ```
156 |
157 | ### Custom Headers
158 |
159 | You can also override the default websocket headers with your own custom ones like so:
160 |
161 | ```swift
162 | socket.headers["Sec-WebSocket-Protocol"] = "someother protocols"
163 | socket.headers["Sec-WebSocket-Version"] = "14"
164 | socket.headers["My-Awesome-Header"] = "Everything is Awesome!"
165 | ```
166 |
167 | ### Protocols
168 |
169 | If you need to specify a protocol, simple add it to the init:
170 |
171 | ```swift
172 | //chat and superchat are the example protocols here
173 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!, protocols: ["chat","superchat"])
174 | socket.delegate = self
175 | socket.connect()
176 | ```
177 |
178 | ### Self Signed SSL and VOIP
179 |
180 | There are a couple of other properties that modify the stream:
181 |
182 | ```swift
183 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!, protocols: ["chat","superchat"])
184 |
185 | //set this if you are planning on using the socket in a VOIP background setting (using the background VOIP service).
186 | socket.voipEnabled = true
187 |
188 | //set this you want to ignore SSL cert validation, so a self signed SSL certificate can be used.
189 | socket.disableSSLCertValidation = true
190 | ```
191 |
192 | ### SSL Pinning
193 |
194 | SSL Pinning is also supported in Starscream.
195 |
196 | ```swift
197 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!, protocols: ["chat","superchat"])
198 | let data = ... //load your certificate from disk
199 | socket.security = SSLSecurity(certs: [SSLCert(data: data)], usePublicKeys: true)
200 | //socket.security = SSLSecurity() //uses the .cer files in your app's bundle
201 | ```
202 | You load either a `Data` blob of your certificate or you can use a `SecKeyRef` if you have a public key you want to use. The `usePublicKeys` bool is whether to use the certificates for validation or the public keys. The public keys will be extracted from the certificates automatically if `usePublicKeys` is choosen.
203 |
204 | ### Custom Queue
205 |
206 | A custom queue can be specified when delegate methods are called. By default `DispatchQueue.main` is used, thus making all delegate methods calls run on the main thread. It is important to note that all WebSocket processing is done on a background thread, only the delegate method calls are changed when modifying the queue. The actual processing is always on a background thread and will not pause your app.
207 |
208 | ```swift
209 | socket = WebSocket(url: URL(string: "ws://localhost:8080/")!, protocols: ["chat","superchat"])
210 | //create a custom queue
211 | socket.callbackQueue = DispatchQueue(label: "com.vluxe.starscream.myapp")
212 | ```
213 |
214 | ## Example Project
215 |
216 | Check out the SimpleTest project in the examples directory to see how to setup a simple connection to a WebSocket server.
217 |
218 | ## Requirements
219 |
220 | Starscream works with iOS 7/OSX 10.9 or above. It is recommended to use iOS 8/10.10 or above for CocoaPods/framework support. To use Starscream with a project targeting iOS 7, you must include all Swift files directly in your project.
221 |
222 | ## Installation
223 |
224 | ### CocoaPods
225 |
226 | Check out [Get Started](http://cocoapods.org/) tab on [cocoapods.org](http://cocoapods.org/).
227 |
228 | To use Starscream in your project add the following 'Podfile' to your project
229 |
230 | source 'https://github.com/CocoaPods/Specs.git'
231 | platform :ios, '9.0'
232 | use_frameworks!
233 |
234 | pod 'Starscream', '~> 2.0.0'
235 |
236 | Then run:
237 |
238 | pod install
239 |
240 | ### Carthage
241 |
242 | Check out the [Carthage](https://github.com/Carthage/Carthage) docs on how to add a install. The `Starscream` framework is already setup with shared schemes.
243 |
244 | [Carthage Install](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)
245 |
246 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
247 |
248 | ```bash
249 | $ brew update
250 | $ brew install carthage
251 | ```
252 |
253 | To integrate Starscream into your Xcode project using Carthage, specify it in your `Cartfile`:
254 |
255 | ```
256 | github "daltoniam/Starscream" >= 2.0.0
257 | ```
258 |
259 | ### Rogue
260 |
261 | First see the [installation docs](https://github.com/acmacalister/Rogue) for how to install Rogue.
262 |
263 | To install Starscream run the command below in the directory you created the rogue file.
264 |
265 | ```
266 | rogue add https://github.com/daltoniam/starscream
267 | ```
268 |
269 | Next open the `libs` folder and add the `Starscream.xcodeproj` to your Xcode project. Once that is complete, in your "Build Phases" add the `Starscream.framework` to your "Link Binary with Libraries" phase. Make sure to add the `libs` folder to your `.gitignore` file.
270 |
271 | ### Other
272 |
273 | Simply grab the framework (either via git submodule or another package manager).
274 |
275 | Add the `Starscream.xcodeproj` to your Xcode project. Once that is complete, in your "Build Phases" add the `Starscream.framework` to your "Link Binary with Libraries" phase.
276 |
277 | ### Add Copy Frameworks Phase
278 |
279 | If you are running this in an OSX app or on a physical iOS device you will need to make sure you add the `Starscream.framework` to be included in your app bundle. To do this, in Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar. In the tab bar at the top of that window, open the "Build Phases" panel. Expand the "Link Binary with Libraries" group, and add `Starscream.framework`. Click on the + button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `Starscream.framework` respectively.
280 |
281 | ## TODOs
282 |
283 | - [ ] WatchOS?
284 | - [ ] Linux Support?
285 | - [ ] Add Unit Tests - Local Swift websocket server
286 |
287 | ## License
288 |
289 | Starscream is licensed under the Apache v2 License.
290 |
291 | ## Contact
292 |
293 | ### Dalton Cherry
294 | * https://github.com/daltoniam
295 | * http://twitter.com/daltoniam
296 | * http://daltoniam.com
297 |
298 | ### Austin Cherry ###
299 | * https://github.com/acmacalister
300 | * http://twitter.com/acmacalister
301 | * http://austincherry.me
302 |
--------------------------------------------------------------------------------
/Example/Pods/Starscream/Source/SSLSecurity.swift:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // SSLSecurity.swift
4 | // Starscream
5 | //
6 | // Created by Dalton Cherry on 5/16/15.
7 | // Copyright (c) 2014-2016 Dalton Cherry.
8 | //
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | //
13 | // http://www.apache.org/licenses/LICENSE-2.0
14 | //
15 | // Unless required by applicable law or agreed to in writing, software
16 | // distributed under the License is distributed on an "AS IS" BASIS,
17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | // See the License for the specific language governing permissions and
19 | // limitations under the License.
20 | //
21 | //////////////////////////////////////////////////////////////////////////////////////////////////
22 |
23 | import Foundation
24 | import Security
25 |
26 | public protocol SSLTrustValidator {
27 | func isValid(_ trust: SecTrust, domain: String?) -> Bool
28 | }
29 |
30 | open class SSLCert {
31 | var certData: Data?
32 | var key: SecKey?
33 |
34 | /**
35 | Designated init for certificates
36 |
37 | - parameter data: is the binary data of the certificate
38 |
39 | - returns: a representation security object to be used with
40 | */
41 | public init(data: Data) {
42 | self.certData = data
43 | }
44 |
45 | /**
46 | Designated init for public keys
47 |
48 | - parameter key: is the public key to be used
49 |
50 | - returns: a representation security object to be used with
51 | */
52 | public init(key: SecKey) {
53 | self.key = key
54 | }
55 | }
56 |
57 | open class SSLSecurity : SSLTrustValidator {
58 | public var validatedDN = true //should the domain name be validated?
59 |
60 | var isReady = false //is the key processing done?
61 | var certificates: [Data]? //the certificates
62 | var pubKeys: [SecKey]? //the public keys
63 | var usePublicKeys = false //use public keys or certificate validation?
64 |
65 | /**
66 | Use certs from main app bundle
67 |
68 | - parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
69 |
70 | - returns: a representation security object to be used with
71 | */
72 | public convenience init(usePublicKeys: Bool = false) {
73 | let paths = Bundle.main.paths(forResourcesOfType: "cer", inDirectory: ".")
74 |
75 | let certs = paths.reduce([SSLCert]()) { (certs: [SSLCert], path: String) -> [SSLCert] in
76 | var certs = certs
77 | if let data = NSData(contentsOfFile: path) {
78 | certs.append(SSLCert(data: data as Data))
79 | }
80 | return certs
81 | }
82 |
83 | self.init(certs: certs, usePublicKeys: usePublicKeys)
84 | }
85 |
86 | /**
87 | Designated init
88 |
89 | - parameter certs: is the certificates or public keys to use
90 | - parameter usePublicKeys: is to specific if the publicKeys or certificates should be used for SSL pinning validation
91 |
92 | - returns: a representation security object to be used with
93 | */
94 | public init(certs: [SSLCert], usePublicKeys: Bool) {
95 | self.usePublicKeys = usePublicKeys
96 |
97 | if self.usePublicKeys {
98 | DispatchQueue.global(qos: .default).async {
99 | let pubKeys = certs.reduce([SecKey]()) { (pubKeys: [SecKey], cert: SSLCert) -> [SecKey] in
100 | var pubKeys = pubKeys
101 | if let data = cert.certData, cert.key == nil {
102 | cert.key = self.extractPublicKey(data)
103 | }
104 | if let key = cert.key {
105 | pubKeys.append(key)
106 | }
107 | return pubKeys
108 | }
109 |
110 | self.pubKeys = pubKeys
111 | self.isReady = true
112 | }
113 | } else {
114 | let certificates = certs.reduce([Data]()) { (certificates: [Data], cert: SSLCert) -> [Data] in
115 | var certificates = certificates
116 | if let data = cert.certData {
117 | certificates.append(data)
118 | }
119 | return certificates
120 | }
121 | self.certificates = certificates
122 | self.isReady = true
123 | }
124 | }
125 |
126 | /**
127 | Valid the trust and domain name.
128 |
129 | - parameter trust: is the serverTrust to validate
130 | - parameter domain: is the CN domain to validate
131 |
132 | - returns: if the key was successfully validated
133 | */
134 | public func isValid(_ trust: SecTrust, domain: String?) -> Bool {
135 |
136 | var tries = 0
137 | while !self.isReady {
138 | usleep(1000)
139 | tries += 1
140 | if tries > 5 {
141 | return false //doesn't appear it is going to ever be ready...
142 | }
143 | }
144 | var policy: SecPolicy
145 | if self.validatedDN {
146 | policy = SecPolicyCreateSSL(true, domain as NSString?)
147 | } else {
148 | policy = SecPolicyCreateBasicX509()
149 | }
150 | SecTrustSetPolicies(trust,policy)
151 | if self.usePublicKeys {
152 | if let keys = self.pubKeys {
153 | let serverPubKeys = publicKeyChain(trust)
154 | for serverKey in serverPubKeys as [AnyObject] {
155 | for key in keys as [AnyObject] {
156 | if serverKey.isEqual(key) {
157 | return true
158 | }
159 | }
160 | }
161 | }
162 | } else if let certs = self.certificates {
163 | let serverCerts = certificateChain(trust)
164 | var collect = [SecCertificate]()
165 | for cert in certs {
166 | collect.append(SecCertificateCreateWithData(nil,cert as CFData)!)
167 | }
168 | SecTrustSetAnchorCertificates(trust,collect as NSArray)
169 | var result: SecTrustResultType = .unspecified
170 | SecTrustEvaluate(trust,&result)
171 | if result == .unspecified || result == .proceed {
172 | var trustedCount = 0
173 | for serverCert in serverCerts {
174 | for cert in certs {
175 | if cert == serverCert {
176 | trustedCount += 1
177 | break
178 | }
179 | }
180 | }
181 | if trustedCount == serverCerts.count {
182 | return true
183 | }
184 | }
185 | }
186 | return false
187 | }
188 |
189 | /**
190 | Get the public key from a certificate data
191 |
192 | - parameter data: is the certificate to pull the public key from
193 |
194 | - returns: a public key
195 | */
196 | func extractPublicKey(_ data: Data) -> SecKey? {
197 | guard let cert = SecCertificateCreateWithData(nil, data as CFData) else { return nil }
198 |
199 | return extractPublicKey(cert, policy: SecPolicyCreateBasicX509())
200 | }
201 |
202 | /**
203 | Get the public key from a certificate
204 |
205 | - parameter data: is the certificate to pull the public key from
206 |
207 | - returns: a public key
208 | */
209 | func extractPublicKey(_ cert: SecCertificate, policy: SecPolicy) -> SecKey? {
210 | var possibleTrust: SecTrust?
211 | SecTrustCreateWithCertificates(cert, policy, &possibleTrust)
212 |
213 | guard let trust = possibleTrust else { return nil }
214 | var result: SecTrustResultType = .unspecified
215 | SecTrustEvaluate(trust, &result)
216 | return SecTrustCopyPublicKey(trust)
217 | }
218 |
219 | /**
220 | Get the certificate chain for the trust
221 |
222 | - parameter trust: is the trust to lookup the certificate chain for
223 |
224 | - returns: the certificate chain for the trust
225 | */
226 | func certificateChain(_ trust: SecTrust) -> [Data] {
227 | let certificates = (0.. [Data] in
228 | var certificates = certificates
229 | let cert = SecTrustGetCertificateAtIndex(trust, index)
230 | certificates.append(SecCertificateCopyData(cert!) as Data)
231 | return certificates
232 | }
233 |
234 | return certificates
235 | }
236 |
237 | /**
238 | Get the public key chain for the trust
239 |
240 | - parameter trust: is the trust to lookup the certificate chain and extract the public keys
241 |
242 | - returns: the public keys from the certifcate chain for the trust
243 | */
244 | func publicKeyChain(_ trust: SecTrust) -> [SecKey] {
245 | let policy = SecPolicyCreateBasicX509()
246 | let keys = (0.. [SecKey] in
247 | var keys = keys
248 | let cert = SecTrustGetCertificateAtIndex(trust, index)
249 | if let key = extractPublicKey(cert!, policy: policy) {
250 | keys.append(key)
251 | }
252 |
253 | return keys
254 | }
255 |
256 | return keys
257 | }
258 |
259 |
260 | }
261 |
--------------------------------------------------------------------------------
/Example/Pods/SwiftyJSON/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Ruoyu Fu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Example/Pods/SwiftyJSON/README.md:
--------------------------------------------------------------------------------
1 | # SwiftyJSON
2 |
3 | [](https://travis-ci.org/SwiftyJSON/SwiftyJSON) [](https://github.com/Carthage/Carthage)  
4 |
5 | SwiftyJSON makes it easy to deal with JSON data in Swift.
6 |
7 | 1. [Why is the typical JSON handling in Swift NOT good](#why-is-the-typical-json-handling-in-swift-not-good)
8 | 2. [Requirements](#requirements)
9 | 3. [Integration](#integration)
10 | 4. [Usage](#usage)
11 | - [Initialization](#initialization)
12 | - [Subscript](#subscript)
13 | - [Loop](#loop)
14 | - [Error](#error)
15 | - [Optional getter](#optional-getter)
16 | - [Non-optional getter](#non-optional-getter)
17 | - [Setter](#setter)
18 | - [Raw object](#raw-object)
19 | - [Literal convertibles](#literal-convertibles)
20 | 5. [Work with Alamofire](#work-with-alamofire)
21 |
22 | > For Legacy Swift support, take a look at the [swift2 branch](https://github.com/SwiftyJSON/SwiftyJSON/tree/swift2)
23 |
24 | > [中文介绍](http://tangplin.github.io/swiftyjson/)
25 |
26 |
27 | ## Why is the typical JSON handling in Swift NOT good?
28 |
29 | Swift is very strict about types. But although explicit typing is good for saving us from mistakes, it becomes painful when dealing with JSON and other areas that are, by nature, implicit about types.
30 |
31 | Take the Twitter API for example. Say we want to retrieve a user's "name" value of some tweet in Swift (according to Twitter's API https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline).
32 |
33 | The code would look like this:
34 |
35 | ```swift
36 | if let statusesArray = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]],
37 | let user = statusesArray[0]["user"] as? [String: Any],
38 | let username = user["name"] as? String {
39 | // Finally we got the username
40 | }
41 | ```
42 |
43 | It's not good.
44 |
45 | Even if we use optional chaining, it would be messy:
46 |
47 | ```swift
48 | if let JSONObject = try JSONSerialization.jsonObject(with: data,, options: .allowFragments) as? [[String: Any]],
49 | let username = (JSONObject[0]["user"] as? [String: Any])?["name"] as? String {
50 | // There's our username
51 | }
52 | ```
53 |
54 | An unreadable mess--for something that should really be simple!
55 |
56 | With SwiftyJSON all you have to do is:
57 |
58 | ```swift
59 | let json = JSON(data: dataFromNetworking)
60 | if let userName = json[0]["user"]["name"].string {
61 | //Now you got your value
62 | }
63 | ```
64 |
65 | And don't worry about the Optional Wrapping thing. It's done for you automatically.
66 |
67 | ```swift
68 | let json = JSON(data: dataFromNetworking)
69 | if let userName = json[999999]["wrong_key"]["wrong_name"].string {
70 | //Calm down, take it easy, the ".string" property still produces the correct Optional String type with safety
71 | } else {
72 | //Print the error
73 | print(json[999999]["wrong_key"]["wrong_name"])
74 | }
75 | ```
76 |
77 | ## Requirements
78 |
79 | - iOS 8.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+
80 | - Xcode 8
81 |
82 | ## Integration
83 |
84 | #### CocoaPods (iOS 8+, OS X 10.9+)
85 |
86 | You can use [CocoaPods](http://cocoapods.org/) to install `SwiftyJSON`by adding it to your `Podfile`:
87 |
88 | ```ruby
89 | platform :ios, '8.0'
90 | use_frameworks!
91 |
92 | target 'MyApp' do
93 | pod 'SwiftyJSON'
94 | end
95 | ```
96 |
97 | Note that this requires CocoaPods version 36, and your iOS deployment target to be at least 8.0:
98 |
99 |
100 | #### Carthage (iOS 8+, OS X 10.9+)
101 |
102 | You can use [Carthage](https://github.com/Carthage/Carthage) to install `SwiftyJSON` by adding it to your `Cartfile`:
103 |
104 | ```
105 | github "SwiftyJSON/SwiftyJSON"
106 | ```
107 |
108 | #### Swift Package Manager
109 |
110 | You can use [The Swift Package Manager](https://swift.org/package-manager) to install `SwiftyJSON` by adding the proper description to your `Package.swift` file:
111 |
112 | ```swift
113 | import PackageDescription
114 |
115 | let package = Package(
116 | name: "YOUR_PROJECT_NAME",
117 | targets: [],
118 | dependencies: [
119 | .Package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", versions: Version(1,0,0).. = json["list"].arrayValue
318 | ```
319 |
320 | ```swift
321 | //If not a Dictionary or nil, return [:]
322 | let user: Dictionary = json["user"].dictionaryValue
323 | ```
324 |
325 | #### Setter
326 |
327 | ```swift
328 | json["name"] = JSON("new-name")
329 | json[0] = JSON(1)
330 | ```
331 |
332 | ```swift
333 | json["id"].int = 1234567890
334 | json["coordinate"].double = 8766.766
335 | json["name"].string = "Jack"
336 | json.arrayObject = [1,2,3,4]
337 | json.dictionaryObject = ["name":"Jack", "age":25]
338 | ```
339 |
340 | #### Raw object
341 |
342 | ```swift
343 | let jsonObject: Any = json.object
344 | ```
345 |
346 | ```swift
347 | if let jsonObject: Any = json.rawValue
348 | ```
349 |
350 | ```swift
351 | //convert the JSON to raw NSData
352 | if let data = json.rawData() {
353 | //Do something you want
354 | }
355 | ```
356 |
357 | ```swift
358 | //convert the JSON to a raw String
359 | if let string = json.rawString() {
360 | //Do something you want
361 | }
362 | ```
363 |
364 | #### Existence
365 |
366 | ```swift
367 | //shows you whether value specified in JSON or not
368 | if json["name"].exists()
369 | ```
370 |
371 | #### Literal convertibles
372 |
373 | For more info about literal convertibles: [Swift Literal Convertibles](http://nshipster.com/swift-literal-convertible/)
374 |
375 | ```swift
376 | //StringLiteralConvertible
377 | let json: JSON = "I'm a json"
378 | ```
379 |
380 | ```swift
381 | //IntegerLiteralConvertible
382 | let json: JSON = 12345
383 | ```
384 |
385 | ```swift
386 | //BooleanLiteralConvertible
387 | let json: JSON = true
388 | ```
389 |
390 | ```swift
391 | //FloatLiteralConvertible
392 | let json: JSON = 2.8765
393 | ```
394 |
395 | ```swift
396 | //DictionaryLiteralConvertible
397 | let json: JSON = ["I":"am", "a":"json"]
398 | ```
399 |
400 | ```swift
401 | //ArrayLiteralConvertible
402 | let json: JSON = ["I", "am", "a", "json"]
403 | ```
404 |
405 | ```swift
406 | //NilLiteralConvertible
407 | let json: JSON = nil
408 | ```
409 |
410 | ```swift
411 | //With subscript in array
412 | var json: JSON = [1,2,3]
413 | json[0] = 100
414 | json[1] = 200
415 | json[2] = 300
416 | json[999] = 300 //Don't worry, nothing will happen
417 | ```
418 |
419 | ```swift
420 | //With subscript in dictionary
421 | var json: JSON = ["name": "Jack", "age": 25]
422 | json["name"] = "Mike"
423 | json["age"] = "25" //It's OK to set String
424 | json["address"] = "L.A." // Add the "address": "L.A." in json
425 | ```
426 |
427 | ```swift
428 | //Array & Dictionary
429 | var json: JSON = ["name": "Jack", "age": 25, "list": ["a", "b", "c", ["what": "this"]]]
430 | json["list"][3]["what"] = "that"
431 | json["list",3,"what"] = "that"
432 | let path: [JSONSubscriptType] = ["list",3,"what"]
433 | json[path] = "that"
434 | ```
435 |
436 | ```swift
437 | //With other JSON objects
438 | let user: JSON = ["username" : "Steve", "password": "supersecurepassword"]
439 | let auth: JSON = [
440 | "user": user.object //use user.object instead of just user
441 | "apikey": "supersecretapitoken"
442 | ]
443 | ```
444 |
445 | ## Work with Alamofire
446 |
447 | SwiftyJSON nicely wraps the result of the Alamofire JSON response handler:
448 |
449 | ```swift
450 | Alamofire.request(.GET, url).validate().responseJSON { response in
451 | switch response.result {
452 | case .success(let value):
453 | let json = JSON(value)
454 | print("JSON: \(json)")
455 | case .failure(let error):
456 | print(error)
457 | }
458 | }
459 | ```
460 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/FayeSwift-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_FayeSwift : NSObject
3 | @end
4 | @implementation PodsDummy_FayeSwift
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/FayeSwift-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/FayeSwift-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double FayeSwiftVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char FayeSwiftVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/FayeSwift.modulemap:
--------------------------------------------------------------------------------
1 | framework module FayeSwift {
2 | umbrella header "FayeSwift-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/FayeSwift.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FayeSwift
2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Starscream" "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON"
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" "-suppress-warnings"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_ROOT = ${SRCROOT}
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FayeSwift/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.2.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_FayeSwift_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_FayeSwift_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
86 | if [[ "$CONFIGURATION" == "Debug" ]]; then
87 | install_framework "$BUILT_PRODUCTS_DIR/FayeSwift/FayeSwift.framework"
88 | install_framework "$BUILT_PRODUCTS_DIR/Starscream/Starscream.framework"
89 | install_framework "$BUILT_PRODUCTS_DIR/SwiftyJSON/SwiftyJSON.framework"
90 | fi
91 | if [[ "$CONFIGURATION" == "Release" ]]; then
92 | install_framework "$BUILT_PRODUCTS_DIR/FayeSwift/FayeSwift.framework"
93 | install_framework "$BUILT_PRODUCTS_DIR/Starscream/Starscream.framework"
94 | install_framework "$BUILT_PRODUCTS_DIR/SwiftyJSON/SwiftyJSON.framework"
95 | fi
96 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | *)
22 | TARGET_DEVICE_ARGS="--target-device mac"
23 | ;;
24 | esac
25 |
26 | install_resource()
27 | {
28 | if [[ "$1" = /* ]] ; then
29 | RESOURCE_PATH="$1"
30 | else
31 | RESOURCE_PATH="${PODS_ROOT}/$1"
32 | fi
33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
34 | cat << EOM
35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
36 | EOM
37 | exit 1
38 | fi
39 | case $RESOURCE_PATH in
40 | *.storyboard)
41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
43 | ;;
44 | *.xib)
45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
47 | ;;
48 | *.framework)
49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
53 | ;;
54 | *.xcdatamodel)
55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
57 | ;;
58 | *.xcdatamodeld)
59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
61 | ;;
62 | *.xcmappingmodel)
63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
65 | ;;
66 | *.xcassets)
67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
69 | ;;
70 | *)
71 | echo "$RESOURCE_PATH"
72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
73 | ;;
74 | esac
75 | }
76 |
77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
82 | fi
83 | rm -f "$RESOURCES_TO_COPY"
84 |
85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
86 | then
87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
89 | while read line; do
90 | if [[ $line != "${PODS_ROOT}*" ]]; then
91 | XCASSET_FILES+=("$line")
92 | fi
93 | done <<<"$OTHER_XCASSETS"
94 |
95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
96 | fi
97 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double Pods_FayeSwift_ExampleVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char Pods_FayeSwift_ExampleVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift" "$PODS_CONFIGURATION_BUILD_DIR/Starscream" "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift/FayeSwift.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Starscream/Starscream.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "FayeSwift" -framework "Starscream" -framework "SwiftyJSON"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FayeSwift_Example {
2 | umbrella header "Pods-FayeSwift_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Example/Pods-FayeSwift_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift" "$PODS_CONFIGURATION_BUILD_DIR/Starscream" "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift/FayeSwift.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Starscream/Starscream.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "FayeSwift" -framework "Starscream" -framework "SwiftyJSON"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## FayeSwift
5 |
6 | Copyright (c) 2016 Haris Amin
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | ## Starscream
28 |
29 | Apache License
30 | Version 2.0, January 2004
31 | http://www.apache.org/licenses/
32 |
33 | Copyright (c) 2014-2016 Dalton Cherry.
34 |
35 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
36 |
37 | 1. Definitions.
38 |
39 | "License" shall mean the terms and conditions for use, reproduction,
40 | and distribution as defined by Sections 1 through 9 of this document.
41 |
42 | "Licensor" shall mean the copyright owner or entity authorized by
43 | the copyright owner that is granting the License.
44 |
45 | "Legal Entity" shall mean the union of the acting entity and all
46 | other entities that control, are controlled by, or are under common
47 | control with that entity. For the purposes of this definition,
48 | "control" means (i) the power, direct or indirect, to cause the
49 | direction or management of such entity, whether by contract or
50 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
51 | outstanding shares, or (iii) beneficial ownership of such entity.
52 |
53 | "You" (or "Your") shall mean an individual or Legal Entity
54 | exercising permissions granted by this License.
55 |
56 | "Source" form shall mean the preferred form for making modifications,
57 | including but not limited to software source code, documentation
58 | source, and configuration files.
59 |
60 | "Object" form shall mean any form resulting from mechanical
61 | transformation or translation of a Source form, including but
62 | not limited to compiled object code, generated documentation,
63 | and conversions to other media types.
64 |
65 | "Work" shall mean the work of authorship, whether in Source or
66 | Object form, made available under the License, as indicated by a
67 | copyright notice that is included in or attached to the work
68 | (an example is provided in the Appendix below).
69 |
70 | "Derivative Works" shall mean any work, whether in Source or Object
71 | form, that is based on (or derived from) the Work and for which the
72 | editorial revisions, annotations, elaborations, or other modifications
73 | represent, as a whole, an original work of authorship. For the purposes
74 | of this License, Derivative Works shall not include works that remain
75 | separable from, or merely link (or bind by name) to the interfaces of,
76 | the Work and Derivative Works thereof.
77 |
78 | "Contribution" shall mean any work of authorship, including
79 | the original version of the Work and any modifications or additions
80 | to that Work or Derivative Works thereof, that is intentionally
81 | submitted to Licensor for inclusion in the Work by the copyright owner
82 | or by an individual or Legal Entity authorized to submit on behalf of
83 | the copyright owner. For the purposes of this definition, "submitted"
84 | means any form of electronic, verbal, or written communication sent
85 | to the Licensor or its representatives, including but not limited to
86 | communication on electronic mailing lists, source code control systems,
87 | and issue tracking systems that are managed by, or on behalf of, the
88 | Licensor for the purpose of discussing and improving the Work, but
89 | excluding communication that is conspicuously marked or otherwise
90 | designated in writing by the copyright owner as "Not a Contribution."
91 |
92 | "Contributor" shall mean Licensor and any individual or Legal Entity
93 | on behalf of whom a Contribution has been received by Licensor and
94 | subsequently incorporated within the Work.
95 |
96 | 2. Grant of Copyright License. Subject to the terms and conditions of
97 | this License, each Contributor hereby grants to You a perpetual,
98 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
99 | copyright license to reproduce, prepare Derivative Works of,
100 | publicly display, publicly perform, sublicense, and distribute the
101 | Work and such Derivative Works in Source or Object form.
102 |
103 | 3. Grant of Patent License. Subject to the terms and conditions of
104 | this License, each Contributor hereby grants to You a perpetual,
105 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
106 | (except as stated in this section) patent license to make, have made,
107 | use, offer to sell, sell, import, and otherwise transfer the Work,
108 | where such license applies only to those patent claims licensable
109 | by such Contributor that are necessarily infringed by their
110 | Contribution(s) alone or by combination of their Contribution(s)
111 | with the Work to which such Contribution(s) was submitted. If You
112 | institute patent litigation against any entity (including a
113 | cross-claim or counterclaim in a lawsuit) alleging that the Work
114 | or a Contribution incorporated within the Work constitutes direct
115 | or contributory patent infringement, then any patent licenses
116 | granted to You under this License for that Work shall terminate
117 | as of the date such litigation is filed.
118 |
119 | 4. Redistribution. You may reproduce and distribute copies of the
120 | Work or Derivative Works thereof in any medium, with or without
121 | modifications, and in Source or Object form, provided that You
122 | meet the following conditions:
123 |
124 | (a) You must give any other recipients of the Work or
125 | Derivative Works a copy of this License; and
126 |
127 | (b) You must cause any modified files to carry prominent notices
128 | stating that You changed the files; and
129 |
130 | (c) You must retain, in the Source form of any Derivative Works
131 | that You distribute, all copyright, patent, trademark, and
132 | attribution notices from the Source form of the Work,
133 | excluding those notices that do not pertain to any part of
134 | the Derivative Works; and
135 |
136 | (d) If the Work includes a "NOTICE" text file as part of its
137 | distribution, then any Derivative Works that You distribute must
138 | include a readable copy of the attribution notices contained
139 | within such NOTICE file, excluding those notices that do not
140 | pertain to any part of the Derivative Works, in at least one
141 | of the following places: within a NOTICE text file distributed
142 | as part of the Derivative Works; within the Source form or
143 | documentation, if provided along with the Derivative Works; or,
144 | within a display generated by the Derivative Works, if and
145 | wherever such third-party notices normally appear. The contents
146 | of the NOTICE file are for informational purposes only and
147 | do not modify the License. You may add Your own attribution
148 | notices within Derivative Works that You distribute, alongside
149 | or as an addendum to the NOTICE text from the Work, provided
150 | that such additional attribution notices cannot be construed
151 | as modifying the License.
152 |
153 | You may add Your own copyright statement to Your modifications and
154 | may provide additional or different license terms and conditions
155 | for use, reproduction, or distribution of Your modifications, or
156 | for any such Derivative Works as a whole, provided Your use,
157 | reproduction, and distribution of the Work otherwise complies with
158 | the conditions stated in this License.
159 |
160 | 5. Submission of Contributions. Unless You explicitly state otherwise,
161 | any Contribution intentionally submitted for inclusion in the Work
162 | by You to the Licensor shall be under the terms and conditions of
163 | this License, without any additional terms or conditions.
164 | Notwithstanding the above, nothing herein shall supersede or modify
165 | the terms of any separate license agreement you may have executed
166 | with Licensor regarding such Contributions.
167 |
168 | 6. Trademarks. This License does not grant permission to use the trade
169 | names, trademarks, service marks, or product names of the Licensor,
170 | except as required for reasonable and customary use in describing the
171 | origin of the Work and reproducing the content of the NOTICE file.
172 |
173 | 7. Disclaimer of Warranty. Unless required by applicable law or
174 | agreed to in writing, Licensor provides the Work (and each
175 | Contributor provides its Contributions) on an "AS IS" BASIS,
176 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
177 | implied, including, without limitation, any warranties or conditions
178 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
179 | PARTICULAR PURPOSE. You are solely responsible for determining the
180 | appropriateness of using or redistributing the Work and assume any
181 | risks associated with Your exercise of permissions under this License.
182 |
183 | 8. Limitation of Liability. In no event and under no legal theory,
184 | whether in tort (including negligence), contract, or otherwise,
185 | unless required by applicable law (such as deliberate and grossly
186 | negligent acts) or agreed to in writing, shall any Contributor be
187 | liable to You for damages, including any direct, indirect, special,
188 | incidental, or consequential damages of any character arising as a
189 | result of this License or out of the use or inability to use the
190 | Work (including but not limited to damages for loss of goodwill,
191 | work stoppage, computer failure or malfunction, or any and all
192 | other commercial damages or losses), even if such Contributor
193 | has been advised of the possibility of such damages.
194 |
195 | 9. Accepting Warranty or Additional Liability. While redistributing
196 | the Work or Derivative Works thereof, You may choose to offer,
197 | and charge a fee for, acceptance of support, warranty, indemnity,
198 | or other liability obligations and/or rights consistent with this
199 | License. However, in accepting such obligations, You may act only
200 | on Your own behalf and on Your sole responsibility, not on behalf
201 | of any other Contributor, and only if You agree to indemnify,
202 | defend, and hold each Contributor harmless for any liability
203 | incurred by, or claims asserted against, such Contributor by reason
204 | of your accepting any such warranty or additional liability.
205 |
206 | ## SwiftyJSON
207 |
208 | The MIT License (MIT)
209 |
210 | Copyright (c) 2016 Ruoyu Fu
211 |
212 | Permission is hereby granted, free of charge, to any person obtaining a copy
213 | of this software and associated documentation files (the "Software"), to deal
214 | in the Software without restriction, including without limitation the rights
215 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
216 | copies of the Software, and to permit persons to whom the Software is
217 | furnished to do so, subject to the following conditions:
218 |
219 | The above copyright notice and this permission notice shall be included in
220 | all copies or substantial portions of the Software.
221 |
222 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
223 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
224 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
225 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
226 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
228 | THE SOFTWARE.
229 |
230 | Generated by CocoaPods - https://cocoapods.org
231 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_FayeSwift_Tests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_FayeSwift_Tests
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
86 | if [[ "$CONFIGURATION" == "Debug" ]]; then
87 | install_framework "$BUILT_PRODUCTS_DIR/FayeSwift/FayeSwift.framework"
88 | install_framework "$BUILT_PRODUCTS_DIR/Starscream/Starscream.framework"
89 | install_framework "$BUILT_PRODUCTS_DIR/SwiftyJSON/SwiftyJSON.framework"
90 | fi
91 | if [[ "$CONFIGURATION" == "Release" ]]; then
92 | install_framework "$BUILT_PRODUCTS_DIR/FayeSwift/FayeSwift.framework"
93 | install_framework "$BUILT_PRODUCTS_DIR/Starscream/Starscream.framework"
94 | install_framework "$BUILT_PRODUCTS_DIR/SwiftyJSON/SwiftyJSON.framework"
95 | fi
96 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
5 |
6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
7 | > "$RESOURCES_TO_COPY"
8 |
9 | XCASSET_FILES=()
10 |
11 | case "${TARGETED_DEVICE_FAMILY}" in
12 | 1,2)
13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
14 | ;;
15 | 1)
16 | TARGET_DEVICE_ARGS="--target-device iphone"
17 | ;;
18 | 2)
19 | TARGET_DEVICE_ARGS="--target-device ipad"
20 | ;;
21 | *)
22 | TARGET_DEVICE_ARGS="--target-device mac"
23 | ;;
24 | esac
25 |
26 | install_resource()
27 | {
28 | if [[ "$1" = /* ]] ; then
29 | RESOURCE_PATH="$1"
30 | else
31 | RESOURCE_PATH="${PODS_ROOT}/$1"
32 | fi
33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
34 | cat << EOM
35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
36 | EOM
37 | exit 1
38 | fi
39 | case $RESOURCE_PATH in
40 | *.storyboard)
41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
43 | ;;
44 | *.xib)
45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
47 | ;;
48 | *.framework)
49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
53 | ;;
54 | *.xcdatamodel)
55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
57 | ;;
58 | *.xcdatamodeld)
59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
61 | ;;
62 | *.xcmappingmodel)
63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
65 | ;;
66 | *.xcassets)
67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
69 | ;;
70 | *)
71 | echo "$RESOURCE_PATH"
72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
73 | ;;
74 | esac
75 | }
76 |
77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
82 | fi
83 | rm -f "$RESOURCES_TO_COPY"
84 |
85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
86 | then
87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
89 | while read line; do
90 | if [[ $line != "${PODS_ROOT}*" ]]; then
91 | XCASSET_FILES+=("$line")
92 | fi
93 | done <<<"$OTHER_XCASSETS"
94 |
95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
96 | fi
97 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double Pods_FayeSwift_TestsVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char Pods_FayeSwift_TestsVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift" "$PODS_CONFIGURATION_BUILD_DIR/Starscream" "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift/FayeSwift.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Starscream/Starscream.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "FayeSwift" -framework "Starscream" -framework "SwiftyJSON"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FayeSwift_Tests {
2 | umbrella header "Pods-FayeSwift_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FayeSwift_Tests/Pods-FayeSwift_Tests.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift" "$PODS_CONFIGURATION_BUILD_DIR/Starscream" "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
6 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/FayeSwift/FayeSwift.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Starscream/Starscream.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON/SwiftyJSON.framework/Headers"
7 | OTHER_LDFLAGS = $(inherited) -framework "FayeSwift" -framework "Starscream" -framework "SwiftyJSON"
8 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
9 | PODS_BUILD_DIR = $BUILD_DIR
10 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
11 | PODS_ROOT = ${SRCROOT}/Pods
12 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 2.0.2
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Starscream-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Starscream : NSObject
3 | @end
4 | @implementation PodsDummy_Starscream
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Starscream-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Starscream-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double StarscreamVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char StarscreamVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Starscream.modulemap:
--------------------------------------------------------------------------------
1 | framework module Starscream {
2 | umbrella header "Starscream-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Starscream/Starscream.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Starscream
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" "-suppress-warnings"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 3.1.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SwiftyJSON : NSObject
3 | @end
4 | @implementation PodsDummy_SwiftyJSON
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
6 | FOUNDATION_EXPORT double SwiftyJSONVersionNumber;
7 | FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap:
--------------------------------------------------------------------------------
1 | framework module SwiftyJSON {
2 | umbrella header "SwiftyJSON-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SwiftyJSON
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" "-suppress-warnings"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 | SWIFT_VERSION = 3.0
11 |
--------------------------------------------------------------------------------
/Example/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import XCTest
3 | import FayeSwift
4 |
5 | class Tests: XCTestCase {
6 |
7 | override func setUp() {
8 | super.setUp()
9 | // Put setup code here. This method is called before the invocation of each test method in the class.
10 | }
11 |
12 | override func tearDown() {
13 | // Put teardown code here. This method is called after the invocation of each test method in the class.
14 | super.tearDown()
15 | }
16 |
17 | func testExample() {
18 | // This is an example of a functional test case.
19 | XCTAssert(true, "Pass")
20 | }
21 |
22 | func testPerformanceExample() {
23 | // This is an example of a performance test case.
24 | self.measure() {
25 | // Put the code you want to measure the time of here.
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/DerivedSources/Pods_FayeSwift_Example_vers.c:
--------------------------------------------------------------------------------
1 | const unsigned char Pods_FayeSwift_ExampleVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_FayeSwift_Example PROJECT:Pods-1" "\n"; const double Pods_FayeSwift_ExampleVersionNumber __attribute__ ((used)) = (double)1.;
2 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/arm64/Pods_FayeSwift_Example.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/arm64/Pods-FayeSwift_Example-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/arm64/Pods_FayeSwift_Example_vers.o
3 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/armv7/Pods_FayeSwift_Example.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/armv7/Pods-FayeSwift_Example-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Objects-normal/armv7/Pods_FayeSwift_Example_vers.o
3 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-all-non-framework-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-all-non-framework-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-all-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-all-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-generated-files.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-generated-files.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-own-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-own-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-project-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example-project-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/Pods_FayeSwift_Example.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/dgph:
--------------------------------------------------------------------------------
1 | DGPH1.04Jan 6 201616:07:58 / Users haris workspace casa FayeSwift Example Pods
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Example.build/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FayeSwift_Example {
2 | umbrella header "Pods-FayeSwift_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/DerivedSources/Pods_FayeSwift_Tests_vers.c:
--------------------------------------------------------------------------------
1 | const unsigned char Pods_FayeSwift_TestsVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_FayeSwift_Tests PROJECT:Pods-1" "\n"; const double Pods_FayeSwift_TestsVersionNumber __attribute__ ((used)) = (double)1.;
2 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/arm64/Pods_FayeSwift_Tests.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/arm64/Pods-FayeSwift_Tests-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/arm64/Pods_FayeSwift_Tests_vers.o
3 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/armv7/Pods_FayeSwift_Tests.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/armv7/Pods-FayeSwift_Tests-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Objects-normal/armv7/Pods_FayeSwift_Tests_vers.o
3 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-all-non-framework-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-all-non-framework-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-all-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-all-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-generated-files.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-generated-files.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-own-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-own-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-project-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests-project-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/Pods_FayeSwift_Tests.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/dgph:
--------------------------------------------------------------------------------
1 | DGPH1.04Jan 6 201616:07:58 / Users haris workspace casa FayeSwift Example Pods
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Pods-FayeSwift_Tests.build/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FayeSwift_Tests {
2 | umbrella header "Pods-FayeSwift_Tests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/DerivedSources/Starscream_vers.c:
--------------------------------------------------------------------------------
1 | const unsigned char StarscreamVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Starscream PROJECT:Pods-1" "\n"; const double StarscreamVersionNumber __attribute__ ((used)) = (double)1.;
2 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/Starscream-OutputFileMap.json:
--------------------------------------------------------------------------------
1 | {"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/Starscream\/Source\/SSLSecurity.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/SSLSecurity.swiftdeps"},"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/Starscream\/Source\/WebSocket.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/WebSocket.swiftdeps"},"":{"swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/arm64\/Starscream-master.swiftdeps"}}
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/Starscream.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/Starscream-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/SSLSecurity.o
3 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/WebSocket.o
4 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/arm64/Starscream_vers.o
5 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/Starscream-OutputFileMap.json:
--------------------------------------------------------------------------------
1 | {"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/Starscream\/Source\/SSLSecurity.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/SSLSecurity.swiftdeps"},"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/Starscream\/Source\/WebSocket.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/WebSocket.swiftdeps"},"":{"swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/Starscream.build\/Objects-normal\/armv7\/Starscream-master.swiftdeps"}}
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/Starscream.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/Starscream-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/SSLSecurity.o
3 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/WebSocket.o
4 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Objects-normal/armv7/Starscream_vers.o
5 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-all-non-framework-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-all-non-framework-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-all-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-all-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-generated-files.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-generated-files.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-own-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-own-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-project-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream-project-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/Starscream.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/dgph:
--------------------------------------------------------------------------------
1 | DGPH1.04Jan 6 201616:07:58 / Users haris workspace casa FayeSwift Example Pods
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module Starscream {
2 | umbrella header "Starscream-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
8 | module Starscream.Swift {
9 | header "Starscream-Swift.h"
10 | }
11 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/swift-overrides.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/Starscream.build/swift-overrides.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/unextended-module-overlay.yaml:
--------------------------------------------------------------------------------
1 | {
2 | 'version': 0,
3 | 'case-sensitive': 'false',
4 | 'roots': [{
5 | 'type': 'directory',
6 | 'name': '/Users/haris/workspace/casa/FayeSwift/Example/build/Debug-iphoneos/Starscream.framework/Modules'
7 | 'contents': [{
8 | 'type': 'file',
9 | 'name': 'module.modulemap',
10 | 'external-contents': '/Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/Starscream.build/unextended-module.modulemap',
11 | }]
12 | }]
13 | }
14 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/Starscream.build/unextended-module.modulemap:
--------------------------------------------------------------------------------
1 | framework module Starscream {
2 | umbrella header "Starscream-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
8 | module Starscream.__Swift {
9 | exclude header "Starscream-Swift.h"
10 | }
11 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/DerivedSources/SwiftyJSON_vers.c:
--------------------------------------------------------------------------------
1 | const unsigned char SwiftyJSONVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:SwiftyJSON PROJECT:Pods-1" "\n"; const double SwiftyJSONVersionNumber __attribute__ ((used)) = (double)1.;
2 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/arm64/SwiftyJSON-OutputFileMap.json:
--------------------------------------------------------------------------------
1 | {"":{"swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON-master.swiftdeps"},"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/SwiftyJSON\/Source\/SwiftyJSON.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/arm64\/SwiftyJSON.swiftdeps"}}
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/arm64/SwiftyJSON.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/arm64/SwiftyJSON-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/arm64/SwiftyJSON.o
3 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/arm64/SwiftyJSON_vers.o
4 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/armv7/SwiftyJSON-OutputFileMap.json:
--------------------------------------------------------------------------------
1 | {"":{"swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON-master.swiftdeps"},"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/Pods\/SwiftyJSON\/Source\/SwiftyJSON.swift":{"swiftmodule":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON~partial.swiftmodule","object":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON.o","llvm-bc":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON.bc","diagnostics":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON.dia","dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON.d","swift-dependencies":"\/Users\/haris\/workspace\/casa\/FayeSwift\/Example\/build\/Pods.build\/Debug-iphoneos\/SwiftyJSON.build\/Objects-normal\/armv7\/SwiftyJSON.swiftdeps"}}
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/armv7/SwiftyJSON.LinkFileList:
--------------------------------------------------------------------------------
1 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/armv7/SwiftyJSON-dummy.o
2 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/armv7/SwiftyJSON.o
3 | /Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/Objects-normal/armv7/SwiftyJSON_vers.o
4 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-all-non-framework-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-all-non-framework-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-all-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-all-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-generated-files.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-generated-files.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-own-target-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-own-target-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-project-headers.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON-project-headers.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/SwiftyJSON.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/dgph:
--------------------------------------------------------------------------------
1 | DGPH1.04Jan 6 201616:07:58 / Users haris workspace casa FayeSwift Example Pods
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module SwiftyJSON {
2 | umbrella header "SwiftyJSON-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
8 | module SwiftyJSON.Swift {
9 | header "SwiftyJSON-Swift.h"
10 | }
11 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/swift-overrides.hmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/swift-overrides.hmap
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/unextended-module-overlay.yaml:
--------------------------------------------------------------------------------
1 | {
2 | 'version': 0,
3 | 'case-sensitive': 'false',
4 | 'roots': [{
5 | 'type': 'directory',
6 | 'name': '/Users/haris/workspace/casa/FayeSwift/Example/build/Debug-iphoneos/SwiftyJSON.framework/Modules'
7 | 'contents': [{
8 | 'type': 'file',
9 | 'name': 'module.modulemap',
10 | 'external-contents': '/Users/haris/workspace/casa/FayeSwift/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/unextended-module.modulemap',
11 | }]
12 | }]
13 | }
14 |
--------------------------------------------------------------------------------
/Example/build/Pods.build/Debug-iphoneos/SwiftyJSON.build/unextended-module.modulemap:
--------------------------------------------------------------------------------
1 | framework module SwiftyJSON {
2 | umbrella header "SwiftyJSON-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
8 | module SwiftyJSON.__Swift {
9 | exclude header "SwiftyJSON-Swift.h"
10 | }
11 |
--------------------------------------------------------------------------------
/FayeSwift.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "FayeSwift"
3 | s.version = "0.3.0"
4 | s.summary = "A pure Swift Faye (Bayeux) Client"
5 | s.description = <<-DESC
6 | A Pure Swift Client Library for the Faye (Bayeux/Comet) Pub-Sub messaging server.
7 | This client has been tested with the Faye (http://faye.jcoglan.com) implementation of the
8 | Bayeux protocol. Currently only supports Websocket transport.
9 | DESC
10 | s.homepage = "https://github.com/hamin/FayeSwift"
11 | s.license = "MIT"
12 | s.author = { "Haris Amin" => "aminharis7@gmail.com" }
13 | s.source = { :git => "https://github.com/hamin/FayeSwift.git", :tag => s.version.to_s }
14 | s.social_media_url = "https://twitter.com/harisamin"
15 | s.requires_arc = true
16 | s.osx.deployment_target = "10.10"
17 | s.ios.deployment_target = "8.0"
18 | s.tvos.deployment_target = "9.0"
19 | s.source_files = "Sources/*.swift"
20 | s.dependency "Starscream", '~> 2.0'
21 | s.dependency "SwiftyJSON", '~> 3.1'
22 | end
23 |
--------------------------------------------------------------------------------
/License:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Haris Amin
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 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | import PackageDescription
2 |
3 | let package = Package(
4 | name: "FayeSwift",
5 | targets: [],
6 | dependencies: [
7 | .Package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", versions: "2.3.3" ..< Version.max),
8 | .Package(url: "https://github.com/daltoniam/Starscream.git", versions: "1.1.3" ..< Version.max)
9 | ]
10 | )
11 |
--------------------------------------------------------------------------------
/Pod/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Pod/Assets/.gitkeep
--------------------------------------------------------------------------------
/Pod/Classes/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/Pod/Classes/.gitkeep
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # FayeSwift
2 |
3 | [](https://gitter.im/hamin/FayeSwift?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4 |
5 | 
6 |
7 |
8 | A simple Swift client library for the [Faye](http://faye.jcoglan.com/) publish-subscribe messaging server. FayeObjC is implemented atop the [Starscream](https://github.com/daltoniam/starscream) Swift web socket library and will work on both Mac (pending Xcode 6 Swift update) and iPhone projects.
9 |
10 | It was heavily inspired by the Objective-C client found here: [FayeObjc](https://github.com/pcrawfor/FayeObjC)
11 |
12 | ___**Note**: For Swift 2.2 please use FayeSwift 0.2.0___
13 |
14 | ## Example
15 |
16 | ### Installation
17 |
18 | FayeSwift is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:
19 |
20 | ```ruby
21 | pod "FayeSwift"
22 | ```
23 |
24 | _Swift Package Manager compatability is coming sson_
25 |
26 | ### Initializing Client
27 |
28 | You can open a connection to your faye server. Note that `client` is probably best as a property, so your delegate can stick around. You can initiate a client with a subscription to a specific channel.
29 |
30 | ```swift
31 | client = FayeClient(aFayeURLString: "ws://localhost:5222/faye", channel: "/cool")
32 | client.delegate = self
33 | client.connectToServer()
34 | ```
35 |
36 | You can then also subscribe to additional channels either with block handlers like so:
37 |
38 | ```swift
39 | let channelBlock:ChannelSubscriptionBlock = {(messageDict) -> Void in
40 | let text: AnyObject? = messageDict["text"]
41 | println("Here is the Block message: \(text)")
42 | }
43 | client.subscribeToChannel("/awesome", block: channelBlock)
44 | ```
45 |
46 | or without them letting the delegate handle them like so:
47 |
48 | ```swift
49 | self.client.subscribeToChannel("/delegates_still_rock")
50 | ```
51 |
52 | After you are connected, there are some optional delegate methods that we can implement.
53 |
54 | ### connectedToServer
55 |
56 | connectedToServer is called as soon as the client connects to the Faye server.
57 |
58 | ```swift
59 | func connectedToServer(client: FayeClient) {
60 | println("Connected to Faye server")
61 | }
62 | ```
63 |
64 | ### connectionFailed
65 |
66 | connectionFailed is called when a cleint fails to connect to Faye server either initially or on a retry.
67 |
68 | ```swift
69 | func connectionFailed(client: FayeClient) {
70 | println("Failed to connect to Faye server!")
71 | }
72 | ```
73 |
74 | ### disconnectedFromServer
75 |
76 | disconnectedFromServer is called as soon as the client is disconnected from the server..
77 |
78 | ```swift
79 | func disconnectedFromServer(client: FayeClient) {
80 | println("Disconnected from Faye server")
81 | }
82 | ```
83 |
84 | ### didSubscribeToChannel
85 |
86 | didSubscribeToChannel is called when the subscribes to a Faye channel.
87 |
88 | ```swift
89 | func didSubscribeToChannel(client: FayeClient, channel: String) {
90 | println("subscribed to channel \(channel)")
91 | }
92 | ```
93 |
94 | ### didUnsubscribeFromChannel
95 |
96 | didUnsubscribeFromChannel is called when the client unsubscribes to a Faye channel.
97 |
98 | ```swift
99 | func didUnsubscribeFromChannel(client: FayeClient, channel: String) {
100 | println("UNsubscribed from channel \(channel)")
101 | }
102 | ```
103 |
104 | ### subscriptionFailedWithError
105 |
106 | The subscriptionFailedWithError method is called when the client fails to subscribe to a Faye channel.
107 |
108 | ```swift
109 | func subscriptionFailedWithError(client: FayeClient, error: subscriptionError) {
110 | println("SUBSCRIPTION FAILED!!!!")
111 | }
112 | ```
113 |
114 | ### messageReceived
115 |
116 | The messageReceived is called when the client receives a message from any Faye channel that it is subscribed to.
117 |
118 | ```swift
119 | func messageReceived(client: FayeClient, messageDict: NSDictionary, channel: String) {
120 | let text: AnyObject? = messageDict["text"]
121 | println("Here is the message: \(text)")
122 |
123 | self.client.unsubscribeFromChannel(channel)
124 | }
125 | ```
126 |
127 | The delegate methods give you a simple way to handle data from the server, but how do you publish data to a Faye channel?
128 |
129 |
130 | ### sendMessage
131 |
132 | You can call sendMessage to send a dictionary object to a channel
133 |
134 | ```swift
135 | client.sendMessage(["text": textField.text], channel: "/cool")
136 | ```
137 |
138 | ## Example Server
139 |
140 | There is a sample faye server using the NodeJS Faye library. If you have NodeJS installed just run the following commands to install the package:
141 |
142 | ```javascript
143 | npm install
144 | ```
145 |
146 | And then you can start the Faye server like so:
147 |
148 | ```javascript
149 | node faye_server.js
150 | ```
151 | ## Example Project
152 |
153 | Check out the FayeSwiftDemo project to see how to setup a simple connection to a Faye server.
154 |
155 | ## Requirements
156 |
157 | FayeSwift requires at least iOS 7/OSX 10.10 or above.
158 |
159 | ## TODOs
160 |
161 | - [x] Cocoapods Integration
162 | - [x] Add block handlers
163 | - [x] Complete Docs
164 | - [ ] Add Unit Tests
165 | - [ ] Swift Package Mananger Support
166 | - [ ] Rethink use of optionals (?)
167 | - [ ] Support for a long-polling transport (?)
168 |
169 | ## License
170 |
171 | FayeSwift is licensed under the MIT License.
172 |
173 | ## Libraries
174 |
175 | * [Starscream](https://github.com/daltoniam)
176 | * [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON)
177 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Action.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Action.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | extension FayeClient {
12 |
13 | // MARK: Private - Timer Action
14 | @objc
15 | func pendingSubscriptionsAction(_ timer: Timer) {
16 | guard fayeConnected == true else {
17 | print("Faye: Failed to resubscribe to all pending channels, socket disconnected")
18 |
19 | return
20 | }
21 |
22 | resubscribeToPendingSubscriptions()
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Bayuex.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Bayuex.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 | import SwiftyJSON
11 | // FIXME: comparison operators with optionals were removed from the Swift Standard Libary.
12 | // Consider refactoring the code to use the non-optional operators.
13 | fileprivate func < (lhs: T?, rhs: T?) -> Bool {
14 | switch (lhs, rhs) {
15 | case let (l?, r?):
16 | return l < r
17 | case (nil, _?):
18 | return true
19 | default:
20 | return false
21 | }
22 | }
23 |
24 | // FIXME: comparison operators with optionals were removed from the Swift Standard Libary.
25 | // Consider refactoring the code to use the non-optional operators.
26 | fileprivate func > (lhs: T?, rhs: T?) -> Bool {
27 | switch (lhs, rhs) {
28 | case let (l?, r?):
29 | return l > r
30 | default:
31 | return rhs < lhs
32 | }
33 | }
34 |
35 |
36 | // MARK: Bayuex Connection Type
37 | public enum BayeuxConnection: String {
38 | case LongPolling = "long-polling"
39 | case Callback = "callback-polling"
40 | case iFrame = "iframe"
41 | case WebSocket = "websocket"
42 | }
43 |
44 | // MARK: BayuexChannel Messages
45 | public enum BayeuxChannel: String {
46 | case Handshake = "/meta/handshake"
47 | case Connect = "/meta/connect"
48 | case Disconnect = "/meta/disconnect"
49 | case Subscribe = "/meta/subscribe"
50 | case Unsubscibe = "/meta/unsubscribe"
51 | }
52 |
53 | // MARK: Bayuex Parameters
54 | public enum Bayeux: String {
55 | case Channel = "channel"
56 | case Version = "version"
57 | case ClientId = "clientId"
58 | case ConnectionType = "connectionType"
59 | case Data = "data"
60 | case Subscription = "subscription"
61 | case Id = "id"
62 | case MinimumVersion = "minimumVersion"
63 | case SupportedConnectionTypes = "supportedConnectionTypes"
64 | case Successful = "successful"
65 | case Error = "error"
66 | case Advice = "advice"
67 | }
68 |
69 | // MARK: Private Bayuex Methods
70 | extension FayeClient {
71 |
72 | /**
73 | Bayeux messages
74 | */
75 |
76 | // Bayeux Handshake
77 | // "channel": "/meta/handshake",
78 | // "version": "1.0",
79 | // "minimumVersion": "1.0beta",
80 | // "supportedConnectionTypes": ["long-polling", "callback-polling", "iframe", "websocket]
81 | func handshake() {
82 | writeOperationQueue.sync { [unowned self] in
83 | let connTypes:NSArray = [BayeuxConnection.LongPolling.rawValue, BayeuxConnection.Callback.rawValue, BayeuxConnection.iFrame.rawValue, BayeuxConnection.WebSocket.rawValue]
84 |
85 | var dict = [String: AnyObject]()
86 | dict[Bayeux.Channel.rawValue] = BayeuxChannel.Handshake.rawValue as AnyObject?
87 | dict[Bayeux.Version.rawValue] = "1.0" as AnyObject?
88 | dict[Bayeux.MinimumVersion.rawValue] = "1.0beta" as AnyObject?
89 | dict[Bayeux.SupportedConnectionTypes.rawValue] = connTypes
90 |
91 | if let string = JSON(dict).rawString() {
92 | self.transport?.writeString(string)
93 | }
94 | }
95 | }
96 |
97 | // Bayeux Connect
98 | // "channel": "/meta/connect",
99 | // "clientId": "Un1q31d3nt1f13r",
100 | // "connectionType": "long-polling"
101 | func connect() {
102 | writeOperationQueue.sync { [unowned self] in
103 | let dict:[String:AnyObject] = [
104 | Bayeux.Channel.rawValue: BayeuxChannel.Connect.rawValue as AnyObject,
105 | Bayeux.ClientId.rawValue: self.fayeClientId! as AnyObject,
106 | Bayeux.ConnectionType.rawValue: BayeuxConnection.WebSocket.rawValue as AnyObject,
107 | Bayeux.Advice.rawValue: ["timeout": self.timeOut] as AnyObject
108 | ]
109 |
110 | if let string = JSON(dict).rawString() {
111 | self.transport?.writeString(string)
112 | }
113 | }
114 | }
115 |
116 | // Bayeux Disconnect
117 | // "channel": "/meta/disconnect",
118 | // "clientId": "Un1q31d3nt1f13r"
119 | func disconnect() {
120 | writeOperationQueue.sync { [unowned self] in
121 | let dict:[String:AnyObject] = [Bayeux.Channel.rawValue: BayeuxChannel.Disconnect.rawValue as AnyObject, Bayeux.ClientId.rawValue: self.fayeClientId! as AnyObject, Bayeux.ConnectionType.rawValue: BayeuxConnection.WebSocket.rawValue as AnyObject]
122 | if let string = JSON(dict).rawString() {
123 | self.transport?.writeString(string)
124 | }
125 | }
126 | }
127 |
128 | // Bayeux Subscribe
129 | // "channel": "/meta/subscribe",
130 | // "clientId": "Un1q31d3nt1f13r",
131 | // "subscription": "/foo/**"
132 | func subscribe(_ model:FayeSubscriptionModel) {
133 | writeOperationQueue.sync { [unowned self] in
134 | do {
135 | let json = try model.jsonString()
136 |
137 | self.transport?.writeString(json)
138 | self.pendingSubscriptions.append(model)
139 | } catch FayeSubscriptionModelError.conversationError {
140 |
141 | } catch FayeSubscriptionModelError.clientIdNotValid
142 | where self.fayeClientId?.characters.count > 0 {
143 | var model = model
144 | model.clientId = self.fayeClientId
145 | self.subscribe(model)
146 | } catch {
147 |
148 | }
149 | }
150 | }
151 |
152 | // Bayeux Unsubscribe
153 | // {
154 | // "channel": "/meta/unsubscribe",
155 | // "clientId": "Un1q31d3nt1f13r",
156 | // "subscription": "/foo/**"
157 | // }
158 | func unsubscribe(_ channel:String) {
159 | writeOperationQueue.sync { [unowned self] in
160 | if let clientId = self.fayeClientId {
161 | let dict:[String:AnyObject] = [Bayeux.Channel.rawValue: BayeuxChannel.Unsubscibe.rawValue as AnyObject, Bayeux.ClientId.rawValue: clientId as AnyObject, Bayeux.Subscription.rawValue: channel as AnyObject]
162 |
163 | if let string = JSON(dict).rawString() {
164 | self.transport?.writeString(string)
165 | }
166 | }
167 | }
168 | }
169 |
170 | // Bayeux Publish
171 | // {
172 | // "channel": "/some/channel",
173 | // "clientId": "Un1q31d3nt1f13r",
174 | // "data": "some application string or JSON encoded object",
175 | // "id": "some unique message id"
176 | // }
177 | func publish(_ data:[String:AnyObject], channel:String) {
178 | writeOperationQueue.sync { [weak self] in
179 | if let clientId = self?.fayeClientId, let messageId = self?.nextMessageId(), self?.fayeConnected == true {
180 | let dict:[String:AnyObject] = [
181 | Bayeux.Channel.rawValue: channel as AnyObject,
182 | Bayeux.ClientId.rawValue: clientId as AnyObject,
183 | Bayeux.Id.rawValue: messageId as AnyObject,
184 | Bayeux.Data.rawValue: data as AnyObject
185 | ]
186 |
187 | if let string = JSON(dict).rawString() {
188 | print("Faye: Publish string: \(string)")
189 | self?.transport?.writeString(string)
190 | }
191 | }
192 | }
193 | }
194 | }
195 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Helper.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Helper.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public extension FayeClient {
12 |
13 | // MARK: Helper
14 |
15 | /// Validate whatever a subscription has been subscribed correctly
16 | public func isSubscribedToChannel(_ channel:String) -> Bool {
17 | return self.openSubscriptions.contains { $0.subscription == channel }
18 | }
19 |
20 | /// Validate faye transport is connected
21 | public func isTransportConnected() -> Bool {
22 | return self.transport!.isConnected()
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Parsing.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Parsing.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 | import SwiftyJSON
11 |
12 | extension FayeClient {
13 |
14 | // MARK:
15 | // MARK: Parsing
16 |
17 | func parseFayeMessage(_ messageJSON:JSON) {
18 | let messageDict = messageJSON[0]
19 | if let channel = messageDict[Bayeux.Channel.rawValue].string {
20 |
21 | // Handle Meta Channels
22 | if let metaChannel = BayeuxChannel(rawValue: channel) {
23 | switch(metaChannel) {
24 | case .Handshake:
25 | self.fayeClientId = messageDict[Bayeux.ClientId.rawValue].stringValue
26 | if messageDict[Bayeux.Successful.rawValue].int == 1 {
27 | self.delegate?.connectedToServer(self)
28 | self.fayeConnected = true;
29 | self.connect()
30 | self.subscribeQueuedSubscriptions()
31 | _ = pendingSubscriptionSchedule.isValid
32 | } else {
33 | // OOPS
34 | }
35 | case .Connect:
36 | if messageDict[Bayeux.Successful.rawValue].int == 1 {
37 | self.fayeConnected = true;
38 | self.connect()
39 | } else {
40 | // OOPS
41 | }
42 | case .Disconnect:
43 | if messageDict[Bayeux.Successful.rawValue].int == 1 {
44 | self.fayeConnected = false;
45 | self.transport?.closeConnection()
46 | self.delegate?.disconnectedFromServer(self)
47 | } else {
48 | // OOPS
49 | }
50 | case .Subscribe:
51 | if let success = messageJSON[0][Bayeux.Successful.rawValue].int, success == 1 {
52 | if let subscription = messageJSON[0][Bayeux.Subscription.rawValue].string {
53 | _ = removeChannelFromPendingSubscriptions(subscription)
54 |
55 | self.openSubscriptions.append(FayeSubscriptionModel(subscription: subscription, clientId: fayeClientId))
56 | self.delegate?.didSubscribeToChannel(self, channel: subscription)
57 | } else {
58 | print("Faye: Missing subscription for Subscribe")
59 | }
60 | } else {
61 | // Subscribe Failed
62 | if let error = messageJSON[0][Bayeux.Error.rawValue].string,
63 | let subscription = messageJSON[0][Bayeux.Subscription.rawValue].string {
64 | _ = removeChannelFromPendingSubscriptions(subscription)
65 |
66 | self.delegate?.subscriptionFailedWithError(
67 | self,
68 | error: subscriptionError.error(subscription: subscription, error: error)
69 | )
70 | }
71 | }
72 | case .Unsubscibe:
73 | if let subscription = messageJSON[0][Bayeux.Subscription.rawValue].string {
74 | _ = removeChannelFromOpenSubscriptions(subscription)
75 | self.delegate?.didUnsubscribeFromChannel(self, channel: subscription)
76 | } else {
77 | print("Faye: Missing subscription for Unsubscribe")
78 | }
79 | }
80 | } else {
81 | // Handle Client Channel
82 | if self.isSubscribedToChannel(channel) {
83 | if messageJSON[0][Bayeux.Data.rawValue] != JSON.null {
84 | let data: AnyObject = messageJSON[0][Bayeux.Data.rawValue].object as AnyObject
85 |
86 | if let channelBlock = self.channelSubscriptionBlocks[channel] {
87 | channelBlock(data as! NSDictionary)
88 | } else {
89 | print("Faye: Failed to get channel block for : \(channel)")
90 | }
91 |
92 | self.delegate?.messageReceived(
93 | self,
94 | messageDict: data as! NSDictionary,
95 | channel: channel
96 | )
97 | } else {
98 | print("Faye: For some reason data is nil for channel: \(channel)")
99 | }
100 | } else {
101 | print("Faye: Weird channel that not been set to subscribed: \(channel)")
102 | }
103 | }
104 | } else {
105 | print("Faye: Missing channel for \(messageDict)")
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Subscriptions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Subscriptions.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 | import SwiftyJSON
11 |
12 | // MARK: Private Internal methods
13 | extension FayeClient {
14 |
15 | func subscribeQueuedSubscriptions() {
16 | // if there are any outstanding open subscriptions resubscribe
17 | for channel in self.queuedSubscriptions {
18 | _ = removeChannelFromQueuedSubscriptions(channel.subscription)
19 | _ = subscribeToChannel(channel)
20 | }
21 | }
22 |
23 | func resubscribeToPendingSubscriptions() {
24 | if !pendingSubscriptions.isEmpty {
25 | print("Faye: Resubscribing to \(pendingSubscriptions.count) pending subscriptions")
26 |
27 | for channel in pendingSubscriptions {
28 | _ = removeChannelFromPendingSubscriptions(channel.subscription)
29 | _ = subscribeToChannel(channel)
30 | }
31 | }
32 | }
33 |
34 | func unsubscribeAllSubscriptions() {
35 | let all = queuedSubscriptions + openSubscriptions + pendingSubscriptions
36 |
37 | all.forEach({ unsubscribeFromChannel($0.subscription) })
38 | }
39 |
40 | // MARK:
41 | // MARK: Send/Receive
42 |
43 | func send(_ message: NSDictionary) {
44 | writeOperationQueue.async { [unowned self] in
45 | if let string = JSON(message).rawString() {
46 | self.transport?.writeString(string)
47 | }
48 | }
49 | }
50 |
51 | func receive(_ message: String) {
52 | readOperationQueue.sync { [unowned self] in
53 | if let jsonData = message.data(using: String.Encoding.utf8, allowLossyConversion: false) {
54 | let json = JSON(data: jsonData)
55 |
56 | self.parseFayeMessage(json)
57 | }
58 | }
59 | }
60 |
61 | func nextMessageId() -> String {
62 | self.messageNumber += 1
63 |
64 | if self.messageNumber >= UINT32_MAX {
65 | messageNumber = 0
66 | }
67 |
68 | return "\(self.messageNumber)".encodedString()
69 | }
70 |
71 | // MARK:
72 | // MARK: Subscriptions
73 |
74 | func removeChannelFromQueuedSubscriptions(_ channel: String) -> Bool {
75 | var result = false
76 | queuedSubsLockQueue.sync {
77 | let index = self.queuedSubscriptions.index { $0.subscription == channel }
78 |
79 | if let index = index {
80 | self.queuedSubscriptions.remove(at: index)
81 |
82 | result = true;
83 | }
84 | }
85 |
86 | return result
87 | }
88 |
89 | func removeChannelFromPendingSubscriptions(_ channel: String) -> Bool {
90 | var result = false
91 | pendingSubsLockQueue.sync {
92 | let index = self.pendingSubscriptions.index { $0.subscription == channel }
93 |
94 | if let index = index {
95 | self.pendingSubscriptions.remove(at: index)
96 |
97 | result = true
98 | }
99 | }
100 |
101 | return result
102 | }
103 |
104 | func removeChannelFromOpenSubscriptions(_ channel: String) -> Bool {
105 | var result = false
106 | openSubsLockQueue.sync {
107 | let index = self.openSubscriptions.index { $0.subscription == channel }
108 |
109 | if let index = index {
110 | self.openSubscriptions.remove(at: index)
111 |
112 | result = true
113 | }
114 | }
115 |
116 | return result
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/Sources/FayeClient+Transport.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient+Transport.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 19/07/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | // MARK: Transport Delegate
12 | extension FayeClient {
13 | public func didConnect() {
14 | self.connectionInitiated = false;
15 | self.handshake()
16 | }
17 |
18 | public func didDisconnect(_ error: NSError?) {
19 | self.delegate?.disconnectedFromServer(self)
20 | self.connectionInitiated = false
21 | self.fayeConnected = false
22 | }
23 |
24 | public func didFailConnection(_ error: NSError?) {
25 | self.delegate?.connectionFailed(self)
26 | self.connectionInitiated = false
27 | self.fayeConnected = false
28 | }
29 |
30 | public func didWriteError(_ error: NSError?) {
31 | self.delegate?.fayeClientError(self, error: error ?? NSError(error: .transportWrite))
32 | }
33 |
34 | public func didReceiveMessage(_ text: String) {
35 | self.receive(text)
36 | }
37 |
38 | public func didReceivePong() {
39 | self.delegate?.pongReceived(self)
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Sources/FayeClient.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClient.swift
3 | // FayeSwift
4 | //
5 | // Created by Haris Amin on 8/31/14.
6 | // Copyright (c) 2014 Haris Amin. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import SwiftyJSON
11 |
12 | // MARK: Subscription State
13 | public enum FayeSubscriptionState {
14 | case pending(FayeSubscriptionModel)
15 | case subscribed(FayeSubscriptionModel)
16 | case queued(FayeSubscriptionModel)
17 | case subscribingTo(FayeSubscriptionModel)
18 | case unknown(FayeSubscriptionModel?)
19 | }
20 |
21 | // MARK: Type Aliases
22 | public typealias ChannelSubscriptionBlock = (NSDictionary) -> Void
23 |
24 |
25 | // MARK: FayeClient
26 | open class FayeClient : TransportDelegate {
27 | open var fayeURLString:String {
28 | didSet {
29 | if let transport = self.transport {
30 | transport.urlString = fayeURLString
31 | }
32 | }
33 | }
34 |
35 | open var fayeClientId:String?
36 | open weak var delegate:FayeClientDelegate?
37 |
38 | var transport:WebsocketTransport?
39 | open var transportHeaders: [String: String]? = nil {
40 | didSet {
41 | if let transport = self.transport {
42 | transport.headers = self.transportHeaders
43 | }
44 | }
45 | }
46 |
47 | open internal(set) var fayeConnected:Bool? {
48 | didSet {
49 | if fayeConnected == false {
50 | unsubscribeAllSubscriptions()
51 | }
52 | }
53 | }
54 |
55 | var connectionInitiated:Bool?
56 | var messageNumber:UInt32 = 0
57 |
58 | var queuedSubscriptions = Array()
59 | var pendingSubscriptions = Array()
60 | var openSubscriptions = Array()
61 |
62 | var channelSubscriptionBlocks = Dictionary()
63 |
64 | lazy var pendingSubscriptionSchedule: Timer = {
65 | return Timer.scheduledTimer(
66 | timeInterval: 45,
67 | target: self,
68 | selector: #selector(pendingSubscriptionsAction(_:)),
69 | userInfo: nil,
70 | repeats: true
71 | )
72 | }()
73 |
74 | /// Default in 10 seconds
75 | let timeOut: Int
76 |
77 | let readOperationQueue = DispatchQueue(label: "com.hamin.fayeclient.read", attributes: [])
78 | let writeOperationQueue = DispatchQueue(label: "com.hamin.fayeclient.write", attributes: DispatchQueue.Attributes.concurrent)
79 | let queuedSubsLockQueue = DispatchQueue(label:"com.fayeclient.queuedSubscriptionsLockQueue")
80 | let pendingSubsLockQueue = DispatchQueue(label:"com.fayeclient.pendingSubscriptionsLockQueue")
81 | let openSubsLockQueue = DispatchQueue(label:"com.fayeclient.openSubscriptionsLockQueue")
82 |
83 | // MARK: Init
84 | public init(aFayeURLString:String, channel:String?, timeoutAdvice:Int=10000) {
85 | self.fayeURLString = aFayeURLString
86 | self.fayeConnected = false;
87 | self.timeOut = timeoutAdvice
88 |
89 | self.transport = WebsocketTransport(url: aFayeURLString)
90 | self.transport!.headers = self.transportHeaders
91 | self.transport!.delegate = self;
92 |
93 | if let channel = channel {
94 | self.queuedSubscriptions.append(FayeSubscriptionModel(subscription: channel, clientId: fayeClientId))
95 | }
96 | }
97 |
98 | public convenience init(aFayeURLString:String, channel:String, channelBlock:@escaping ChannelSubscriptionBlock) {
99 | self.init(aFayeURLString: aFayeURLString, channel: channel)
100 | self.channelSubscriptionBlocks[channel] = channelBlock;
101 | }
102 |
103 | deinit {
104 | pendingSubscriptionSchedule.invalidate()
105 | }
106 |
107 | // MARK: Client
108 | open func connectToServer() {
109 | if self.connectionInitiated != true {
110 | self.transport?.openConnection()
111 | self.connectionInitiated = true;
112 | } else {
113 | print("Faye: Connection established")
114 | }
115 | }
116 |
117 | open func disconnectFromServer() {
118 | unsubscribeAllSubscriptions()
119 |
120 | self.disconnect()
121 | }
122 |
123 | open func sendMessage(_ messageDict: NSDictionary, channel:String) {
124 | self.publish(messageDict as! Dictionary, channel: channel)
125 | }
126 |
127 | open func sendMessage(_ messageDict:[String:AnyObject], channel:String) {
128 | self.publish(messageDict, channel: channel)
129 | }
130 |
131 | open func sendPing(_ data: Data, completion: (() -> ())?) {
132 | writeOperationQueue.async { [unowned self] in
133 | self.transport?.sendPing(data, completion: completion)
134 | }
135 | }
136 |
137 | open func subscribeToChannel(_ model:FayeSubscriptionModel, block:ChannelSubscriptionBlock?=nil) -> FayeSubscriptionState {
138 | guard !self.isSubscribedToChannel(model.subscription) else {
139 | return .subscribed(model)
140 | }
141 |
142 | guard !self.pendingSubscriptions.contains(where: { $0 == model }) else {
143 | return .pending(model)
144 | }
145 |
146 | if let block = block {
147 | self.channelSubscriptionBlocks[model.subscription] = block;
148 | }
149 |
150 | if self.fayeConnected == false {
151 | self.queuedSubscriptions.append(model)
152 |
153 | return .queued(model)
154 | }
155 |
156 | self.subscribe(model)
157 |
158 | return .subscribingTo(model)
159 | }
160 |
161 | open func subscribeToChannel(_ channel:String, block:ChannelSubscriptionBlock?=nil) -> FayeSubscriptionState {
162 | return subscribeToChannel(
163 | FayeSubscriptionModel(subscription: channel, clientId: fayeClientId),
164 | block: block
165 | )
166 | }
167 |
168 | open func unsubscribeFromChannel(_ channel:String) {
169 | _ = removeChannelFromQueuedSubscriptions(channel)
170 |
171 | self.unsubscribe(channel)
172 | self.channelSubscriptionBlocks[channel] = nil;
173 |
174 | _ = removeChannelFromOpenSubscriptions(channel)
175 | _ = removeChannelFromPendingSubscriptions(channel)
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/Sources/FayeClientDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeClientDelegate.swift
3 | // Pods
4 | //
5 | // Created by Haris Amin on 2/20/16.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public enum subscriptionError: Error {
12 | case error(subscription: String, error: String)
13 | }
14 |
15 | // MARK: FayeClientDelegate Protocol
16 | public protocol FayeClientDelegate: NSObjectProtocol {
17 | func messageReceived(_ client:FayeClient, messageDict: NSDictionary, channel: String)
18 | func pongReceived(_ client:FayeClient)
19 | func connectedToServer(_ client:FayeClient)
20 | func disconnectedFromServer(_ client:FayeClient)
21 | func connectionFailed(_ client:FayeClient)
22 | func didSubscribeToChannel(_ client:FayeClient, channel:String)
23 | func didUnsubscribeFromChannel(_ client:FayeClient, channel:String)
24 | func subscriptionFailedWithError(_ client:FayeClient, error:subscriptionError)
25 | func fayeClientError(_ client:FayeClient, error:NSError)
26 | }
27 |
28 | public extension FayeClientDelegate {
29 | func messageReceived(_ client:FayeClient, messageDict: NSDictionary, channel: String){}
30 | func pongReceived(_ client:FayeClient){}
31 | func connectedToServer(_ client:FayeClient){}
32 | func disconnectedFromServer(_ client:FayeClient){}
33 | func connectionFailed(_ client:FayeClient){}
34 | func didSubscribeToChannel(_ client:FayeClient, channel:String){}
35 | func didUnsubscribeFromChannel(_ client:FayeClient, channel:String){}
36 | func subscriptionFailedWithError(_ client:FayeClient, error:subscriptionError){}
37 | func fayeClientError(_ client:FayeClient, error:NSError){}
38 | }
39 |
--------------------------------------------------------------------------------
/Sources/FayeSubscriptionModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FayeSubscriptionModel.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 25/04/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 | import SwiftyJSON
11 |
12 | public enum FayeSubscriptionModelError: Error {
13 | case conversationError
14 | case clientIdNotValid
15 | }
16 |
17 | // MARK:
18 | // MARK: FayeSubscriptionModel
19 |
20 | /// Subscription Model
21 | open class FayeSubscriptionModel {
22 |
23 | /// Subscription URL
24 | open let subscription: String
25 |
26 | /// Channel type for request
27 | open let channel: BayeuxChannel
28 |
29 | /// Uniqle client id for socket
30 | open var clientId: String?
31 |
32 | /// Model must conform to Hashable
33 | open var hashValue: Int {
34 | return subscription.hashValue
35 | }
36 |
37 | // MARK:
38 | // MARK: Init
39 |
40 | public init(subscription: String, channel: BayeuxChannel=BayeuxChannel.Subscribe, clientId: String?) {
41 | self.subscription = subscription
42 | self.channel = channel
43 | self.clientId = clientId
44 | }
45 |
46 | // MARK:
47 | // MARK: JSON
48 |
49 | /// Return Json string from model
50 | open func jsonString() throws -> String {
51 | do {
52 | guard let model = try JSON(toDictionary()).rawString() else {
53 | throw FayeSubscriptionModelError.conversationError
54 | }
55 |
56 | return model
57 | } catch {
58 | throw FayeSubscriptionModelError.clientIdNotValid
59 | }
60 | }
61 |
62 | // MARK:
63 | // MARK: Helper
64 |
65 | /// Create dictionary of model object, Subclasses should override method to return custom model
66 | open func toDictionary() throws -> [String: AnyObject] {
67 | guard let clientId = clientId else {
68 | throw FayeSubscriptionModelError.clientIdNotValid
69 | }
70 |
71 | return [Bayeux.Channel.rawValue: channel.rawValue as AnyObject,
72 | Bayeux.ClientId.rawValue: clientId as AnyObject,
73 | Bayeux.Subscription.rawValue: subscription as AnyObject]
74 | }
75 | }
76 |
77 | // MARK:
78 | // MARK: Description
79 |
80 | extension FayeSubscriptionModel: CustomStringConvertible {
81 |
82 | public var description: String {
83 | return "FayeSubscriptionModel: \(try? self.toDictionary())"
84 | }
85 | }
86 |
87 | // MARK:
88 | // MARK: Equatable
89 |
90 | public func ==(lhs: FayeSubscriptionModel, rhs: FayeSubscriptionModel) -> Bool {
91 | return lhs.hashValue == rhs.hashValue
92 | }
93 |
--------------------------------------------------------------------------------
/Sources/NSError+Helper.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSError+Helper.swift
3 | // Pods
4 | //
5 | // Created by Shams Ahmed on 17/02/2016.
6 | //
7 | //
8 |
9 | import Foundation
10 |
11 | public enum FayeSocketError {
12 | case lostConnection, transportWrite
13 | }
14 |
15 | public extension NSError {
16 |
17 | // MARK:
18 | // MARK: Error
19 |
20 | /// Helper to create a error object for faye realted issues
21 | convenience init(error: FayeSocketError) {
22 | self.init(domain: "com.hamin.fayeswift", code: 10000, userInfo: nil)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Sources/StringExtensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // StringExtensions.swift
3 | // Pods
4 | //
5 | // Created by Haris Amin on 2/20/16.
6 | //
7 | //
8 |
9 | // MARK: Custom Extensions
10 | extension String {
11 | subscript (i: Int) -> String {
12 | return String(Array(self.characters)[i])
13 | }
14 |
15 | // http://iosdevelopertips.com/swift-code/base64-encode-decode-swift.html
16 | func encodedString() -> String {
17 | // UTF 8 str from original
18 | // NSData! type returned (optional)
19 | guard let utf8str = self.data(using: String.Encoding.utf8) else {
20 | return ""
21 | }
22 |
23 | // Base64 encode UTF 8 string
24 | // fromRaw(0) is equivalent to objc 'base64EncodedStringWithOptions:0'
25 | // Notice the unwrapping given the NSData! optional
26 | // NSString! returned (optional)
27 | let base64Encoded = utf8str.base64EncodedString(options: NSData.Base64EncodingOptions())
28 |
29 | // Base64 Decode (go back the other way)
30 | // Notice the unwrapping given the NSString! optional
31 | // NSData returned
32 | guard let data = Data(
33 | base64Encoded: base64Encoded,
34 | options: NSData.Base64DecodingOptions()),
35 | let base64Decoded = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else {
36 | return ""
37 | }
38 |
39 | return base64Decoded as String
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Sources/Transport.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Transport.swift
3 | // Pods
4 | //
5 | // Created by Haris Amin on 2/20/16.
6 | //
7 | //
8 |
9 | public protocol Transport {
10 | func writeString(_ aString:String)
11 | func openConnection()
12 | func closeConnection()
13 | func isConnected() -> (Bool)
14 | }
15 |
16 | public protocol TransportDelegate: class {
17 | func didConnect()
18 | func didFailConnection(_ error:NSError?)
19 | func didDisconnect(_ error: NSError?)
20 | func didWriteError(_ error:NSError?)
21 | func didReceiveMessage(_ text:String)
22 | func didReceivePong()
23 | }
24 |
--------------------------------------------------------------------------------
/Sources/WebsocketTransport.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WebsocketTransport.swift
3 | // Pods
4 | //
5 | // Created by Haris Amin on 2/20/16.
6 | //
7 | //
8 |
9 | import Foundation
10 | import Starscream
11 |
12 | internal class WebsocketTransport: Transport, WebSocketDelegate, WebSocketPongDelegate {
13 | var urlString:String?
14 | var webSocket:WebSocket?
15 | var headers: [String: String]? = nil
16 | internal weak var delegate:TransportDelegate?
17 |
18 | convenience required internal init(url: String) {
19 | self.init()
20 |
21 | self.urlString = url
22 | }
23 |
24 | func openConnection() {
25 | self.closeConnection()
26 | self.webSocket = WebSocket(url: URL(string:self.urlString!)!)
27 |
28 | if let webSocket = self.webSocket {
29 | webSocket.delegate = self
30 | webSocket.pongDelegate = self
31 | if let headers = self.headers {
32 | for (key, value) in headers {
33 | webSocket.headers[key] = headers[value]
34 | }
35 | }
36 | webSocket.connect()
37 |
38 | print("Faye: Opening connection with \(self.urlString)")
39 | }
40 | }
41 |
42 | func closeConnection() {
43 | if let webSocket = self.webSocket {
44 | print("Faye: Closing connection")
45 |
46 | webSocket.delegate = nil
47 | webSocket.disconnect(forceTimeout: 0)
48 |
49 | self.webSocket = nil
50 | }
51 | }
52 |
53 | func writeString(_ aString:String) {
54 | self.webSocket?.write(string: aString)
55 | }
56 |
57 | func sendPing(_ data: Data, completion: (() -> ())? = nil) {
58 | self.webSocket?.write(ping: data, completion: completion)
59 | }
60 |
61 | func isConnected() -> (Bool) {
62 | return self.webSocket?.isConnected ?? false
63 | }
64 |
65 | // MARK: Websocket Delegate
66 | internal func websocketDidConnect(socket: WebSocket) {
67 | self.delegate?.didConnect()
68 | }
69 |
70 | internal func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
71 | if error == nil {
72 | self.delegate?.didDisconnect(NSError(error: .lostConnection))
73 | } else {
74 | self.delegate?.didFailConnection(error)
75 | }
76 | }
77 |
78 | internal func websocketDidReceiveMessage(socket: WebSocket, text: String) {
79 | self.delegate?.didReceiveMessage(text)
80 | }
81 |
82 | // MARK: TODO
83 | internal func websocketDidReceiveData(socket: WebSocket, data: Data) {
84 | print("Faye: Received data: \(data.count)")
85 | //self.socket.writeData(data)
86 | }
87 |
88 | // MARK: WebSocket Pong Delegate
89 | internal func websocketDidReceivePong(_ socket: WebSocket) {
90 | self.delegate?.didReceivePong()
91 | }
92 |
93 | func websocketDidReceivePong(socket: WebSocket, data: Data?) {
94 | self.delegate?.didReceivePong()
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------
/faye_publish.js:
--------------------------------------------------------------------------------
1 | var faye = require('faye'),
2 | client = new faye.Client('http://localhost:5222/faye');
3 |
4 |
5 | faye.Logging.logLevel = 'debug';
6 |
7 | client.publish("/cool", {"text": "ok from server nice stuff"})
8 | client.publish("/awesome", {"text": "awesome from server nice stuff"})
9 |
10 | console.log("Message sent!";
--------------------------------------------------------------------------------
/faye_server.js:
--------------------------------------------------------------------------------
1 | var http = require('http'),
2 | faye = require('faye');
3 |
4 |
5 | faye.Logging.logLevel = 'debug';
6 |
7 | var bayeux = new faye.NodeAdapter({
8 | mount: '/faye',
9 | timeout: 45
10 | });
11 |
12 | // Handle non-Bayeux requests
13 | var server = http.createServer(function(request, response) {
14 | response.writeHead(200, {'Content-Type': 'text/plain'});
15 | response.write('Non-Bayeux request');
16 | response.end();
17 | });
18 |
19 | serverLog = {
20 | incoming: function(message, callback) {
21 | console.log("SOMETTHING HAPPENDED!");
22 | if (message.channel === '/meta/subscribe') {
23 | logWithTimeStamp("CLIENT SUBSCRIBED Client ID: " + message.clientId);
24 | }
25 | if (message.channel.match(/\/users\/*/)) {
26 | logWithTimeStamp("USER MESSAGE ON CHANNEL: " + message.channel);
27 | }
28 | return callback(message);
29 | }
30 | };
31 | logWithTimeStamp = function(logMessage) {
32 | var timestampedMessage;
33 | timestampedMessage = "" + (Date()) + " | " + logMessage;
34 | return console.log(timestampedMessage);
35 | };
36 |
37 |
38 | bayeux.bind('handshake', function(client_id) {
39 | console.log("[handshake] - client: '"+ client_id +"'");
40 | });
41 |
42 | bayeux.bind('subscribe', function(client_id, channel) {
43 | console.log("[subscribe] - client: '"+ client_id +"', channel: '"+ channel +"'");
44 | });
45 |
46 | bayeux.bind('unsubscribe', function(client_id, channel) {
47 | console.log("[unsubscribe] - client: '"+ client_id +"', channel: '"+ channel +"'");
48 | });
49 |
50 | bayeux.bind('publish', function(client_id, channel, data) {
51 | console.log("[publish] - client: '"+ client_id +"', channel: '"+ channel +"'");
52 | console.log("[publish] - data:");
53 | console.log(data);
54 | });
55 |
56 | bayeux.bind('connect', function(client_id) {
57 | console.log("[connect] - client: '"+ client_id +"'");
58 | });
59 |
60 |
61 | bayeux.bind('disconnect', function(client_id) {
62 | console.log("[disconnect] - client: '"+ client_id +"'");
63 | });
64 |
65 | bayeux.addExtension(serverLog);
66 | bayeux.attach(server);
67 |
68 |
69 | bayeux.getClient().subscribe('/cool', function(message){
70 | console.log("OMG NEW MESSAGE CAME ***********");
71 | console.log(JSON.stringify(message));
72 | });
73 |
74 | bayeux.getClient().subscribe('/awesome', function(message){
75 | console.log("OMG NEW AWESOME MESSAGE CAME ***********");
76 | console.log(JSON.stringify(message));
77 | });
78 |
79 |
80 | server.listen(5222);
81 | console.log("Started Faye Server");
82 |
83 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "fayeswift-demo",
3 | "version" : "1.0.0",
4 | "dependencies" : {
5 | "faye" : "1.0.3"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/swift-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamin/FayeSwift/fa82be0661fe1b124c540d658570f91ac37a3ae4/swift-logo.png
--------------------------------------------------------------------------------