Skip to content

Commit

Permalink
create map(to:) operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisho committed Jan 6, 2020
1 parent 56e32c6 commit e751107
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Papr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@
TargetAttributes = {
DCBB1B1D1FA7B1BD004E95F0 = {
CreatedOnToolsVersion = 9.0.1;
ProvisioningStyle = Automatic;
ProvisioningStyle = Manual;
};
DCBB1B311FA7B1BD004E95F0 = {
CreatedOnToolsVersion = 9.0.1;
Expand Down Expand Up @@ -1254,7 +1254,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Papr/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
Expand All @@ -1273,7 +1273,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Papr/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
Expand Down
2 changes: 1 addition & 1 deletion Papr/Coodinator/SceneCoodinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SceneCoordinator: NSObject, SceneCoordinatorType {

_ = navigationController.rx.delegate
.sentMessage(#selector(UINavigationControllerDelegate.navigationController(_:didShow:animated:)))
.map { _ in }
.ignoreAll()
.bind(to: subject)

navigationController.pushViewController(SceneCoordinator.actualViewController(for: viewController), animated: true)
Expand Down
2 changes: 1 addition & 1 deletion Papr/Scenes/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class HomeViewController: UIViewController, BindableType {

rightBarButtonItemTap
.merge(with: refreshControl.rx.controlEvent(.valueChanged).asObservable())
.map { _ in true }
.map(to: true)
.bind(to: inputs.refreshProperty)
.disposed(by: disposeBag)

Expand Down
2 changes: 1 addition & 1 deletion Papr/Scenes/Home/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ final class HomeViewModel: HomeViewModelType, HomeViewModelInput, HomeViewModelO
isRefreshing = refreshProperty
isLoadingMore = loadMoreProperty
isOrderBy = orderByProperty
isFirstPageLoaded = firstResult.map { _ in true }
isFirstPageLoaded = firstResult.map(to: true)

homeViewCellModelTypes = Observable.combineLatest(requestedPhotos, cache.getAllObjects(ofType: Photo.self))
.map { photos, cachedPhotos -> [Photo] in
Expand Down
4 changes: 4 additions & 0 deletions Papr/Utils/Extentions/Rx/ObservableType+Extras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ extension ObservableType {
}
}

func map<T>(to value: T) -> Observable<T> {
return map { _ in value }
}

}
extension Observable where Element == String {
func mapToURL() -> Observable<URL> {
Expand Down

0 comments on commit e751107

Please sign in to comment.