Skip to content

Commit

Permalink
create isRefreshing(in:)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisho committed Jan 5, 2020
1 parent 3c8d765 commit a6bbce7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Papr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
C0F79DEF2167A5080051232D /* RxPinterestLayoutDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F79DEE2167A5080051232D /* RxPinterestLayoutDelegateProxy.swift */; };
C0F79DF12167A58C0051232D /* PinterestLayout+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F79DF02167A58C0051232D /* PinterestLayout+Rx.swift */; };
DC2E76F8203B6DB90023A173 /* LikeUnlike.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2E76F7203B6DB90023A173 /* LikeUnlike.swift */; };
DC33A2E923C168A300C217FB /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC33A2E823C168A300C217FB /* UIRefreshControl+Rx.swift */; };
DC3917A52096683600492F62 /* CreateCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3917A32096683600492F62 /* CreateCollectionViewController.swift */; };
DC3917A82096683600492F62 /* CreateCollectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC3917A42096683600492F62 /* CreateCollectionViewController.xib */; };
DC3917AC2096684800492F62 /* CreateCollectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3917AB2096684800492F62 /* CreateCollectionViewModel.swift */; };
Expand Down Expand Up @@ -166,6 +167,7 @@
D59E6B0C5E02E5657E3FA6EA /* Pods_PaprUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PaprUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D778F2E1EFA76CEB59A377CB /* Pods_Papr.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Papr.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DC2E76F7203B6DB90023A173 /* LikeUnlike.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LikeUnlike.swift; sourceTree = "<group>"; };
DC33A2E823C168A300C217FB /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+Rx.swift"; sourceTree = "<group>"; };
DC3917A32096683600492F62 /* CreateCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateCollectionViewController.swift; sourceTree = "<group>"; };
DC3917A42096683600492F62 /* CreateCollectionViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CreateCollectionViewController.xib; sourceTree = "<group>"; };
DC3917AB2096684800492F62 /* CreateCollectionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateCollectionViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -768,6 +770,7 @@
DCEE1F131FC983920010BADE /* UIAlertController+Rx.swift */,
DCC8CA1D2002D4C900F6C540 /* ObservableType+Extras.swift */,
DC922308203F95C300C9D14F /* UIBarButtonItem+Rx.swift */,
DC33A2E823C168A300C217FB /* UIRefreshControl+Rx.swift */,
DC487F3F2104E99F0042DBBC /* UIScrollView+Rx.swift */,
C0F79DEE2167A5080051232D /* RxPinterestLayoutDelegateProxy.swift */,
C0F79DF02167A58C0051232D /* PinterestLayout+Rx.swift */,
Expand Down Expand Up @@ -1030,6 +1033,7 @@
DC524CB623B28B1F00F0E05E /* Papr+Error.swift in Sources */,
C0D52CB12181DA7700FB0517 /* Cache.swift in Sources */,
DCCD04142059C19D00670B70 /* UserServiceType.swift in Sources */,
DC33A2E923C168A300C217FB /* UIRefreshControl+Rx.swift in Sources */,
DCBB1B571FA8B823004E95F0 /* SceneCoodinatorType.swift in Sources */,
DCB433C8204B5BAD00C6C80C /* PhotoDetailsViewController.swift in Sources */,
DC7F20931FADD3400017C14A /* SearchResults.swift in Sources */,
Expand Down Expand Up @@ -1251,7 +1255,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = MNK8C69947;
INFOPLIST_FILE = Papr/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1270,7 +1274,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = MNK8C69947;
INFOPLIST_FILE = Papr/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
28 changes: 28 additions & 0 deletions Papr/Utils/Extentions/Rx/UIRefreshControl+Rx.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// UIRefreshControl+Rx.swift
// Papr
//
// Created by Joan Disho on 05.01.20.
// Copyright © 2020 Joan Disho. All rights reserved.
//

import Foundation
import RxSwift
import RxCocoa

extension Reactive where Base: UIRefreshControl {
func isRefreshing(in collectionView: UICollectionView) -> Binder<Bool> {
return Binder(self.base) { refreshControl, refresh in
if refresh {
refreshControl.beginRefreshing()
collectionView.setContentOffset(
CGPoint(x: 0, y: -refreshControl.frame.size.height),
animated: true
)
} else {
refreshControl.endRefreshing()
collectionView.setContentOffset(.zero, animated: true)
}
}
}
}

0 comments on commit a6bbce7

Please sign in to comment.