Init project

This commit is contained in:
Merkulov Ilya 2016-04-17 23:38:19 +03:00
parent c4fdf3aa82
commit e3f4862e95
68 changed files with 3038 additions and 0 deletions

View File

@ -0,0 +1,122 @@
//
// RMRPullToRefreshBaseMessageView.swift
// RMRPullToRefreshExample
//
// Created by Merkulov Ilya on 17.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
class RMRPullToRefreshBaseMessageView: RMRPullToRefreshBaseView {
var messageView = UIView(frame: CGRect.zero)
var messageViewLeftConstaint: NSLayoutConstraint?
// MARK: - Init
override init(result: RMRPullToRefreshResultType) {
super.init(result: result)
configure()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Private
func configure() {
configureMessageView()
configureLabel()
}
func configureLabel() {
let label = UILabel(frame: self.messageView.bounds)
label.textColor = UIColor.whiteColor()
label.textAlignment = .Center
label.text = messageText()
messageView.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
for attribute in [NSLayoutAttribute.Top, NSLayoutAttribute.Right, NSLayoutAttribute.Left, NSLayoutAttribute.Bottom] {
messageView.addConstraint(NSLayoutConstraint(item: label,
attribute: attribute,
relatedBy: NSLayoutRelation.Equal,
toItem: messageView,
attribute: attribute,
multiplier: 1,
constant: 0))
}
}
func configureMessageView() {
messageView.backgroundColor = messageBackgroundColor()
messageView.layer.cornerRadius = 5.0
messageView.clipsToBounds = true
addSubview(messageView)
messageView.translatesAutoresizingMaskIntoConstraints = false
let heightConstraint = NSLayoutConstraint(item: messageView,
attribute: NSLayoutAttribute.Height,
relatedBy: NSLayoutRelation.Equal,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 1,
constant: 30)
let widthConstraint = NSLayoutConstraint(item: messageView,
attribute: NSLayoutAttribute.Width,
relatedBy: NSLayoutRelation.Equal,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 1,
constant: 150)
messageView.addConstraints([heightConstraint, widthConstraint])
let verticalConstraint = NSLayoutConstraint(item: messageView,
attribute: .CenterY,
relatedBy: NSLayoutRelation.Equal,
toItem: self,
attribute: .CenterY,
multiplier: 1,
constant: 0)
let leftConstraint = NSLayoutConstraint(item: messageView,
attribute: .Left,
relatedBy: NSLayoutRelation.Equal,
toItem: self,
attribute: .Right,
multiplier: 1,
constant: 0)
addConstraints([verticalConstraint, leftConstraint])
messageViewLeftConstaint = leftConstraint
}
func messageBackgroundColor() -> UIColor {
return UIColor.whiteColor()
}
func messageText() -> String? {
return nil
}
// MARK: - RMRPullToRefreshViewProtocol
override func willEndLoadingAnimation() {
self.logoHorizontalConstraint?.constant = -CGRectGetWidth(self.bounds)/2.0 + CGRectGetWidth(self.logoImageView.bounds)
self.messageViewLeftConstaint?.constant = -CGRectGetWidth(messageView.bounds) - 10.0
UIView.animateWithDuration(0.4) {[weak self] in
self?.layoutIfNeeded()
}
}
override func didEndLoadingAnimation(hidden: Bool) {
super.didEndLoadingAnimation(hidden)
self.logoHorizontalConstraint?.constant = 0.0
self.messageViewLeftConstaint?.constant = 0.0
}
}

View File

@ -0,0 +1,155 @@
//
// RMRPullToRefreshBaseView.swift
// RMRPullToRefreshExample
//
// Created by Merkulov Ilya on 12.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
let image1: String = "redmadlogo-1"
let image2: String = "redmadlogo-2"
let image3: String = "redmadlogo-3"
class RMRPullToRefreshBaseView: RMRPullToRefreshView {
let images = [UIImage(named: image1)!,
UIImage(named: image2)!,
UIImage(named: image3)!]
let logoImageView = UIImageView(image: UIImage(named: image1))
var logoHorizontalConstraint: NSLayoutConstraint?
var result: RMRPullToRefreshResultType?
var isConfigured: Bool = false
var didRotateToTop: Bool = false
var didRotateToBottom: Bool = false
var animating: Bool = true
init(result: RMRPullToRefreshResultType) {
self.result = result
super.init(frame: CGRect.zero)
addSubview(logoImageView)
configureConstraints()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Private
func configureConstraints() {
logoImageView.translatesAutoresizingMaskIntoConstraints = false
let heightConstraint = NSLayoutConstraint(item: logoImageView,
attribute: NSLayoutAttribute.Height,
relatedBy: NSLayoutRelation.Equal,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 1,
constant: 50)
let widthConstraint = NSLayoutConstraint(item: logoImageView,
attribute: NSLayoutAttribute.Width,
relatedBy: NSLayoutRelation.Equal,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 1,
constant: 50)
logoImageView.addConstraints([heightConstraint, widthConstraint])
let verticalConstraint = NSLayoutConstraint(item: logoImageView,
attribute: .CenterY,
relatedBy: NSLayoutRelation.Equal,
toItem: self,
attribute: .CenterY,
multiplier: 1,
constant: 0)
let horizontalConstraint = NSLayoutConstraint(item: logoImageView,
attribute: .CenterX,
relatedBy: NSLayoutRelation.Equal,
toItem: self,
attribute: .CenterX,
multiplier: 1,
constant: 0)
addConstraints([verticalConstraint, horizontalConstraint])
logoHorizontalConstraint = horizontalConstraint
}
func resetTransformIfNecessary() {
if !isConfigured {
logoImageView.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
didRotateToBottom = true
isConfigured = true
}
}
func makeIncreasePulling(animated: Bool) {
didRotateToTop = true
didRotateToBottom = false
let rotateTransform = CGAffineTransformRotate(logoImageView.transform, CGFloat(M_PI));
if animated {
UIView .animateWithDuration(0.4, animations: {
self.logoImageView.transform = rotateTransform
})
} else {
self.logoImageView.transform = rotateTransform
}
}
func makeDecreasePulling(animated: Bool) {
didRotateToBottom = true
didRotateToTop = false
let rotateTransform = CGAffineTransformRotate(logoImageView.transform, -CGFloat(M_PI));
if animated {
UIView .animateWithDuration(0.4, animations: {
self.logoImageView.transform = rotateTransform
})
} else {
self.logoImageView.transform = rotateTransform
}
}
// MARK: - RMRPullToRefreshViewProtocol
override func didChangeDraggingProgress(progress: CGFloat) {
resetTransformIfNecessary()
if progress >= 1.0 && !didRotateToTop && didRotateToBottom {
makeIncreasePulling(animating)
if !animating {
animating = true
}
} else if progress < 1.0 && !didRotateToBottom && didRotateToTop{
makeDecreasePulling(true)
}
}
override func prepareForLoadingAnimation(startProgress: CGFloat) {
if logoImageView.animationImages == nil {
logoImageView.animationImages = images
logoImageView.animationDuration = 0.8
logoImageView.animationRepeatCount = 0
}
}
override func beginLoadingAnimation() {
logoImageView.startAnimating()
}
override func didEndLoadingAnimation(hidden: Bool) {
logoImageView.stopAnimating()
logoImageView.layer.removeAllAnimations()
isConfigured = false
didRotateToTop = false
animating = hidden
}
}

View File

@ -0,0 +1,23 @@
//
// RMRPullToRefreshErrorView.swift
// RMRPullToRefreshExample
//
// Created by Merkulov Ilya on 17.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
class RMRPullToRefreshErrorView: RMRPullToRefreshBaseMessageView {
override func messageText() -> String? {
return "Ошибка"
}
override func messageBackgroundColor() -> UIColor {
return UIColor(red: 234.0/255.0,
green: 33.0/255.0,
blue: 45.0/255.0,
alpha: 1.0)
}
}

View File

@ -0,0 +1,23 @@
//
// RMRPullToRefreshNoUpdatesView.swift
// RMRPullToRefreshExample
//
// Created by Merkulov Ilya on 17.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
class RMRPullToRefreshNoUpdatesView: RMRPullToRefreshBaseMessageView {
override func messageText() -> String? {
return "Нет обновлений"
}
override func messageBackgroundColor() -> UIColor {
return UIColor(red: 148.0/255.0,
green: 199.0/255.0,
blue: 111.0/255.0,
alpha: 1.0)
}
}

View File

@ -0,0 +1,13 @@
//
// RMRPullToRefreshSuccessView.swift
// RMRPullToRefreshExample
//
// Created by Merkulov Ilya on 17.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
class RMRPullToRefreshSuccessView: RMRPullToRefreshBaseView {
}

View File

@ -0,0 +1,24 @@
//
// RMRPullToRefreshViewFactory.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public class RMRPullToRefreshViewFactory: NSObject {
class func create(result: RMRPullToRefreshResultType) -> RMRPullToRefreshView? {
switch result {
case .Success:
return RMRPullToRefreshSuccessView(result: result)
case .NoUpdates:
return RMRPullToRefreshNoUpdatesView(result: result)
case .Error:
return RMRPullToRefreshErrorView(result: result)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,71 @@
//
// RMRPullToRefresh.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 03.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public class RMRPullToRefresh: NSObject {
private var сontroller: RMRPullToRefreshController?
public var height : CGFloat = RMRPullToRefreshConstants.DefaultHeight {
didSet {
сontroller?.configureHeight(height)
}
}
public var backgroundColor : UIColor = RMRPullToRefreshConstants.DefaultBackgroundColor {
didSet {
сontroller?.configureBackgroundColor(backgroundColor)
}
}
public var hideWhenError: Bool = true {
didSet {
сontroller?.hideWhenError = hideWhenError
}
}
public init(scrollView: UIScrollView, position:RMRPullToRefreshPosition, actionHandler: () -> Void) {
super.init()
let controller = RMRPullToRefreshController(scrollView: scrollView,
position: position,
actionHandler: actionHandler)
scrollView.addSubview(controller.containerView)
self.сontroller = controller
}
public func configureView(view :RMRPullToRefreshView, state:RMRPullToRefreshState, result:RMRPullToRefreshResultType) {
сontroller?.configureView(view, state: state, result: result)
}
public func configureView(view :RMRPullToRefreshView) {
сontroller?.configureView(view, result: .Success)
}
public func setupDefaultSettings() {
сontroller?.setupDefaultSettings()
}
public func startLoading() {
сontroller?.startLoading()
}
public func stopLoading() {
stopLoading(.Success)
}
public func stopLoading(result:RMRPullToRefreshResultType) {
сontroller?.stopLoading(result)
}
public func setHideDelay(delay: NSTimeInterval, result: RMRPullToRefreshResultType) {
сontroller?.setHideDelay(delay, result: result)
}
}

View File

@ -0,0 +1,40 @@
//
// RMRPullToRefreshConstants.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public enum RMRPullToRefreshPosition: Int {
case Top
case Bottom
}
public enum RMRPullToRefreshState: Int {
case Stopped
case Dragging
case Loading
}
public enum RMRPullToRefreshResultType: Int {
case Success = 0
case NoUpdates
case Error
}
public struct RMRPullToRefreshConstants {
struct KeyPaths {
static let ContentOffset = "contentOffset"
static let ContentSize = "contentSize"
static let ContentInset = "contentInset"
static let PanState = "pan.state"
static let Frame = "frame"
}
static let DefaultHeight = CGFloat(90.0)
static let DefaultBackgroundColor = UIColor.whiteColor()
}

View File

@ -0,0 +1,90 @@
//
// RMRPullToRefreshContainerView.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public class RMRPullToRefreshContainerView: UIView {
var currentView: RMRPullToRefreshView?
var storage = [String: RMRPullToRefreshView]()
public func configureView(view:RMRPullToRefreshView, state:RMRPullToRefreshState, result:RMRPullToRefreshResultType) {
let key = storageKey(state, result:result)
self.storage[key] = view
}
func updateView(state: RMRPullToRefreshState, result: RMRPullToRefreshResultType) {
clear()
if let view = obtainView(state, result: result) {
view.translatesAutoresizingMaskIntoConstraints = false
addSubview(view)
addConstraint(constraint(self, subview: view, attribute: NSLayoutAttribute.Left))
addConstraint(constraint(self, subview: view, attribute: NSLayoutAttribute.Top))
addConstraint(constraint(self, subview: view, attribute: NSLayoutAttribute.Right))
addConstraint(constraint(self, subview: view, attribute: NSLayoutAttribute.Bottom))
view.layoutIfNeeded()
self.currentView = view
}
}
func dragging(progress: CGFloat) {
if let view = self.currentView {
view.didChangeDraggingProgress(progress)
}
}
func startLoadingAnimation(startProgress: CGFloat) {
if let view = self.currentView {
if !view.pullToRefreshIsLoading {
view.prepareForLoadingAnimation(startProgress)
view.pullToRefreshIsLoading = true
view.beginLoadingAnimation()
}
}
}
func prepareForStopAnimations() {
if let view = self.currentView {
view.willEndLoadingAnimation()
}
}
func stopAllAnimations(hidden: Bool) {
for view in storage.values {
view.didEndLoadingAnimation(hidden)
view.pullToRefreshIsLoading = false
}
}
// MARK: - Private
func clear() {
for view in subviews {
view.removeFromSuperview()
}
self.currentView = nil
}
func obtainView(state: RMRPullToRefreshState, result: RMRPullToRefreshResultType) -> RMRPullToRefreshView? {
let key = storageKey(state, result:result)
return self.storage[key]
}
func storageKey(state: RMRPullToRefreshState, result: RMRPullToRefreshResultType) -> String {
return String(state.rawValue) + "_" + String(result.rawValue)
}
// MARK: - Constraint
func constraint(superview: UIView, subview: UIView, attribute: NSLayoutAttribute) -> NSLayoutConstraint {
return NSLayoutConstraint(item: subview, attribute: attribute, relatedBy: NSLayoutRelation.Equal, toItem: superview, attribute: attribute, multiplier: 1, constant: 0)
}
}

View File

@ -0,0 +1,397 @@
//
// RMRPullToRefreshController.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public class RMRPullToRefreshController: NSObject {
// MARK: - Vars
weak var scrollView: UIScrollView?
let containerView = RMRPullToRefreshContainerView()
let backgroundView = UIView(frame: CGRectZero)
var backgroundViewHeightConstraint: NSLayoutConstraint?
var backgroundViewTopConstraint: NSLayoutConstraint?
var stopped = true
var subscribing = false
var actionHandler: (() -> Void)!
var height = CGFloat(0.0)
var originalTopInset = CGFloat(0.0)
var originalBottomInset = CGFloat(0.0)
var state = RMRPullToRefreshState.Stopped
var result = RMRPullToRefreshResultType.Success
var position: RMRPullToRefreshPosition?
var changingContentInset = false
var contentSizeWhenStartLoading: CGSize?
var hideDelayValues = [RMRPullToRefreshResultType: NSTimeInterval]()
public var hideWhenError: Bool = true
// MARK: - Init
init(scrollView: UIScrollView, position:RMRPullToRefreshPosition, actionHandler: () -> Void) {
super.init()
self.scrollView = scrollView
self.actionHandler = actionHandler
self.position = position
self.configureBackgroundView(self.backgroundView)
self.configureHeight()
self.containerView.backgroundColor = UIColor.clearColor()
self.subscribeOnScrollViewEvents()
}
deinit {
self.unsubscribeFromScrollViewEvents()
}
private func configureBackgroundView(backgroundView: UIView) {
backgroundView.translatesAutoresizingMaskIntoConstraints = false
scrollView?.addSubview(backgroundView)
addBackgroundViewConstraints(backgroundView)
}
private func addBackgroundViewConstraints(backgroundView: UIView) {
// Constraints
self.backgroundViewHeightConstraint = NSLayoutConstraint(item: backgroundView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 0)
backgroundView.addConstraint(self.backgroundViewHeightConstraint!)
scrollView?.addConstraint(NSLayoutConstraint(item: backgroundView, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: scrollView, attribute: NSLayoutAttribute.Width, multiplier: 1, constant: 0))
if position == .Top {
scrollView?.addConstraint(NSLayoutConstraint(item: backgroundView, attribute: NSLayoutAttribute.Bottom, relatedBy: NSLayoutRelation.Equal, toItem: scrollView, attribute: NSLayoutAttribute.Top, multiplier: 1, constant: 0))
} else if position == .Bottom, let scrollView = self.scrollView {
let constant = max(scrollView.contentSize.height, CGRectGetHeight(scrollView.bounds))
self.backgroundViewTopConstraint = NSLayoutConstraint(item: backgroundView, attribute: NSLayoutAttribute.Top, relatedBy: NSLayoutRelation.Equal, toItem: scrollView, attribute: NSLayoutAttribute.Top, multiplier: 1, constant: constant)
scrollView.addConstraint(self.backgroundViewTopConstraint!)
}
}
private func configureHeight() {
if let scrollView = self.scrollView {
self.originalTopInset = scrollView.contentInset.top
self.originalBottomInset = scrollView.contentInset.bottom
}
configureHeight(RMRPullToRefreshConstants.DefaultHeight)
}
// MARK: - Public
public func configureView(view:RMRPullToRefreshView, result:RMRPullToRefreshResultType) {
configureView(view, state: .Loading, result: result)
configureView(view, state: .Dragging, result: result)
configureView(view, state: .Stopped, result: result)
}
public func configureView(view:RMRPullToRefreshView, state:RMRPullToRefreshState, result:RMRPullToRefreshResultType) {
containerView.configureView(view, state: state, result: result)
}
public func configureHeight(height: CGFloat) {
self.height = height
updateContainerFrame()
}
public func configureBackgroundColor(color: UIColor) {
self.backgroundView.backgroundColor = color
}
public func setupDefaultSettings() {
setupDefaultSettings(.Success, hideDelay: 0.0)
setupDefaultSettings(.NoUpdates, hideDelay: 2.0)
setupDefaultSettings(.Error, hideDelay: 2.0)
configureBackgroundColor(UIColor.whiteColor())
updateContainerView(self.state)
}
public func startLoading() {
startLoading(0.0)
}
public func stopLoading(result:RMRPullToRefreshResultType) {
self.result = result
self.state = .Stopped
updateContainerView(self.state)
containerView.prepareForStopAnimations()
let delay = hideDelay(result)
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), { [weak self] in
if self?.shouldHideWhenStopLoading() == true {
self?.resetContentInset()
if let position = self?.position {
switch (position) {
case .Top:
self?.scrollToTop(true)
case .Bottom:
self?.scrollToBottom(true)
}
}
self?.contentSizeWhenStartLoading = nil
self?.performSelector(#selector(self?.resetBackgroundViewHeightConstraint), withObject: nil, afterDelay: 0.4)
}
self?.performSelector(#selector(self?.stopAllAnimations), withObject: nil, afterDelay: 0.4)
})
}
public func setHideDelay(delay: NSTimeInterval, result: RMRPullToRefreshResultType) {
hideDelayValues[result] = delay
}
// MARK: - Private
func setupDefaultSettings(result:RMRPullToRefreshResultType, hideDelay: NSTimeInterval) {
if let view = RMRPullToRefreshViewFactory.create(result) {
configureView(view, result: result)
setHideDelay(hideDelay, result: result)
}
}
func scrollToTop(animated: Bool) {
if let scrollView = self.scrollView {
if scrollView.contentOffset.y < -originalTopInset {
let offset = CGPointMake(scrollView.contentOffset.x, -self.originalTopInset)
scrollView.setContentOffset(offset, animated: true)
}
}
}
func scrollToBottom(animated: Bool) {
if let scrollView = self.scrollView {
var offset = scrollView.contentOffset
if let contentSize = self.contentSizeWhenStartLoading {
offset.y = contentSize.height - CGRectGetHeight(scrollView.bounds) + scrollView.contentInset.bottom
if state == .Stopped {
if scrollView.contentOffset.y < offset.y {
return
} else if scrollView.contentOffset.y > offset.y {
offset.y += height
}
}
} else {
offset.y = scrollView.contentSize.height - CGRectGetHeight(scrollView.bounds) + scrollView.contentInset.bottom
}
scrollView.setContentOffset(offset, animated: animated)
}
}
func startLoading(startProgress: CGFloat) {
stopped = false
contentSizeWhenStartLoading = scrollView?.contentSize
state = .Loading
updateContainerView(state)
actionHandler()
containerView.startLoadingAnimation(startProgress)
}
@objc private func stopAllAnimations() {
stopped = true
containerView.stopAllAnimations(shouldHideWhenStopLoading())
}
@objc private func resetBackgroundViewHeightConstraint() {
backgroundViewHeightConstraint?.constant = 0
}
private func scrollViewDidChangePanState(scrollView: UIScrollView, panState: UIGestureRecognizerState) {
if panState == .Ended || panState == .Cancelled || panState == .Failed {
if state == .Loading {
return
}
var y: CGFloat = 0.0
if position == .Top {
y = -scrollView.contentOffset.y
} else if position == .Bottom {
y = -(scrollView.contentSize.height - (scrollView.contentOffset.y + CGRectGetHeight(scrollView.bounds) + originalBottomInset));
}
if y >= height && stopped {
startLoading(y/height)
// inset
var inset = scrollView.contentInset
if position == .Top {
inset.top = originalTopInset+height
} else if position == .Bottom {
inset.bottom = originalBottomInset+height
}
setContentInset(inset, animated: true)
} else {
state = .Stopped
updateContainerView(state)
if !shouldHideWhenStopLoading() {
var inset = scrollView.contentInset
inset.top = 0.0
inset.bottom = 0.0
setContentInset(inset, animated: true)
}
}
}
}
private func scrollViewDidChangeContentSize(scrollView: UIScrollView, contentSize: CGSize) {
updateContainerFrame()
if position == .Bottom {
self.backgroundViewTopConstraint?.constant = max(scrollView.contentSize.height, CGRectGetHeight(scrollView.bounds))
if changingContentInset {
scrollToBottom(true)
}
}
}
private func scrollViewDidScroll(scrollView: UIScrollView, contentOffset: CGPoint) {
if scrollView.dragging && state == .Stopped {
state = .Dragging
updateContainerView(state)
}
var y: CGFloat = 0.0
if position == .Top {
y = -(contentOffset.y)
} else if position == .Bottom {
y = -(scrollView.contentSize.height - (contentOffset.y + CGRectGetHeight(scrollView.bounds) + originalBottomInset))
}
if y > 0 {
if state == .Dragging {
containerView.dragging(y/height)
}
configureBackgroundHeightConstraint(y, contentInset: scrollView.contentInset)
}
}
private func configureBackgroundHeightConstraint(contentOffsetY: CGFloat, contentInset: UIEdgeInsets) {
var constant = CGFloat(-1.0)
if position == .Top {
constant = contentOffsetY + contentInset.top
} else {
constant = contentOffsetY + contentInset.bottom
}
if constant > 0 && constant > backgroundViewHeightConstraint?.constant {
backgroundViewHeightConstraint?.constant = constant
}
}
func updateContainerView(state: RMRPullToRefreshState) {
containerView.updateView(state, result: self.result)
}
func updateContainerFrame() {
if let scrollView = self.scrollView, let position = self.position {
var frame = CGRectZero
switch (position) {
case .Top:
frame = CGRectMake(0, -height, CGRectGetWidth(scrollView.bounds), height)
case .Bottom:
let y = max(scrollView.contentSize.height, CGRectGetHeight(scrollView.bounds))
frame = CGRectMake(0, y, CGRectGetWidth(scrollView.bounds), height)
}
self.containerView.frame = frame
}
}
func resetContentInset() {
if let scrollView = scrollView, let position = self.position {
var inset = scrollView.contentInset
switch (position) {
case .Top:
inset.top = originalTopInset
case .Bottom:
inset.bottom = originalBottomInset
}
setContentInset(inset, animated: true)
}
}
func setContentInset(contentInset: UIEdgeInsets, animated: Bool) {
changingContentInset = true
UIView.animateWithDuration(0.3,
delay: 0.0,
options: UIViewAnimationOptions.BeginFromCurrentState,
animations: { () -> Void in
self.scrollView?.contentInset = contentInset
}, completion: { (finished) -> Void in
self.changingContentInset = false
})
}
func checkContentSize(scrollView: UIScrollView) -> Bool{
let height = CGRectGetHeight(scrollView.bounds)
if scrollView.contentSize.height < height {
scrollView.contentSize = CGSizeMake(scrollView.contentSize.width, height)
return false
}
return true
}
func shouldHideWhenStopLoading() -> Bool{
return (result != .Error) || (result == .Error && hideWhenError)
}
func hideDelay(result: RMRPullToRefreshResultType) -> NSTimeInterval {
if let delay = hideDelayValues[result] {
return delay
}
return 0.0
}
// MARK: - KVO
public func subscribeOnScrollViewEvents() {
if !subscribing, let scrollView = self.scrollView {
scrollView.addObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.ContentOffset, options: .New, context: nil)
scrollView.addObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.ContentSize, options: .New, context: nil)
scrollView.addObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.PanState, options: .New, context: nil)
subscribing = true
}
}
public func unsubscribeFromScrollViewEvents() {
if subscribing, let scrollView = self.containerView.superview {
scrollView.removeObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.ContentOffset)
scrollView.removeObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.ContentSize)
scrollView.removeObserver(self, forKeyPath: RMRPullToRefreshConstants.KeyPaths.PanState)
subscribing = false
}
}
override public func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
if keyPath == RMRPullToRefreshConstants.KeyPaths.ContentOffset {
if let newContentOffset = change?[NSKeyValueChangeNewKey]?.CGPointValue, scrollView = self.scrollView {
scrollViewDidScroll(scrollView, contentOffset:newContentOffset)
}
} else if keyPath == RMRPullToRefreshConstants.KeyPaths.ContentSize {
if let newContentSize = change?[NSKeyValueChangeNewKey]?.CGSizeValue(), scrollView = self.scrollView {
if checkContentSize(scrollView) {
scrollViewDidChangeContentSize(scrollView, contentSize: newContentSize)
}
}
} else if keyPath == RMRPullToRefreshConstants.KeyPaths.PanState {
if let rawValue = change?[NSKeyValueChangeNewKey] as? Int {
if let state = UIGestureRecognizerState(rawValue: rawValue), scrollView = self.scrollView {
scrollViewDidChangePanState(scrollView, panState: state)
}
}
}
}
}

View File

@ -0,0 +1,25 @@
//
// RMRPullToRefreshView.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 03.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public class RMRPullToRefreshView: UIView, RMRPullToRefreshViewProtocol {
var pullToRefreshIsLoading = false
// Begin Loading
public func prepareForLoadingAnimation(startProgress: CGFloat) {}
public func beginLoadingAnimation() {}
// End Loading
public func willEndLoadingAnimation() {}
public func didEndLoadingAnimation(hidden: Bool) {}
// Dragging
public func didChangeDraggingProgress(progress: CGFloat) {}
}

View File

@ -0,0 +1,23 @@
//
// RMRPullToRefreshViewProtocol.swift
// RMRPullToRefreshViewProtocol
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
public protocol RMRPullToRefreshViewProtocol {
// Begin Loading
func prepareForLoadingAnimation(startProgress: CGFloat)
func beginLoadingAnimation()
// End Loading
func willEndLoadingAnimation()
func didEndLoadingAnimation(hidden: Bool)
// Dragging
func didChangeDraggingProgress(progress: CGFloat)
}

5
Example/Podfile Normal file
View File

@ -0,0 +1,5 @@
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'RMRPullToRefresh', :git => "https://git.redmadrobot.com/im/RMRPullToRefresh"

View File

@ -0,0 +1,46 @@
//
// AppDelegate.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@ -0,0 +1,38 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "beeline.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_satellite.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_big.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_big_right.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_medium.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_medium_right.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_small_right.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icon_wave_small.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ico-logo-loader2.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "perekrestok.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redmadlogo-1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redmadlogo-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redmadlogo-3.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redmadlogo-4.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redmadlogo-5.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,325 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="9wl-A7-LQ4">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="9pF-HW-aEu">
<objects>
<navigationController id="9wl-A7-LQ4" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="yyl-ZQ-eby">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</navigationBar>
<connections>
<segue destination="oE2-vv-go7" kind="relationship" relationship="rootViewController" id="7GL-Am-OfG"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jEm-VL-aI5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-363" y="324"/>
</scene>
<!--Table View Controller-->
<scene sceneID="xmD-iM-370">
<objects>
<tableViewController id="oE2-vv-go7" customClass="TableViewController" customModule="RMRPullToRefreshExample" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="C22-ld-kpl">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<sections>
<tableViewSection headerTitle="Perekrestok" id="OAd-tH-sE5">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Qw1-Fc-VoV" detailTextLabel="nOn-mL-Lrw" imageView="6OD-og-tgv" style="IBUITableViewCellStyleValue1" id="Ig2-F0-5fB">
<rect key="frame" x="0.0" y="113.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ig2-F0-5fB" id="f8z-M3-Z4V">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Perekrestok" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Qw1-Fc-VoV">
<rect key="frame" x="74" y="12" width="86.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Top" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="nOn-mL-Lrw">
<rect key="frame" x="537.5" y="12" width="27.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="perekrestok" id="6OD-og-tgv">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="perekrestok_top" id="TFF-yS-c1s"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="3b8-Kd-0Uw" detailTextLabel="U1K-Un-yBw" imageView="a26-Gq-xeL" style="IBUITableViewCellStyleValue1" id="EN2-bQ-yTK">
<rect key="frame" x="0.0" y="157.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EN2-bQ-yTK" id="YBm-bQ-aP7">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Perekrestok" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3b8-Kd-0Uw">
<rect key="frame" x="74" y="12" width="86.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Bottom" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="U1K-Un-yBw">
<rect key="frame" x="512" y="12" width="53" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="perekrestok" id="a26-Gq-xeL">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="perekrestok_bottom" id="RNW-CJ-jxH"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Beeline" id="Bp3-dz-9Zb">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="HlT-ZI-pLV" detailTextLabel="Sne-Dt-pmd" imageView="IEL-Td-m6Q" style="IBUITableViewCellStyleValue1" id="t3C-cF-xlh">
<rect key="frame" x="0.0" y="251.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="t3C-cF-xlh" id="5E2-Ik-tgT">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Beeline" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HlT-ZI-pLV">
<rect key="frame" x="74" y="12" width="53.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Top" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Sne-Dt-pmd">
<rect key="frame" x="537.5" y="12" width="27.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="beeline" id="IEL-Td-m6Q">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="beeline_top" id="fYV-4v-KDg"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="uHd-tI-cbh" detailTextLabel="Nfu-Qc-1Gp" imageView="NLI-8k-jWy" style="IBUITableViewCellStyleValue1" id="Qxr-CU-ozv">
<rect key="frame" x="0.0" y="295.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Qxr-CU-ozv" id="LDM-NR-x0D">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Beeline" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="uHd-tI-cbh">
<rect key="frame" x="74" y="12" width="53.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Bottom" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Nfu-Qc-1Gp">
<rect key="frame" x="512" y="12" width="53" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="beeline" id="NLI-8k-jWy">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="beeline_bottom" id="4uj-Hk-qQa"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Default" id="YNv-qE-Ndq">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Hod-kU-jvC" detailTextLabel="MHK-Eb-EhW" imageView="LAe-1f-zZu" style="IBUITableViewCellStyleValue1" id="uGe-5R-mhz">
<rect key="frame" x="0.0" y="389.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="uGe-5R-mhz" id="h7j-2o-NcK">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Redmadrobot" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Hod-kU-jvC">
<rect key="frame" x="74" y="12" width="99" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Top" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="MHK-Eb-EhW">
<rect key="frame" x="537.5" y="12" width="27.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="redmadlogo-1" id="LAe-1f-zZu">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="redmadrobot_top" id="bVQ-YS-miM"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="PEJ-1c-whb" detailTextLabel="cmt-br-dNG" imageView="1iM-wK-6Uf" style="IBUITableViewCellStyleValue1" id="Mlu-1N-6jM">
<rect key="frame" x="0.0" y="433.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Mlu-1N-6jM" id="Xfk-9c-f5n">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Redmadrobot" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PEJ-1c-whb">
<rect key="frame" x="74" y="12" width="99" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Bottom" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cmt-br-dNG">
<rect key="frame" x="512" y="12" width="53" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="redmadlogo-1" id="1iM-wK-6Uf">
<rect key="frame" x="15" y="0.0" width="44" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="redmadrobot_bottom" id="90v-kF-FBQ"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="oE2-vv-go7" id="EnW-yw-Kts"/>
<outlet property="delegate" destination="oE2-vv-go7" id="QCr-4q-BiM"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="VMh-YZ-Hcy"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2e9-Jk-9A8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="269" y="324"/>
</scene>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="BYZ-38-t0r" customClass="ViewController" customModule="RMRPullToRefreshExample" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="qa0-J0-SDd">
<rect key="frame" x="0.0" y="64" width="600" height="536"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="separatorColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="pxY-0R-2l7" style="IBUITableViewCellStyleDefault" id="RzC-n2-Iry">
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="RzC-n2-Iry" id="QD1-aM-jfC">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pxY-0R-2l7">
<rect key="frame" x="15" y="0.0" width="570" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="BYZ-38-t0r" id="Ro5-zm-IPq"/>
<outlet property="delegate" destination="BYZ-38-t0r" id="R5G-u3-EK8"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="qa0-J0-SDd" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="64" id="6Du-Fj-JAv"/>
<constraint firstItem="qa0-J0-SDd" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="ONC-Bk-CbX"/>
<constraint firstItem="qa0-J0-SDd" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="ZF5-05-yo8"/>
<constraint firstAttribute="trailing" secondItem="qa0-J0-SDd" secondAttribute="trailing" id="t5H-Y7-TXM"/>
<constraint firstAttribute="bottom" secondItem="qa0-J0-SDd" secondAttribute="bottom" id="wci-UD-g9n"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="ZF5-05-yo8"/>
</mask>
</variation>
</view>
<navigationItem key="navigationItem" id="nVT-1c-q1u">
<barButtonItem key="rightBarButtonItem" title="Settings" id="IfG-YD-EAU">
<connections>
<action selector="settings:" destination="BYZ-38-t0r" id="5Fr-Qf-iI5"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="tableView" destination="qa0-J0-SDd" id="5mP-LI-xum"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1011" y="324"/>
</scene>
</scenes>
<resources>
<image name="beeline" width="175" height="175"/>
<image name="perekrestok" width="175" height="175"/>
<image name="redmadlogo-1" width="216" height="216"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="90v-kF-FBQ"/>
</inferredMetricsTieBreakers>
</document>

View File

@ -0,0 +1,85 @@
//
// BeelineView.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 10.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
import RMRPullToRefresh
enum AnimationStage: Int {
case Stage1 // big medium small
case Stage2 // big medium
case Stage3 // big
case Stage4 //
case Stage5 // big
case Stage6 // big medium
static var count: Int { return AnimationStage.Stage6.hashValue + 1}
}
class BeelineView: RMRPullToRefreshView {
@IBOutlet var bigIcons: [UIImageView]!
@IBOutlet var mediumIcons: [UIImageView]!
@IBOutlet var smallIcons: [UIImageView]!
var animationIsCanceled = false
var animationStage: AnimationStage?
class func XIB_VIEW() -> BeelineView? {
let subviewArray = NSBundle.mainBundle().loadNibNamed("BeelineView", owner: self, options: nil)
return subviewArray.first as? BeelineView
}
// MARK: - Private
func hideBigIcons(hide: Bool) {
for iV in bigIcons { iV.hidden = hide }
}
func hideMediumIcons(hide: Bool) {
for iV in mediumIcons { iV.hidden = hide }
}
func hideSmallIcons(hide: Bool) {
for iV in smallIcons { iV.hidden = hide }
}
@objc func executeAnimation() {
if animationIsCanceled {
return
}
hideBigIcons(animationStage == .Stage4)
hideMediumIcons(animationStage == .Stage3 || animationStage == .Stage4 || animationStage == .Stage5)
hideSmallIcons(animationStage != .Stage1)
if let stage = animationStage {
animationStage = AnimationStage(rawValue: (stage.rawValue+1)%AnimationStage.count)
}
performSelector(#selector(executeAnimation), withObject: nil, afterDelay: 0.4)
}
// MARK: - RMRPullToRefreshViewProtocol
override func didChangeDraggingProgress(progress: CGFloat) {
hideBigIcons(progress < 0.33)
hideMediumIcons(progress < 0.66)
hideSmallIcons(progress < 0.99)
}
override func beginLoadingAnimation() {
animationIsCanceled = false
animationStage = .Stage1
executeAnimation()
}
override func didEndLoadingAnimation(hidden: Bool) {
animationIsCanceled = true
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="BeelineView" customModule="RMRPullToRefreshExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="70"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_satellite" translatesAutoresizingMaskIntoConstraints="NO" id="kO2-ae-QwA">
<rect key="frame" x="135" y="24" width="50" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="2XU-7O-oJ7"/>
<constraint firstAttribute="height" constant="22" id="4Mi-Gl-LKl"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_big_right" translatesAutoresizingMaskIntoConstraints="NO" id="59N-Rz-RXJ">
<rect key="frame" x="203" y="28" width="5" height="13"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="6wI-SU-DUZ"/>
<constraint firstAttribute="height" constant="13" id="Gdc-yQ-Qon"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_medium_right" translatesAutoresizingMaskIntoConstraints="NO" id="N95-3w-wkw">
<rect key="frame" x="225" y="29" width="5" height="11"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="PmF-2f-qMx"/>
<constraint firstAttribute="height" constant="11" id="gXP-5o-5mB"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_small_right" translatesAutoresizingMaskIntoConstraints="NO" id="ocR-SD-NK2">
<rect key="frame" x="246" y="30" width="4" height="9"/>
<constraints>
<constraint firstAttribute="height" constant="9" id="APg-dX-rYD"/>
<constraint firstAttribute="width" constant="4" id="esu-sV-QcM"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_big" translatesAutoresizingMaskIntoConstraints="NO" id="po3-19-Vcz">
<rect key="frame" x="112" y="28" width="5" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="GXj-wt-1fx"/>
<constraint firstAttribute="width" constant="5" id="VOE-sn-frV"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_medium" translatesAutoresizingMaskIntoConstraints="NO" id="VPC-oK-CyP">
<rect key="frame" x="90" y="29" width="5" height="11"/>
<constraints>
<constraint firstAttribute="height" constant="11" id="I4A-0i-6az"/>
<constraint firstAttribute="width" constant="5" id="gwv-nb-4CT"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_wave_small" translatesAutoresizingMaskIntoConstraints="NO" id="SBR-A4-nT9">
<rect key="frame" x="70" y="30" width="4" height="9"/>
<constraints>
<constraint firstAttribute="height" constant="9" id="5H5-og-8eH"/>
<constraint firstAttribute="width" constant="4" id="OdM-b3-CcH"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="VPC-oK-CyP" firstAttribute="leading" secondItem="po3-19-Vcz" secondAttribute="trailing" constant="17" id="5Sg-TT-F7q"/>
<constraint firstItem="ocR-SD-NK2" firstAttribute="centerY" secondItem="N95-3w-wkw" secondAttribute="centerY" id="9be-ET-J1X"/>
<constraint firstItem="kO2-ae-QwA" firstAttribute="centerY" secondItem="po3-19-Vcz" secondAttribute="centerY" id="GBV-3U-kU3"/>
<constraint firstItem="59N-Rz-RXJ" firstAttribute="centerY" secondItem="kO2-ae-QwA" secondAttribute="centerY" id="JBg-7L-0my"/>
<constraint firstItem="kO2-ae-QwA" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="JVr-h0-AMA"/>
<constraint firstItem="kO2-ae-QwA" firstAttribute="leading" secondItem="po3-19-Vcz" secondAttribute="trailing" constant="18" id="K5b-5b-gnN"/>
<constraint firstItem="SBR-A4-nT9" firstAttribute="leading" secondItem="VPC-oK-CyP" secondAttribute="trailing" constant="16" id="LVY-jh-g6z"/>
<constraint firstItem="ocR-SD-NK2" firstAttribute="leading" secondItem="N95-3w-wkw" secondAttribute="trailing" constant="16" id="VEW-Ji-koc"/>
<constraint firstItem="N95-3w-wkw" firstAttribute="centerY" secondItem="59N-Rz-RXJ" secondAttribute="centerY" id="XS2-uH-Uht"/>
<constraint firstItem="SBR-A4-nT9" firstAttribute="centerY" secondItem="VPC-oK-CyP" secondAttribute="centerY" id="a7F-Yt-bNC"/>
<constraint firstItem="po3-19-Vcz" firstAttribute="leading" secondItem="VPC-oK-CyP" secondAttribute="trailing" constant="17" id="aIz-zO-yuD"/>
<constraint firstItem="kO2-ae-QwA" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="daF-UA-Ez5"/>
<constraint firstItem="VPC-oK-CyP" firstAttribute="centerY" secondItem="SBR-A4-nT9" secondAttribute="centerY" id="gbX-2O-aGf"/>
<constraint firstItem="VPC-oK-CyP" firstAttribute="leading" secondItem="SBR-A4-nT9" secondAttribute="trailing" constant="16" id="kEg-3p-QL7"/>
<constraint firstItem="po3-19-Vcz" firstAttribute="centerY" secondItem="VPC-oK-CyP" secondAttribute="centerY" id="luQ-KN-24L"/>
<constraint firstItem="N95-3w-wkw" firstAttribute="leading" secondItem="59N-Rz-RXJ" secondAttribute="trailing" constant="17" id="tfc-xE-2EX"/>
<constraint firstItem="po3-19-Vcz" firstAttribute="leading" secondItem="VPC-oK-CyP" secondAttribute="trailing" constant="18" id="v6D-DL-rh0"/>
<constraint firstItem="VPC-oK-CyP" firstAttribute="centerY" secondItem="po3-19-Vcz" secondAttribute="centerY" id="yQ1-F2-zdr"/>
<constraint firstItem="59N-Rz-RXJ" firstAttribute="leading" secondItem="kO2-ae-QwA" secondAttribute="trailing" constant="18" id="zl5-SQ-V8f"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="LVY-jh-g6z"/>
<exclude reference="a7F-Yt-bNC"/>
<exclude reference="5Sg-TT-F7q"/>
<exclude reference="yQ1-F2-zdr"/>
<exclude reference="v6D-DL-rh0"/>
</mask>
</variation>
<connections>
<outletCollection property="smallIcons" destination="ocR-SD-NK2" collectionClass="NSMutableArray" id="arI-SS-tcy"/>
<outletCollection property="mediumIcons" destination="N95-3w-wkw" collectionClass="NSMutableArray" id="jTA-MG-5He"/>
<outletCollection property="bigIcons" destination="59N-Rz-RXJ" collectionClass="NSMutableArray" id="rYX-Xg-CcO"/>
<outletCollection property="bigIcons" destination="po3-19-Vcz" collectionClass="NSMutableArray" id="SYT-pK-zEp"/>
<outletCollection property="mediumIcons" destination="VPC-oK-CyP" collectionClass="NSMutableArray" id="E6l-u7-7Fy"/>
<outletCollection property="smallIcons" destination="SBR-A4-nT9" collectionClass="NSMutableArray" id="sML-6l-GUN"/>
</connections>
</view>
</objects>
<resources>
<image name="icon_satellite" width="50" height="22"/>
<image name="icon_wave_big" width="5" height="13"/>
<image name="icon_wave_big_right" width="5" height="13"/>
<image name="icon_wave_medium" width="5" height="11"/>
<image name="icon_wave_medium_right" width="5" height="11"/>
<image name="icon_wave_small" width="4" height="9"/>
<image name="icon_wave_small_right" width="4" height="9"/>
</resources>
</document>

View File

@ -0,0 +1,38 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,52 @@
//
// PerekrestokView.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 24.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
import RMRPullToRefresh
class PerekrestokView: RMRPullToRefreshView {
@IBOutlet weak var logoImageView: UIImageView!
var fromValue: CGFloat = 0.0
class func XIB_VIEW() -> PerekrestokView? {
let subviewArray = NSBundle.mainBundle().loadNibNamed("PerekrestokView", owner: self, options: nil)
return subviewArray.first as? PerekrestokView
}
// MARK: - Private
func angle(progress: CGFloat) -> CGFloat {
return -CGFloat(M_PI)/progress
}
// MARK: - RMRPullToRefreshViewProtocol
override func didChangeDraggingProgress(progress: CGFloat) {
logoImageView.transform = CGAffineTransformMakeRotation(angle(progress));
}
override func prepareForLoadingAnimation(startProgress: CGFloat) {
fromValue = angle(startProgress)
}
override func beginLoadingAnimation() {
let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
rotationAnimation.fromValue = fromValue
rotationAnimation.byValue = 2*M_PI
rotationAnimation.duration = 0.9
rotationAnimation.repeatCount = HUGE
self.logoImageView.layer.addAnimation(rotationAnimation, forKey: "transformAnimation")
}
override func didEndLoadingAnimation(hidden: Bool) {
self.logoImageView.layer.removeAnimationForKey("transformAnimation")
}
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="PerekrestokView" customModule="RMRPullToRefreshExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="70"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="example_perekrestok" translatesAutoresizingMaskIntoConstraints="NO" id="g9W-cG-oE7">
<rect key="frame" x="142" y="17" width="36" height="36"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="g9W-cG-oE7" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="AJM-NN-KR5"/>
<constraint firstItem="g9W-cG-oE7" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="kgf-MH-vRC"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="logoImageView" destination="g9W-cG-oE7" id="bZJ-9I-oDg"/>
</connections>
<point key="canvasLocation" x="170" y="320"/>
</view>
</objects>
<resources>
<image name="example_perekrestok" width="36" height="36"/>
</resources>
</document>

View File

@ -0,0 +1,36 @@
//
// TableViewController.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 10.04.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
class TableViewController: UITableViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
super.prepareForSegue(segue, sender: sender)
if let identifier = segue.identifier, let controller = segue.destinationViewController as? ViewController {
switch identifier {
case "perekrestok_top":
controller.exampleType = .PerekrestokTop
case "perekrestok_bottom":
controller.exampleType = .PerekrestokBottom
case "beeline_top":
controller.exampleType = .BeelineTop
case "beeline_bottom":
controller.exampleType = .BeelineBottom
case "redmadrobot_top":
controller.exampleType = .RedmadrobotTop
case "redmadrobot_bottom":
controller.exampleType = .RedmadrobotBottom
default:
break
}
}
}
}

View File

@ -0,0 +1,165 @@
//
// ViewController.swift
// RMRPullToRefresh
//
// Created by Merkulov Ilya on 19.03.16.
// Copyright © 2016 Merkulov Ilya. All rights reserved.
//
import UIKit
import RMRPullToRefresh
public enum ExampleType: Int {
case PerekrestokTop
case PerekrestokBottom
case BeelineTop
case BeelineBottom
case RedmadrobotTop
case RedmadrobotBottom
}
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UIActionSheetDelegate {
@IBOutlet weak var tableView: UITableView!
var exampleType: ExampleType = .BeelineBottom
var pullToRefresh: RMRPullToRefresh?
let formatter = NSDateFormatter()
var items: [String] = []
var count = 2
var result = RMRPullToRefreshResultType.Success
override func viewDidLoad() {
super.viewDidLoad()
someConfiguring()
loadData()
configurePullToRefresh()
}
// MARK: - Pull to Refresh
func configurePullToRefresh() {
pullToRefresh = RMRPullToRefresh(scrollView: tableView, position: position()) { [weak self] _ in
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(5.0 * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), {
if self?.result == .Success {
self?.loadMore()
}
if let result = self?.result {
self?.pullToRefresh?.stopLoading(result)
}
})
}
if exampleType == .PerekrestokTop || exampleType == .PerekrestokBottom {
perekrestok()
} else if exampleType == .BeelineTop || exampleType == .BeelineBottom {
beeline()
} else if exampleType == .RedmadrobotTop || exampleType == .RedmadrobotBottom {
redmadrobot()
}
}
// MARK: - Build example values
func perekrestok() {
if let pullToRefreshView = PerekrestokView.XIB_VIEW() {
pullToRefresh?.configureView(pullToRefreshView, state: .Dragging, result: .Success)
pullToRefresh?.configureView(pullToRefreshView, state: .Loading, result: .Success)
}
pullToRefresh?.height = 90.0
pullToRefresh?.backgroundColor = UIColor(red: 16.0/255.0,
green: 192.0/255.0,
blue: 119.0/255.0,
alpha: 1.0)
}
func beeline() {
if let pullToRefreshView = BeelineView.XIB_VIEW() {
pullToRefresh?.configureView(pullToRefreshView, state: .Dragging, result: .Success)
pullToRefresh?.configureView(pullToRefreshView, state: .Loading, result: .Success)
}
pullToRefresh?.height = 90.0
pullToRefresh?.backgroundColor = UIColor.whiteColor()
}
func redmadrobot() {
pullToRefresh?.setupDefaultSettings()
}
func position() -> RMRPullToRefreshPosition {
if exampleType == .PerekrestokTop || exampleType == .BeelineTop || exampleType == .RedmadrobotTop {
return .Top
}
return .Bottom
}
// MARK: - Configure
func someConfiguring() {
formatter.dateStyle = NSDateFormatterStyle.LongStyle
formatter.timeStyle = .MediumStyle
}
// MARK: - Action
@IBAction func settings(sender: AnyObject) {
UIActionSheet(title: "Result type", delegate: self, cancelButtonTitle: nil, destructiveButtonTitle: nil, otherButtonTitles: ".Success", ".NoUpdates", ".Error").showInView(self.view)
}
// MARK: - UIActionSheetDelegate
func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
switch buttonIndex {
case 0:
self.result = .Success
case 1:
self.result = .NoUpdates
case 2:
self.result = .Error
default:
break;
}
}
// MARK: - Test data
func loadData() {
for _ in 0...count {
items.append(formatter.stringFromDate(NSDate()))
}
}
func loadMore() {
for _ in 0...20 {
self.items.append(formatter.stringFromDate(NSDate(timeIntervalSinceNow: 20)))
}
self.tableView.reloadData()
}
// MARK: - TableView
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
cell.textLabel?.text = items[indexPath.row]
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1;
}
}

View File

@ -0,0 +1,404 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
8921D4F51CA425B4000D28E3 /* PerekrestokView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8921D4F41CA425B4000D28E3 /* PerekrestokView.swift */; };
8921D4F71CA425C0000D28E3 /* PerekrestokView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8921D4F61CA425C0000D28E3 /* PerekrestokView.xib */; };
8952BE3E1CBACA1D00D94689 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8952BE3D1CBACA1D00D94689 /* TableViewController.swift */; };
89B014751CBAE22F002AB1B7 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89B014741CBAE22F002AB1B7 /* Pods.framework */; };
89B014771CBAE3D5002AB1B7 /* RMRPullToRefresh.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89B014761CBAE3D5002AB1B7 /* RMRPullToRefresh.framework */; };
89B06BF01CBA8A4900485A08 /* BeelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89B06BEF1CBA8A4900485A08 /* BeelineView.swift */; };
89B06BF21CBA8B0700485A08 /* BeelineView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89B06BF11CBA8B0700485A08 /* BeelineView.xib */; };
89CB12381C9DA07B00048E46 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89CB12371C9DA07B00048E46 /* AppDelegate.swift */; };
89CB123A1C9DA07B00048E46 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89CB12391C9DA07B00048E46 /* ViewController.swift */; };
89CB123D1C9DA07B00048E46 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89CB123B1C9DA07B00048E46 /* Main.storyboard */; };
89CB123F1C9DA07B00048E46 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 89CB123E1C9DA07B00048E46 /* Assets.xcassets */; };
89CB12421C9DA07B00048E46 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89CB12401C9DA07B00048E46 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
766D53F6605D8961328E54A1 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
8921D4F41CA425B4000D28E3 /* PerekrestokView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerekrestokView.swift; sourceTree = "<group>"; };
8921D4F61CA425C0000D28E3 /* PerekrestokView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PerekrestokView.xib; sourceTree = "<group>"; };
8952BE3D1CBACA1D00D94689 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
89B014741CBAE22F002AB1B7 /* Pods.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods.framework; path = "../../../../Library/Developer/Xcode/DerivedData/RMRPullToRefresh-fwnpioedcaituoahusazwcgryphj/Build/Products/Debug-iphonesimulator/Pods.framework"; sourceTree = "<group>"; };
89B014761CBAE3D5002AB1B7 /* RMRPullToRefresh.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RMRPullToRefresh.framework; path = "../../../../Library/Developer/Xcode/DerivedData/RMRPullToRefresh-fwnpioedcaituoahusazwcgryphj/Build/Products/Debug-iphonesimulator/RMRPullToRefresh.framework"; sourceTree = "<group>"; };
89B06BEF1CBA8A4900485A08 /* BeelineView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BeelineView.swift; sourceTree = "<group>"; };
89B06BF11CBA8B0700485A08 /* BeelineView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BeelineView.xib; sourceTree = "<group>"; };
89CB12341C9DA07B00048E46 /* RMRPullToRefreshExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RMRPullToRefreshExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
89CB12371C9DA07B00048E46 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
89CB12391C9DA07B00048E46 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
89CB123C1C9DA07B00048E46 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
89CB123E1C9DA07B00048E46 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
89CB12411C9DA07B00048E46 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
89CB12431C9DA07B00048E46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D48C26E126E3942BBDFD40CF /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
89CB12311C9DA07B00048E46 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
89B014771CBAE3D5002AB1B7 /* RMRPullToRefresh.framework in Frameworks */,
89B014751CBAE22F002AB1B7 /* Pods.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
23AE0A3F7B76C576CCD778D3 /* Pods */ = {
isa = PBXGroup;
children = (
766D53F6605D8961328E54A1 /* Pods.debug.xcconfig */,
D48C26E126E3942BBDFD40CF /* Pods.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
8952BE3C1CBAC64800D94689 /* Views */ = {
isa = PBXGroup;
children = (
8921D4F41CA425B4000D28E3 /* PerekrestokView.swift */,
8921D4F61CA425C0000D28E3 /* PerekrestokView.xib */,
89B06BEF1CBA8A4900485A08 /* BeelineView.swift */,
89B06BF11CBA8B0700485A08 /* BeelineView.xib */,
);
name = Views;
sourceTree = "<group>";
};
89CB122B1C9DA07B00048E46 = {
isa = PBXGroup;
children = (
89CB12361C9DA07B00048E46 /* RMRPullToRefreshExample */,
89CB12351C9DA07B00048E46 /* Products */,
23AE0A3F7B76C576CCD778D3 /* Pods */,
E22D98D3A06A61AA44D86794 /* Frameworks */,
);
sourceTree = "<group>";
};
89CB12351C9DA07B00048E46 /* Products */ = {
isa = PBXGroup;
children = (
89CB12341C9DA07B00048E46 /* RMRPullToRefreshExample.app */,
);
name = Products;
sourceTree = "<group>";
};
89CB12361C9DA07B00048E46 /* RMRPullToRefreshExample */ = {
isa = PBXGroup;
children = (
8952BE3C1CBAC64800D94689 /* Views */,
89CB12371C9DA07B00048E46 /* AppDelegate.swift */,
8952BE3D1CBACA1D00D94689 /* TableViewController.swift */,
89CB12391C9DA07B00048E46 /* ViewController.swift */,
89CB123B1C9DA07B00048E46 /* Main.storyboard */,
89CB12401C9DA07B00048E46 /* LaunchScreen.storyboard */,
89CB123E1C9DA07B00048E46 /* Assets.xcassets */,
89CB12431C9DA07B00048E46 /* Info.plist */,
);
name = RMRPullToRefreshExample;
path = RMRPullToRefresh;
sourceTree = "<group>";
};
E22D98D3A06A61AA44D86794 /* Frameworks */ = {
isa = PBXGroup;
children = (
89B014761CBAE3D5002AB1B7 /* RMRPullToRefresh.framework */,
89B014741CBAE22F002AB1B7 /* Pods.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
89CB12331C9DA07B00048E46 /* RMRPullToRefreshExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 89CB12461C9DA07B00048E46 /* Build configuration list for PBXNativeTarget "RMRPullToRefreshExample" */;
buildPhases = (
00D4D85E4DF2FF039A017773 /* Check Pods Manifest.lock */,
89CB12301C9DA07B00048E46 /* Sources */,
89CB12311C9DA07B00048E46 /* Frameworks */,
89CB12321C9DA07B00048E46 /* Resources */,
2BE863C51DEA329C1234F1B0 /* Embed Pods Frameworks */,
C137BE069515EFF1A69455DF /* Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = RMRPullToRefreshExample;
productName = RMRPullToRefresh;
productReference = 89CB12341C9DA07B00048E46 /* RMRPullToRefreshExample.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
89CB122C1C9DA07B00048E46 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Merkulov Ilya";
TargetAttributes = {
89CB12331C9DA07B00048E46 = {
CreatedOnToolsVersion = 7.2.1;
};
};
};
buildConfigurationList = 89CB122F1C9DA07B00048E46 /* Build configuration list for PBXProject "RMRPullToRefreshExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 89CB122B1C9DA07B00048E46;
productRefGroup = 89CB12351C9DA07B00048E46 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
89CB12331C9DA07B00048E46 /* RMRPullToRefreshExample */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
89CB12321C9DA07B00048E46 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
89CB12421C9DA07B00048E46 /* LaunchScreen.storyboard in Resources */,
89CB123F1C9DA07B00048E46 /* Assets.xcassets in Resources */,
8921D4F71CA425C0000D28E3 /* PerekrestokView.xib in Resources */,
89CB123D1C9DA07B00048E46 /* Main.storyboard in Resources */,
89B06BF21CBA8B0700485A08 /* BeelineView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
00D4D85E4DF2FF039A017773 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
2BE863C51DEA329C1234F1B0 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C137BE069515EFF1A69455DF /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
89CB12301C9DA07B00048E46 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
89CB123A1C9DA07B00048E46 /* ViewController.swift in Sources */,
8921D4F51CA425B4000D28E3 /* PerekrestokView.swift in Sources */,
89B06BF01CBA8A4900485A08 /* BeelineView.swift in Sources */,
89CB12381C9DA07B00048E46 /* AppDelegate.swift in Sources */,
8952BE3E1CBACA1D00D94689 /* TableViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
89CB123B1C9DA07B00048E46 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
89CB123C1C9DA07B00048E46 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
89CB12401C9DA07B00048E46 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
89CB12411C9DA07B00048E46 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
89CB12441C9DA07B00048E46 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
89CB12451C9DA07B00048E46 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
89CB12471C9DA07B00048E46 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 766D53F6605D8961328E54A1 /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = RMRPullToRefresh/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RMRPullToRefresh;
PRODUCT_NAME = RMRPullToRefreshExample;
};
name = Debug;
};
89CB12481C9DA07B00048E46 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D48C26E126E3942BBDFD40CF /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = RMRPullToRefresh/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RMRPullToRefresh;
PRODUCT_NAME = RMRPullToRefreshExample;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
89CB122F1C9DA07B00048E46 /* Build configuration list for PBXProject "RMRPullToRefreshExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
89CB12441C9DA07B00048E46 /* Debug */,
89CB12451C9DA07B00048E46 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
89CB12461C9DA07B00048E46 /* Build configuration list for PBXNativeTarget "RMRPullToRefreshExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
89CB12471C9DA07B00048E46 /* Debug */,
89CB12481C9DA07B00048E46 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 89CB122C1C9DA07B00048E46 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RMRPullToRefresh.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "UIViewAlertForUnsatisfiableConstraints"
moduleName = "">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "UIViewAlertForUnsatisfiableConstraints"
moduleName = "UIKit"
usesParentBreakpointCondition = "Yes"
offsetFromSymbolStart = "0">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89CB12331C9DA07B00048E46"
BuildableName = "RMRPullToRefreshExample.app"
BlueprintName = "RMRPullToRefreshExample"
ReferencedContainer = "container:RMRPullToRefreshExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89CB12331C9DA07B00048E46"
BuildableName = "RMRPullToRefreshExample.app"
BlueprintName = "RMRPullToRefreshExample"
ReferencedContainer = "container:RMRPullToRefreshExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89CB12331C9DA07B00048E46"
BuildableName = "RMRPullToRefreshExample.app"
BlueprintName = "RMRPullToRefreshExample"
ReferencedContainer = "container:RMRPullToRefreshExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89CB12331C9DA07B00048E46"
BuildableName = "RMRPullToRefreshExample.app"
BlueprintName = "RMRPullToRefreshExample"
ReferencedContainer = "container:RMRPullToRefreshExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,22 @@
<?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>SchemeUserState</key>
<dict>
<key>RMRPullToRefresh.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>89CB12331C9DA07B00048E46</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

12
RMRPullToRefresh.podspec Normal file
View File

@ -0,0 +1,12 @@
Pod::Spec.new do |spec|
spec.name = "RMRPullToRefresh"
spec.version = "0.1"
spec.platform = :ios, "8.0"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.summary = "A pull to refresh control for UIScrollView (UITableView and UICollectionView)"
spec.homepage = "http://redmadrobot.com/"
spec.author = "Ilya Merkulov"
spec.source = { :git => :"https://git.redmadrobot.com/im/RMRPullToRefresh", :tag => "v0.1" }
spec.source_files = "Classes/*.{swift}", "Classes/Default/*.{swift}"
spec.resources = ['Images/*.png']
end