Skip to content

Commit

Permalink
Update iOS Example supporting Xcode 10 with Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cruisediary committed Oct 6, 2018
1 parent 2dd56bd commit 1dcee2a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iOS Example/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" ~> 4.3
github "ReactiveX/RxSwift" ~> 4.3.1
2 changes: 1 addition & 1 deletion iOS Example/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" "4.3.0"
github "ReactiveX/RxSwift" "4.3.1"
13 changes: 11 additions & 2 deletions iOS Example/iOS Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
B388AB0C1C6567FA00726BCA /* RxMediaPicker.framework */,
B388AAF71C65648700726BCA /* iOS Example */,
B388AAF61C65648700726BCA /* Products */,
FC379B442167D6DA00D47524 /* Recovered References */,
);
sourceTree = "<group>";
};
Expand All @@ -89,6 +90,14 @@
path = "iOS Example";
sourceTree = "<group>";
};
FC379B442167D6DA00D47524 /* Recovered References */ = {
isa = PBXGroup;
children = (
B388AAE91C65640700726BCA /* RxSwift.framework */,
);
name = "Recovered References";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -286,7 +295,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "pt.ruicosta.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -307,7 +316,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "pt.ruicosta.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
8 changes: 4 additions & 4 deletions iOS Example/iOS Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class ViewController: UIViewController, RxMediaPickerDelegate {

let views = ["buttonPhoto": buttonPhoto, "buttonVideo": buttonVideo, "container": container]

var constraints = NSLayoutConstraint.constraints(withVisualFormat: "V:|-50-[buttonPhoto]-20-[buttonVideo]-20-[container(==200)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: .none, views: views)
var constraints = NSLayoutConstraint.constraints(withVisualFormat: "V:|-50-[buttonPhoto]-20-[buttonVideo]-20-[container(==200)]", options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: .none, views: views)

constraints += NSLayoutConstraint.constraints(withVisualFormat: "H:[container(==200)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: .none, views: views)
constraints += NSLayoutConstraint.constraints(withVisualFormat: "H:[container(==200)]", options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: .none, views: views)

constraints.append(NSLayoutConstraint(item: buttonPhoto, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0))
constraints.append(NSLayoutConstraint(item: buttonVideo, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1, constant: 0))
Expand Down Expand Up @@ -62,7 +62,7 @@ class ViewController: UIViewController, RxMediaPickerDelegate {
}
}

func pickPhoto() {
@objc func pickPhoto() {
picker.selectImage(editable: true)
.observeOn(MainScheduler.instance)
.subscribe(onNext: { (image, editedImage) in
Expand All @@ -81,7 +81,7 @@ class ViewController: UIViewController, RxMediaPickerDelegate {
.disposed(by: disposeBag)
}

func recordVideo() {
@objc func recordVideo() {
#if (arch(i386) || arch(x86_64))
let alert = UIAlertController(title: "Error - Simulator", message: "Video recording not available on the simulator", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: .none))
Expand Down

0 comments on commit 1dcee2a

Please sign in to comment.