Commit eb4ba687 by Daniel Dahan

prepare for release

parent 888f717c
......@@ -12,8 +12,6 @@
9642FA221C1B50E700022BC6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9642FA211C1B50E700022BC6 /* Assets.xcassets */; };
9642FA251C1B50E700022BC6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9642FA231C1B50E700022BC6 /* LaunchScreen.storyboard */; };
9642FA331C1B909700022BC6 /* LeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9642FA321C1B909700022BC6 /* LeftViewController.swift */; };
967585351C5692A4001E4268 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967585341C5692A4001E4268 /* Material.framework */; };
967585361C5692A4001E4268 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 967585341C5692A4001E4268 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
967585381C569AA9001E4268 /* RightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967585371C569AA9001E4268 /* RightViewController.swift */; };
/* End PBXBuildFile section */
......@@ -24,7 +22,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
967585361C5692A4001E4268 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -39,7 +36,6 @@
9642FA241C1B50E700022BC6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9642FA261C1B50E700022BC6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9642FA321C1B909700022BC6 /* LeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftViewController.swift; sourceTree = "<group>"; };
967585341C5692A4001E4268 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
967585371C569AA9001E4268 /* RightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RightViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -48,7 +44,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
967585351C5692A4001E4268 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -58,7 +53,6 @@
9642FA0E1C1B50E700022BC6 = {
isa = PBXGroup;
children = (
967585341C5692A4001E4268 /* Material.framework */,
9642FA191C1B50E700022BC6 /* SideNavigationViewController */,
9642FA181C1B50E700022BC6 /* Products */,
);
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ProfileSideNavBackground.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_search_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_search_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_search_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -62,13 +62,6 @@ class LeftViewController: UIViewController {
view.backgroundColor = MaterialColor.clear
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
// sideNavigationViewController?.backdropColor = nil
// sideNavigationViewController?.depth = .None
}
/// Prepares the items that are displayed within the tableView.
private func prepareItems() {
items.append(Item(text: "Inbox", imageName: "ic_inbox", selected: true))
......@@ -82,7 +75,7 @@ class LeftViewController: UIViewController {
/// Prepares profile view.
private func prepareProfileView() {
let backgroundView: MaterialView = MaterialView()
backgroundView.image = UIImage(named: "ProfileSideNavBackground")
backgroundView.image = UIImage(named: "MaterialBackground")
let profileView: MaterialView = MaterialView()
profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72)
......@@ -119,16 +112,6 @@ class LeftViewController: UIViewController {
tableView.delegate = self
tableView.separatorStyle = .None
// if !UIAccessibilityIsReduceTransparencyEnabled() {
// tableView.backgroundColor = MaterialColor.clear
// let blurEffect = UIBlurEffect(style: .Light)
// let blurEffectView = UIVisualEffectView(effect: blurEffect)
// tableView.backgroundView = blurEffectView
//
// //if you want translucent vibrant table view separator lines
// tableView.separatorEffect = UIVibrancyEffect(forBlurEffect: blurEffect)
// }
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
......
......@@ -154,7 +154,7 @@ class MainViewController: UIViewController {
navigationBarView.leftButtons = [menuButton]
// Search button.
let img2: UIImage? = UIImage(named: "ic_search_white")?.imageWithRenderingMode(.AlwaysTemplate)
let img2: UIImage? = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
let searchButton: FlatButton = FlatButton()
searchButton.pulseColor = MaterialColor.white
searchButton.pulseFill = true
......@@ -179,7 +179,7 @@ class MainViewController: UIViewController {
func prepareAddButton() {
let image: UIImage? = UIImage(named: "ic_add_white")
let button: FabButton = FabButton()
button.backgroundColor = MaterialColor.deepPurple.accent3
button.backgroundColor = MaterialColor.blue.accent3
button.setImage(image, forState: .Normal)
button.setImage(image, forState: .Highlighted)
......@@ -310,7 +310,7 @@ extension MainViewController: SideNavigationViewControllerDelegate {
/**
An optional delegation method that is fired when the
SideNavigationViewController tap gesture begins.
SideNavigationViewController tap gesture executes.
*/
func sideNavigationViewDidTap(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) {
print("Did Tap for", .Left == position ? "Left" : "Right", "view.")
......
......@@ -53,86 +53,41 @@ class RightViewController: UIViewController {
super.viewDidLoad()
prepareView()
prepareItems()
// prepareProfileView()
// prepareTableView()
prepareTableView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.black
view.backgroundColor = MaterialColor.blueGrey.darken4
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
// sideNavigationViewController?.backdropColor = nil
// sideNavigationViewController?.depth = .None
}
/// Prepares the items that are displayed within the tableView.
private func prepareItems() {
items.append(Item(text: "Inbox", imageName: "ic_inbox", selected: true))
items.append(Item(text: "Today", imageName: "ic_today", selected: false))
items.append(Item(text: "Inbox", imageName: "ic_inbox", selected: false))
items.append(Item(text: "Today", imageName: "ic_today", selected: true))
items.append(Item(text: "Bookmarks", imageName: "ic_book", selected: false))
items.append(Item(text: "Work", imageName: "ic_work", selected: false))
items.append(Item(text: "Contacts", imageName: "ic_contacts", selected: false))
items.append(Item(text: "Settings", imageName: "ic_settings", selected: false))
}
/// Prepares profile view.
private func prepareProfileView() {
let backgroundView: MaterialView = MaterialView()
backgroundView.image = UIImage(named: "ProfileSideNavBackground")
let profileView: MaterialView = MaterialView()
profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72)
profileView.shape = .Circle
profileView.borderColor = MaterialColor.white
profileView.borderWidth = .Border3
let nameLabel: UILabel = UILabel()
nameLabel.text = "Michael Smith"
nameLabel.textColor = MaterialColor.white
nameLabel.font = RobotoFont.mediumWithSize(18)
view.addSubview(backgroundView)
backgroundView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: backgroundView)
MaterialLayout.alignToParentHorizontally(view, child: backgroundView)
MaterialLayout.height(view, child: backgroundView, height: 170)
backgroundView.addSubview(profileView)
profileView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTopLeft(backgroundView, child: profileView, top: 20, left: 20)
MaterialLayout.size(backgroundView, child: profileView, width: 72, height: 72)
backgroundView.addSubview(nameLabel)
nameLabel.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromBottom(backgroundView, child: nameLabel, bottom: 20)
MaterialLayout.alignToParentHorizontally(backgroundView, child: nameLabel, left: 20, right: 20)
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.backgroundColor = MaterialColor.clear
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .None
// if !UIAccessibilityIsReduceTransparencyEnabled() {
// tableView.backgroundColor = MaterialColor.clear
// let blurEffect = UIBlurEffect(style: .Light)
// let blurEffectView = UIVisualEffectView(effect: blurEffect)
// tableView.backgroundView = blurEffectView
//
// //if you want translucent vibrant table view separator lines
// tableView.separatorEffect = UIVibrancyEffect(forBlurEffect: blurEffect)
// }
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView, top: 170)
MaterialLayout.alignToParent(view, child: tableView)
}
}
......@@ -151,12 +106,13 @@ extension RightViewController: UITableViewDataSource {
let item: Item = items[indexPath.row]
cell.selectionStyle = .None
cell.textLabel!.text = item.text
cell.textLabel!.textColor = MaterialColor.white
cell.textLabel!.font = RobotoFont.medium
cell.imageView!.image = UIImage(named: item.imageName)?.imageWithRenderingMode(.AlwaysTemplate)
cell.imageView!.tintColor = MaterialColor.cyan.darken4
cell.imageView!.tintColor = MaterialColor.cyan.lighten4
if item.selected {
cell.textLabel!.textColor = MaterialColor.cyan.base
cell.textLabel!.textColor = MaterialColor.cyan.lighten3
}
return cell
......
......@@ -45,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Configure the window with the SideNavigationViewController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = SideNavigationViewController(mainViewController: mainViewController, sideViewController: sideViewController)
window?.rootViewController = SideNavigationViewController(mainViewController: mainViewController, leftViewController: sideViewController)
window?.makeKeyAndVisible()
return true
}
......
......@@ -51,7 +51,7 @@ class MainViewController: UIViewController {
// FabButton handler.
func handleFabButton() {
sideNavigationViewController?.toggle()
sideNavigationViewController?.toggleLeftView()
}
}
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '1.28.1'
s.version = '1.29.0'
s.license = 'BSD'
s.summary = 'Beautiful Material Design in Swift.'
s.summary = 'A beautiful graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io'
s.social_media_url = 'https://www.facebook.com/graphkit'
s.authors = { 'CosmicMind, Inc.' => 'support@cosmicmind.io' }
......
......@@ -2,7 +2,7 @@
# Welcome to Material
Material is a graphics and animation framework based on Google's Material Design. A major goal in the design of Material is to allow the creativity of others to easily be expressed.
Material is a graphics and animation framework for Google's Material Design. It is designed to allow the creativity of others to easily be expressed.
## Features
......@@ -89,7 +89,7 @@ MaterialColor is a complete Material Design color library. It uses base color va
<a name="sidenavigationviewcontroller"></a>
## SideNavigationViewController
The SideNavigationViewController is an app wide navigation pattern. It generally provides overall app navigation with other useful items.
The SideNavigationViewController is an app wide navigation pattern. It generally provides overall app navigation with other useful items. Use the Left position for global app navigation, and the Right position for view navigation.
![MaterialSideNavigationViewController](http://www.cosmicmind.io/MK/MaterialSideNavigationViewController.gif)
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.28.1</string>
<string>1.29.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -100,7 +100,7 @@ public protocol SideNavigationViewControllerDelegate {
/**
An optional delegation method that is fired when the
SideNavigationViewController tap gesture begins.
SideNavigationViewController tap gesture executes.
*/
optional func sideNavigationViewDidTap(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition)
}
......@@ -337,9 +337,11 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
v.height = self.view.bounds.height
}
leftViewThreshold = leftViewWidth / 2
leftViewController?.view.frame.size.width = v.width
leftViewController?.view.frame.size.height = v.height
leftViewController?.view.center = CGPointMake(v.width / 2, v.height / 2)
if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
if let v: MaterialView = rightView {
......@@ -348,9 +350,19 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
v.height = self.view.bounds.height
}
rightViewThreshold = view.bounds.width - rightViewWidth / 2
rightViewController?.view.frame.size.width = v.width
rightViewController?.view.frame.size.height = v.height
rightViewController?.view.center = CGPointMake(v.width / 2, v.height / 2)
if let vc: UIViewController = rightViewController {
vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
}
}
public override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
if let v: MaterialView = rightView {
MaterialAnimation.animationDisabled { [unowned self] in
v.x = self.view.bounds.height - (self.openedRightView ? self.rightViewWidth : 0)
}
}
}
......@@ -389,74 +401,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}
/**
A method to swap leftViewController objects.
- Parameter toViewController: The UIViewController to swap
with the active mainViewController.
- Parameter duration: A NSTimeInterval that sets the
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active mainViewController
to the toViewController.
- Parameter animations: An animation block that is executed during
the transition from the active mainViewController
to the toViewController.
- Parameter completion: A completion block that is execited after
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromLeftViewController(toViewController: UIViewController, duration: NSTimeInterval, options: UIViewAnimationOptions, animations: (() -> Void)?, completion: ((Bool) -> Void)?) {
// leftViewController?.willMoveToParentViewController(nil)
// addChildViewController(toViewController)
// toViewController.view.frame = view.bounds
// transitionFromViewController(mainViewController,
// toViewController: toViewController,
// duration: duration,
// options: options,
// animations: animations,
// completion: { [unowned self, mainViewController = self.mainViewController] (result: Bool) in
// mainViewController.removeFromParentViewController()
// toViewController.didMoveToParentViewController(self)
// self.mainViewController = toViewController
// self.userInteractionEnabled = !self.opened
// completion?(result)
// })
}
/**
A method to swap rightViewController objects.
- Parameter toViewController: The UIViewController to swap
with the active mainViewController.
- Parameter duration: A NSTimeInterval that sets the
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active mainViewController
to the toViewController.
- Parameter animations: An animation block that is executed during
the transition from the active mainViewController
to the toViewController.
- Parameter completion: A completion block that is execited after
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromRightViewController(toViewController: UIViewController, duration: NSTimeInterval, options: UIViewAnimationOptions, animations: (() -> Void)?, completion: ((Bool) -> Void)?) {
// leftViewController?.willMoveToParentViewController(nil)
// addChildViewController(toViewController)
// toViewController.view.frame = view.bounds
// transitionFromViewController(mainViewController,
// toViewController: toViewController,
// duration: duration,
// options: options,
// animations: animations,
// completion: { [unowned self, mainViewController = self.mainViewController] (result: Bool) in
// mainViewController.removeFromParentViewController()
// toViewController.didMoveToParentViewController(self)
// self.mainViewController = toViewController
// self.userInteractionEnabled = !self.opened
// completion?(result)
// })
}
/**
A method that is used to set the width of the leftView when
opened. This is the recommended method of setting the leftView
width.
......@@ -552,6 +496,8 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
if enabledLeftView {
if let v: MaterialView = leftView {
toggleStatusBar(true)
showView(v)
backdropLayer.hidden = false
delegate?.sideNavigationViewWillOpen?(self, position: .Left)
......@@ -577,6 +523,8 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
if enabledRightView {
if let v: MaterialView = rightView {
toggleStatusBar(true)
showView(v)
backdropLayer.hidden = false
delegate?.sideNavigationViewWillOpen?(self, position: .Right)
......@@ -611,6 +559,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}) { [unowned self] in
self.userInteractionEnabled = true
self.hideDepth(v)
self.hideView(v)
self.delegate?.sideNavigationViewDidClose?(self, position: .Left)
}
}
......@@ -636,6 +585,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}) { [unowned self] in
self.userInteractionEnabled = true
self.hideDepth(v)
self.hideView(v)
self.delegate?.sideNavigationViewDidClose?(self, position: .Right)
}
}
......@@ -669,8 +619,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
case .Began:
backdropLayer.hidden = false
originalX = v.position.x
toggleStatusBar(true)
showDepth(v)
showView(v)
delegate?.sideNavigationViewPanDidBegin?(self, point: point, position: .Right)
case .Changed:
......@@ -704,8 +656,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
case .Began:
backdropLayer.hidden = false
originalX = v.position.x
toggleStatusBar(true)
showDepth(v)
showView(v)
delegate?.sideNavigationViewPanDidBegin?(self, point: point, position: .Left)
case .Changed:
......@@ -800,6 +754,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
view.addSubview(leftView!)
MaterialAnimation.animationDisabled { [unowned self] in
self.leftView!.hidden = true
self.leftView!.position.x = -self.leftViewWidth / 2
self.leftView!.zPosition = 1000
}
......@@ -815,6 +770,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
view.addSubview(rightView!)
MaterialAnimation.animationDisabled { [unowned self] in
self.rightView!.hidden = true
self.rightView!.position.x = self.view.bounds.width + self.rightViewWidth / 2
self.rightView!.zPosition = 1000
}
......@@ -964,4 +920,24 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
container.depth = .None
}
}
/**
A method that shows a view.
- Parameter container: A container view.
*/
private func showView(container: UIView) {
MaterialAnimation.animationDisabled {
container.hidden = false
}
}
/**
A method that hides a view.
- Parameter container: A container view.
*/
private func hideView(container: UIView) {
MaterialAnimation.animationDisabled {
container.hidden = true
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment