Skip to content

Commit

Permalink
[UPD]: Access control
Browse files Browse the repository at this point in the history
  • Loading branch information
micazeve committed Feb 20, 2017
1 parent ba34964 commit d77d267
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions Classes/MAAnimatedMultiGearView.swift
Expand Up @@ -12,7 +12,7 @@ import UIKit

/// This class is used to draw and animate multiple gears

class MAAnimatedMultiGearView: MAMultiGearView {
public class MAAnimatedMultiGearView: MAMultiGearView {

//MARK: Instance properties

Expand All @@ -38,7 +38,7 @@ class MAAnimatedMultiGearView: MAMultiGearView {
//MARK: Various methods

/// Override of the `addLinkedGear` method in order to update the array of rotational angle when a gear is added
override func addLinkedGear(_ gearLinked: Int, nbTeeth:UInt, color:UIColor, angleInDegree:Double) -> Bool {
override public func addLinkedGear(_ gearLinked: Int, nbTeeth:UInt, color:UIColor, angleInDegree:Double) -> Bool {

if !super.addLinkedGear(gearLinked, nbTeeth: nbTeeth, color: color, angleInDegree: angleInDegree) {
return false
Expand Down Expand Up @@ -97,14 +97,14 @@ class MAAnimatedMultiGearView: MAMultiGearView {
}

/// Public method to start rotating
func startRotating() {
public func startRotating() {
stopRotation = false
rotate()
}


/// Public method to start rotating
func stopRotating() {
public func stopRotating() {
stopRotation = true
}
}
4 changes: 2 additions & 2 deletions Classes/MAGear.swift
Expand Up @@ -11,7 +11,7 @@ import UIKit
//MARK: - MAGear Class

/// This class represents a gear in the most abstract way, without any graphical code related.
internal class MAGear {
public class MAGear {

//MARK: Instance properties

Expand All @@ -37,7 +37,7 @@ internal class MAGear {
///
/// - parameter radius: of the gear
/// - parameter nbTeeth: Number of teeth of the gear. Must be greater than 2.
init (radius:CGFloat, nbTeeth:UInt) {
public init (radius:CGFloat, nbTeeth:UInt) {

assert(nbTeeth > 2)

Expand Down
20 changes: 10 additions & 10 deletions Classes/MAGearRefreshControl.swift
Expand Up @@ -12,8 +12,8 @@ import UIKit


/// Protocol between the MAGearRefreshControl and its delegate (mostly UITableViewController).
@objc protocol MAGearRefreshDelegate {
@objc public protocol MAGearRefreshDelegate {

/// Method called when the pull to refresh move was triggered.
///
/// - parameter view: The MAGearRefreshControl object.
Expand All @@ -33,12 +33,12 @@ import UIKit
//MARK: - MAGearRefreshControl Class

/// This class is used to draw an animated group of gears and offers the same interactions as an UIRefreshControl
class MAGearRefreshControl: MAAnimatedMultiGearView {
public class MAGearRefreshControl: MAAnimatedMultiGearView {

//MARK: Instance properties

/// Enum representing the different state of the refresh control
enum MAGearRefreshState: UInt8 {
public enum MAGearRefreshState: UInt8 {
case normal // The user is pulling but hasn't reach the activation threshold yet
case pulling // The user is still pulling and has passed the activation threshold
case loading // The refresh control is animating
Expand All @@ -48,7 +48,7 @@ class MAGearRefreshControl: MAAnimatedMultiGearView {
fileprivate var state = MAGearRefreshState.normal

/// Delegate conforming to the MAGearRefreshDelegate protocol. Most of time it's an UITableViewController
var delegate:MAGearRefreshDelegate?
public var delegate:MAGearRefreshDelegate?

/// Content offset of the tableview
fileprivate var contentOffset:CGFloat = 0
Expand Down Expand Up @@ -96,7 +96,7 @@ class MAGearRefreshControl: MAAnimatedMultiGearView {
/// Method to call when the scrollview was scrolled.
///
/// - parameter scrollView: The scrollview.
func MAGearRefreshScrollViewDidScroll(_ scrollView:UIScrollView) {
public func MAGearRefreshScrollViewDidScroll(_ scrollView:UIScrollView) {

configureWithContentOffsetY(-scrollView.contentOffset.y)

Expand Down Expand Up @@ -137,7 +137,7 @@ class MAGearRefreshControl: MAAnimatedMultiGearView {
/// Method to call when the scrollview ended dragging
///
/// - parameter scrollView: The scrollview.
func MAGearRefreshScrollViewDidEndDragging(_ scrollView:UIScrollView) {
public func MAGearRefreshScrollViewDidEndDragging(_ scrollView:UIScrollView) {

NSLog("MAGearRefreshScrollViewDidEndDragging")
/*if state == .Loading {
Expand Down Expand Up @@ -186,7 +186,7 @@ class MAGearRefreshControl: MAAnimatedMultiGearView {
/// Method to call when the datasource finished loading
///
/// - parameter scrollView: The scrollview.
func MAGearRefreshScrollViewDataSourceDidFinishedLoading(_ scrollView:UIScrollView) {
public func MAGearRefreshScrollViewDataSourceDidFinishedLoading(_ scrollView:UIScrollView) {

NSLog("MAGearRefreshScrollViewDataSourceDidFinishedLoading")

Expand Down Expand Up @@ -279,12 +279,12 @@ class MAGearRefreshControl: MAAnimatedMultiGearView {
//MARK: Public methods override

/// Override of startRotating in order to disable this portion of code (must be triggered from the tableview)
override func startRotating() {
override public func startRotating() {

}

/// Override of stopRotating in order to disable this portion of code (must be triggered from delegate)
override func stopRotating()
override public func stopRotating()
{
}
}
14 changes: 7 additions & 7 deletions Classes/MAMultiGearView.swift
Expand Up @@ -11,7 +11,7 @@ import UIKit
//MARK: - MAMultiGearView Class

/// This class is used to draw multiples gears in a UIView.
class MAMultiGearView : UIView {
public class MAMultiGearView : UIView {

//MARK: Instance properties

Expand Down Expand Up @@ -61,7 +61,7 @@ class MAMultiGearView : UIView {
//MARK: Init methods

/// Default initializer
override init(frame: CGRect) {
override public init(frame: CGRect) {
super.init(frame: frame)

clipsToBounds = true
Expand All @@ -78,7 +78,7 @@ class MAMultiGearView : UIView {
}

/// Required initializer
required init(coder aDecoder: NSCoder) {
required public init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -92,7 +92,7 @@ class MAMultiGearView : UIView {
/// - parameter radius: Radius in pixel of the gear
///
/// - returns: true if the gear was succesfully created, false otherwise (if at least one gear exists).
func addInitialGear(nbTeeth:UInt, color: UIColor, radius:CGFloat) -> Bool {
public func addInitialGear(nbTeeth:UInt, color: UIColor, radius:CGFloat) -> Bool {

if arrayViews.count > 0 {
return false
Expand Down Expand Up @@ -120,7 +120,7 @@ class MAMultiGearView : UIView {
/// - parameter angleInDegree: Angle (in degree) between the gear to create and the previous gear, according to the unit circle.
///
/// - returns: true if the gear was succesfully created, false otherwise (if the gearLinked index is incorrect).
func addLinkedGear(_ gearLinked: Int, nbTeeth:UInt, color:UIColor, angleInDegree:Double) -> Bool {
public func addLinkedGear(_ gearLinked: Int, nbTeeth:UInt, color:UIColor, angleInDegree:Double) -> Bool {

if gearLinked >= arrayViews.count || gearLinked < 0 {
return false
Expand Down Expand Up @@ -172,7 +172,7 @@ class MAMultiGearView : UIView {
/// Set the phase for the first gear and calculate it for all the linked gears
///
/// - parameter phase: Phase between 0 and 1 for the first gear.
func setMainGearPhase(_ phase:Double) {
public func setMainGearPhase(_ phase:Double) {
if arrayViews.count == 0 {
return
}
Expand Down Expand Up @@ -269,7 +269,7 @@ class MAMultiGearView : UIView {

//MARK: Override setFrame

override var frame:CGRect {
override public var frame:CGRect {
didSet {
configureView()
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/MASingleGearView.swift
Expand Up @@ -12,28 +12,28 @@ import UIKit
//MARK: - MASingleGearView Class

/// This class is used to draw a gear in a UIView.
class MASingleGearView : UIView {
public class MASingleGearView : UIView {

//MARK: Instance properties

/// Gear linked to this view.
internal var gear:MAGear!

/// Color of the gear.
var gearColor = UIColor.black
public var gearColor = UIColor.black

/// Phase of the gear. Varies between 0 and 1.
/// A phase of 0 represents a gear with the rightmost tooth fully horizontal, while a phase of 0.5 represents a gear with a hole in the rightmost point.
/// A phase of 1 thus is graphically equivalent to a phase of 0
var phase:Double = 0
public var phase:Double = 0

//MARK: Init methods

/// Custom init method
///
/// - parameter gear: Gear linked to this view
/// - parameter gearColor: Color of the gear
init(gear:MAGear, gearColor:UIColor) {
public init(gear:MAGear, gearColor:UIColor) {

var width = Int(gear.outsideDiameter + 1)
if width%2 == 1 {
Expand All @@ -48,14 +48,14 @@ class MASingleGearView : UIView {
}

/// Required initializer
required init(coder aDecoder: NSCoder) {
required public init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

//MARK: Drawing methods

/// Override of drawing method
override func draw(_ rect: CGRect) {
override public func draw(_ rect: CGRect) {
_ = CGColorSpaceCreateDeviceRGB()
let currentContext = UIGraphicsGetCurrentContext()
currentContext?.clear(rect)
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions MAGearRefreshControl.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MAGearRefreshControl"
s.version = "0.2"
s.version = "0.3"
s.summary = "Refresh control with gear animation."

s.description = <<-DESC
Expand All @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.social_media_url = "https://twitter.com/micazeve"
s.platforms = { :ios => "8.0" }

s.source = { :git => "https://github.com/micazeve/MAGearRefreshControl.git", :branch => "master", :tag => '0.2'}
s.source = { :git => "https://github.com/micazeve/MAGearRefreshControl.git", :branch => "master", :tag => '0.3'}
s.source_files = "Classes/**/*.swift"

s.ios.deployment_target = '8.0'
Expand Down

0 comments on commit d77d267

Please sign in to comment.