Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ActionCableClient.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ActionCableClient"
s.version = "0.2.4"
s.version = "4.2.0"
s.summary = "A Swift client for the Rails ActionCable WebSocket server."
s.description = <<-DESC
ActionCable is a new WebSocket server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going.
Expand All @@ -12,12 +12,12 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/danielrhodes/Swift-ActionCableClient.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/danielrhodes'

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '9.0'
s.requires_arc = true

s.source_files = 'Source/Classes/**/*'
s.frameworks = 'Foundation'
s.dependency 'Starscream', '~> 3.0.3'
s.dependency 'Starscream', '~> 3.0.6'
end
12 changes: 6 additions & 6 deletions ActionCableClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -527,7 +527,7 @@
PRODUCT_NAME = ActionCableClient;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -551,7 +551,7 @@
PRODUCT_NAME = ActionCableClient;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -577,7 +577,7 @@
PRODUCT_NAME = ActionCableClient;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -593,7 +593,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.danielrhodes.ActionCableClient-Test-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -608,7 +608,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.danielrhodes.ActionCableClient-Test-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
44 changes: 5 additions & 39 deletions Example/ActionCableClient-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
86D451531DC31BF9006A516E /* Frameworks */,
86D451541DC31BF9006A516E /* Resources */,
73670B087BDA56514C37256F /* [CP] Embed Pods Frameworks */,
54AE2864EEF206764C29DEB5 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -174,7 +173,6 @@
86D4517E1DC31D73006A516E /* Frameworks */,
86D4517F1DC31D73006A516E /* Resources */,
CB2674BAF940CAB39684678D /* [CP] Embed Pods Frameworks */,
44C432A26A1306534DDB0E9A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -197,7 +195,7 @@
TargetAttributes = {
86D451551DC31BF9006A516E = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
86D451801DC31D73006A516E = {
Expand Down Expand Up @@ -265,36 +263,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
44C432A26A1306534DDB0E9A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ActionCableClient-Example-tvOS/Pods-ActionCableClient-Example-tvOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
54AE2864EEF206764C29DEB5 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ActionCableClient-Example-iOS/Pods-ActionCableClient-Example-iOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
714E8598059A7B374097B96E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -524,8 +492,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "ActionCableClient-Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -541,8 +508,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.danielrhodes.ActionCableClient-Example-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "ActionCableClient-Example-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -557,7 +523,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.danielrhodes.ActionCableClient-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -574,7 +540,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.danielrhodes.ActionCableClient-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Example/ActionCableClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let controller = ChatViewController()
let navigationController = UINavigationController()
navigationController.pushViewController(controller, animated: false)
Expand Down
2 changes: 1 addition & 1 deletion Example/ActionCableClient/ChatCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ChatCell: UITableViewCell {
}
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
textView.frame = CGRect.zero
textView.lineBreakMode = NSLineBreakMode.byWordWrapping
Expand Down
26 changes: 13 additions & 13 deletions Example/ActionCableClient/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ class ChatView : UIView {
super.init(frame: frame)

self.tableView.frame = CGRect.zero
self.tableView.contentInset = UIEdgeInsetsMake(0, -5, 0, 0);
self.tableView.contentInset = UIEdgeInsets(top: 0, left: -5, bottom: 0, right: 0);
self.addSubview(self.tableView)

self.textField.frame = CGRect.zero
self.textField.borderStyle = UITextBorderStyle.bezel
self.textField.borderStyle = UITextField.BorderStyle.bezel
self.textField.returnKeyType = UIReturnKeyType.send
self.textField.placeholder = "Say something..."
self.addSubview(self.textField)

self.backgroundColor = UIColor.white

NotificationCenter.default.addObserver(self, selector: #selector(ChatView.keyboardWillShowNotification(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ChatView.keyboardWillHideNotification(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ChatView.keyboardWillShowNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ChatView.keyboardWillHideNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}

deinit {
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
}

required init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -86,9 +86,9 @@ class ChatView : UIView {
extension ChatView {
@objc func keyboardWillHideNotification(_ notification: Notification) {
let userInfo = (notification as NSNotification).userInfo!
let animationDuration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
let rawAnimationCurve = ((notification as NSNotification).userInfo![UIKeyboardAnimationCurveUserInfoKey] as! NSNumber).uint32Value << 16
let animationCurve = UIViewAnimationOptions(rawValue: UInt(rawAnimationCurve))
let animationDuration = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
let rawAnimationCurve = ((notification as NSNotification).userInfo![UIResponder.keyboardAnimationCurveUserInfoKey] as! NSNumber).uint32Value << 16
let animationCurve = UIView.AnimationOptions(rawValue: UInt(rawAnimationCurve))

UIView.animate(withDuration: animationDuration, delay: 0.0, options: [.beginFromCurrentState, animationCurve], animations: {
self.bottomLayoutConstraint?.update(offset: 0)
Expand All @@ -98,11 +98,11 @@ extension ChatView {

@objc func keyboardWillShowNotification(_ notification: Notification) {
let userInfo = (notification as NSNotification).userInfo!
let animationDuration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
let keyboardEndFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let animationDuration = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
let keyboardEndFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let convertedKeyboardEndFrame = self.convert(keyboardEndFrame, from: self.window)
let rawAnimationCurve = ((notification as NSNotification).userInfo![UIKeyboardAnimationCurveUserInfoKey] as! NSNumber).uint32Value << 16
let animationCurve = UIViewAnimationOptions(rawValue: UInt(rawAnimationCurve))
let rawAnimationCurve = ((notification as NSNotification).userInfo![UIResponder.keyboardAnimationCurveUserInfoKey] as! NSNumber).uint32Value << 16
let animationCurve = UIView.AnimationOptions(rawValue: UInt(rawAnimationCurve))
UIView.animate(withDuration: animationDuration, delay: 0.0, options: [.beginFromCurrentState, animationCurve], animations: {
self.bottomLayoutConstraint?.update(offset: -convertedKeyboardEndFrame.height)
self.updateConstraintsIfNeeded()
Expand Down
12 changes: 6 additions & 6 deletions Example/ActionCableClient/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ChatViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

let alert = UIAlertController(title: "Chat", message: "What's Your Name?", preferredStyle: UIAlertControllerStyle.alert)
let alert = UIAlertController(title: "Chat", message: "What's Your Name?", preferredStyle: UIAlertController.Style.alert)

var nameTextField: UITextField?
alert.addTextField(configurationHandler: {(textField: UITextField!) in
Expand All @@ -75,7 +75,7 @@ class ChatViewController: UIViewController {
nameTextField = textField
})

alert.addAction(UIAlertAction(title: "Start", style: UIAlertActionStyle.default) {(action: UIAlertAction) in
alert.addAction(UIAlertAction(title: "Start", style: UIAlertAction.Style.default) {(action: UIAlertAction) in
self.name = nameTextField?.text
self.chatView?.textField.becomeFirstResponder()
})
Expand Down Expand Up @@ -187,14 +187,14 @@ struct ChatMessage {

func attributedString() -> NSAttributedString {
let messageString: String = "\(self.name) \(self.message)"
let nameRange = NSRange(location: 0, length: self.name.characters.count)
let nonNameRange = NSRange(location: nameRange.length, length: messageString.characters.count - nameRange.length)
let nameRange = NSRange(location: 0, length: self.name.count)
let nonNameRange = NSRange(location: nameRange.length, length: messageString.count - nameRange.length)

let string: NSMutableAttributedString = NSMutableAttributedString(string: messageString)
string.addAttribute(NSAttributedStringKey.font,
string.addAttribute(NSAttributedString.Key.font,
value: UIFont.boldSystemFont(ofSize: 18.0),
range: nameRange)
string.addAttribute(NSAttributedStringKey.font, value: UIFont.systemFont(ofSize: 18.0), range: nonNameRange)
string.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: 18.0), range: nonNameRange)
return string
}
}
4 changes: 2 additions & 2 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use_frameworks!

def common_pods
pod 'ActionCableClient', :path => '../'
pod 'SwiftyJSON'
pod 'SnapKit'
pod 'SwiftyJSON', '~> 4.2.0'
pod 'SnapKit', '~> 4.2.0'
end

def common_test_pods
Expand Down
34 changes: 20 additions & 14 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
PODS:
- ActionCableClient (0.2.3):
- Starscream (~> 2.1.1)
- SnapKit (3.2.0)
- Starscream (2.1.1)
- SwiftyJSON (3.1.4)
- ActionCableClient (4.2.0):
- Starscream (~> 3.0.6)
- SnapKit (4.2.0)
- Starscream (3.0.6)
- SwiftyJSON (4.2.0)

DEPENDENCIES:
- ActionCableClient (from `../`)
- SnapKit
- SwiftyJSON
- SnapKit (~> 4.2.0)
- SwiftyJSON (~> 4.2.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- SnapKit
- Starscream
- SwiftyJSON

EXTERNAL SOURCES:
ActionCableClient:
:path: ../
:path: "../"

SPEC CHECKSUMS:
ActionCableClient: b292c0cb95490f0a5d417729b8052764b1d6babe
SnapKit: 1ca44df72cfa543218d177cb8aab029d10d86ea7
Starscream: 142bd8ef24592d985daee9fa48c936070b85b15f
SwiftyJSON: c2842d878f95482ffceec5709abc3d05680c0220
ActionCableClient: 0c1207b0a8a6922b2b485d2038af0403e7b480c9
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5
SwiftyJSON: c4bcba26dd9ec7a027fc8eade48e2c911f229e96

PODFILE CHECKSUM: dbc0283d807753c3c71ad17b82e66d2742059690
PODFILE CHECKSUM: 9baeb2340906dd1d8d68d40f0ad04b8a2fc1738b

COCOAPODS: 1.3.1
COCOAPODS: 1.5.3