This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SWRevealViewController | |
class FrontViewController: UIViewController { | |
/// overlay view | |
lazy var overlayView : UIView = { | |
let view = UIView() | |
view.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.6) | |
return view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SWRevealViewController | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
/// swRevealContainer | |
var swContainer : SWRevealViewController? | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SWRevealViewController | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
/// swRevealContainer | |
var swContainer : SWRevealViewController? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RefreshControl.swift | |
// BusinessDirectory | |
// | |
// Created by mukesh awal on 1/22/20. | |
// Copyright © 2020. All rights reserved. | |
// | |
/****************************************************************** | |
-uses RxSwift and RxCocoa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// call this function after your desired task after refreshing is completed | |
func endRefreshing(){ | |
circleLayer.removeAllAnimations() | |
UIView.animate(withDuration: 0.35, animations: {[weak self] in | |
self?.containerScrollView?.contentInset.top = 0.0 | |
}, completion: {[weak self] _ in | |
self?.refreshingStatus = false | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MARK: - common init | |
private func commonInit(){ | |
shapeLayer.fillColor = setFillColor.cgColor | |
shapeLayer.actions = ["path" : NSNull(), "position" : NSNull(), "bounds" : NSNull()] | |
layer.addSublayer(shapeLayer) | |
shapeLayer.masksToBounds = true | |
circleLayer.lineWidth = 4 | |
circleLayer.strokeColor = setRefreshCircleColor.cgColor | |
circleLayer.fillColor = UIColor.clear.cgColor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func didMoveToSuperview() { | |
super.didMoveToSuperview() | |
addObserver(.contentOffset) | |
addObserver(.panGesture) | |
} | |
//MARK: - observers | |
/// Add scroll view content y offset and scroll view panGesture observers | |
/// - Parameter observer: RefreshControl.Observer type | |
private func addObserver(_ observer : Observer){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RefreshControl.swift | |
// | |
// Created by mukesh awal on 1/22/20. | |
// Copyright © 2020. All rights reserved. | |
// | |
/****************************************************************** | |
-uses RxSwift and RxCocoa | |
-add instance of this class to background of your scroll view | |
****************************** points *********************************** |