-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from iCyberon/master
iOS 8 Support
- Loading branch information
Showing
14 changed files
with
547 additions
and
139 deletions.
There are no files selected for viewing
174 changes: 133 additions & 41 deletions
174
Example/Athlee-Onboarding/Athlee-Onboarding.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
Example/Athlee-Onboarding/Athlee-Onboarding.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
// | ||
|
||
import UIKit | ||
import OnboardingKit | ||
|
||
public final class OnboardingViewController: UIViewController { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use_frameworks! | ||
|
||
target 'Athlee-Onboarding' do | ||
pod 'OnboardingKit', :path => '../../' | ||
|
||
target 'Athlee-OnboardingTests' do | ||
inherit! :search_paths | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PODS: | ||
- OnboardingKit (0.0.2): | ||
- TZStackView | ||
- TZStackView (1.2.0) | ||
|
||
DEPENDENCIES: | ||
- OnboardingKit (from `../../`) | ||
|
||
EXTERNAL SOURCES: | ||
OnboardingKit: | ||
:path: ../../ | ||
|
||
SPEC CHECKSUMS: | ||
OnboardingKit: c37eb2110ca3d8f40fc2ad78e54965b04216a66c | ||
TZStackView: 4b82373b4aabe4d99adf739a34e1bc6755149272 | ||
|
||
PODFILE CHECKSUM: 4428256f7d1d2fab9e9f0fbe4e8ec9cda004ba00 | ||
|
||
COCOAPODS: 1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,11 @@ Pod::Spec.new do |s| | |
s.author = { "Eugene Mozharovsky" => "[email protected]" } | ||
s.social_media_url = "http://twitter.com/dottieyottie" | ||
s.platform = :ios, "9.0" | ||
s.ios.deployment_target = "9.0" | ||
s.ios.deployment_target = "8.0" | ||
s.source = { :git => "https://github.com/Athlee/OnboardingKit.git", :tag => s.version } | ||
s.source_files = "Source/*.swift" | ||
s.requires_arc = true | ||
|
||
s.dependency 'TZStackView' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
// | ||
// Anchor.swift | ||
// AnchorTest | ||
// | ||
// Created by Jonathan Wight on 7/10/15. | ||
// Copyright © 2015 schwa.io. All rights reserved. | ||
// | ||
|
||
#if os(OSX) | ||
import AppKit | ||
internal typealias View = NSView | ||
#elseif os(iOS) | ||
import UIKit | ||
internal typealias View = UIView | ||
#endif | ||
|
||
public extension View { | ||
var anchors:Anchors { | ||
return Anchors(item:self) | ||
} | ||
} | ||
|
||
public struct Anchors { | ||
internal let item:View | ||
|
||
internal init(item:View) { | ||
self.item = item | ||
} | ||
|
||
public var leadingAnchor: LayoutXAxisAnchor { | ||
return LayoutXAxisAnchor(item:item, attribute:.Leading) | ||
} | ||
public var trailingAnchor: LayoutXAxisAnchor { | ||
return LayoutXAxisAnchor(item:item, attribute:.Trailing) | ||
} | ||
public var leftAnchor: LayoutXAxisAnchor { | ||
return LayoutXAxisAnchor(item:item, attribute:.Left) | ||
} | ||
public var rightAnchor: LayoutXAxisAnchor { | ||
return LayoutXAxisAnchor(item:item, attribute:.Right) | ||
} | ||
public var topAnchor: LayoutYAxisAnchor { | ||
return LayoutYAxisAnchor(item:item, attribute:.Top) | ||
} | ||
public var bottomAnchor: LayoutYAxisAnchor { | ||
return LayoutYAxisAnchor(item:item, attribute:.Bottom) | ||
} | ||
public var widthAnchor: LayoutDimension { | ||
return LayoutDimension(item:item, attribute:.Width) | ||
} | ||
public var heightAnchor: LayoutDimension { | ||
return LayoutDimension(item:item, attribute:.Height) | ||
} | ||
public var centerXAnchor: LayoutXAxisAnchor { | ||
return LayoutXAxisAnchor(item:item, attribute:.CenterX) | ||
} | ||
public var centerYAnchor: LayoutYAxisAnchor { | ||
return LayoutYAxisAnchor(item:item, attribute:.CenterY) | ||
} | ||
} | ||
|
||
|
||
// MARK: - | ||
|
||
/* | ||
An NSLayoutAnchor represents an edge or dimension of a layout item. Its concrete subclasses allow concise creation of constraints. The idea is that instead of invoking +[NSLayoutConstraint constraintWithItem: attribute: relatedBy: toItem: attribute: multiplier: constant:] directly, you can instead do something like this: | ||
|
||
[myView.topAnchor constraintEqualToAnchor:otherView.topAnchor constant:10]; | ||
|
||
The -constraint* methods are available in multiple flavors to support use of different relations and omission of unused options. | ||
|
||
*/ | ||
|
||
public class LayoutAnchor { | ||
|
||
internal var item:View | ||
internal var attribute:NSLayoutAttribute | ||
|
||
internal init(item:View, attribute:NSLayoutAttribute) { | ||
self.item = item | ||
self.attribute = attribute | ||
} | ||
|
||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor. | ||
public func constraintEqualToAnchor(anchor: LayoutAnchor) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .Equal, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: 0.0) | ||
} | ||
|
||
public func constraintGreaterThanOrEqualToAnchor(anchor: LayoutAnchor) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .GreaterThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: 0.0) | ||
} | ||
|
||
public func constraintLessThanOrEqualToAnchor(anchor: LayoutAnchor) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .LessThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: 0.0) | ||
} | ||
|
||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor + constant. | ||
public func constraintEqualToAnchor(anchor: LayoutAnchor, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .Equal, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: c) | ||
} | ||
|
||
public func constraintGreaterThanOrEqualToAnchor(anchor: LayoutAnchor, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .GreaterThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: c) | ||
} | ||
|
||
public func constraintLessThanOrEqualToAnchor(anchor: LayoutAnchor, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .LessThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: 1.0, constant: c) | ||
} | ||
} | ||
|
||
// MARK: - | ||
|
||
// Axis-specific subclasses for location anchors: top/bottom, leading/trailing, baseline, etc. | ||
public class LayoutXAxisAnchor : LayoutAnchor { | ||
} | ||
|
||
public class LayoutYAxisAnchor : LayoutAnchor { | ||
} | ||
|
||
// MARK: - | ||
|
||
/* | ||
This layout anchor subclass is used for sizes (width & height). | ||
*/ | ||
|
||
public class LayoutDimension : LayoutAnchor { | ||
|
||
// These methods return an inactive constraint of the form thisVariable = constant. | ||
public func constraintEqualToConstant(c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .Equal, toItem: nil, attribute:.NotAnAttribute, multiplier: 1.0, constant: c) | ||
} | ||
|
||
public func constraintGreaterThanOrEqualToConstant(c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .GreaterThanOrEqual, toItem: nil, attribute:.NotAnAttribute, multiplier: 1.0, constant: c) | ||
} | ||
|
||
public func constraintLessThanOrEqualToConstant(c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .LessThanOrEqual, toItem: nil, attribute:.NotAnAttribute, multiplier: 1.0, constant: c) | ||
} | ||
|
||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor * multiplier. | ||
public func constraintEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .Equal, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: 0) | ||
} | ||
|
||
public func constraintGreaterThanOrEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .GreaterThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: 0) | ||
} | ||
|
||
public func constraintLessThanOrEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .LessThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: 0) | ||
} | ||
|
||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor * multiplier + constant. | ||
public func constraintEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .Equal, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: c) | ||
} | ||
|
||
public func constraintGreaterThanOrEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .GreaterThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: c) | ||
} | ||
|
||
public func constraintLessThanOrEqualToAnchor(anchor: LayoutDimension, multiplier m: CGFloat, constant c: CGFloat) -> NSLayoutConstraint { | ||
return NSLayoutConstraint(item: item, attribute: attribute, relatedBy: .LessThanOrEqual, toItem: anchor.item, attribute: anchor.attribute, multiplier: m, constant: c) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.