Commit 710ad186 by Daniel Dahan

various updates for next release

parent b8659bb0
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
960B23541C3870A500E96216 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 960B23531C3870A500E96216 /* MaterialKit.framework */; };
960B23551C3870A500E96216 /* MaterialKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 960B23531C3870A500E96216 /* MaterialKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
967513CA1C136BB7009F455A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513C91C136BB7009F455A /* AppDelegate.swift */; }; 967513CA1C136BB7009F455A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513C91C136BB7009F455A /* AppDelegate.swift */; };
967513CC1C136BB7009F455A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513CB1C136BB7009F455A /* ViewController.swift */; }; 967513CC1C136BB7009F455A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967513CB1C136BB7009F455A /* ViewController.swift */; };
967513D11C136BB7009F455A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 967513D01C136BB7009F455A /* Assets.xcassets */; }; 967513D11C136BB7009F455A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 967513D01C136BB7009F455A /* Assets.xcassets */; };
...@@ -20,6 +22,7 @@ ...@@ -20,6 +22,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
960B23551C3870A500E96216 /* MaterialKit.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -27,6 +30,7 @@ ...@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
960B23531C3870A500E96216 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = MaterialKit.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/MaterialKit-gdulktuccbcfwbdfadtpxkworhyc/Build/Products/Debug-iphoneos/MaterialKit.framework"; sourceTree = "<absolute>"; };
967513C61C136BB7009F455A /* CardView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CardView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 967513C61C136BB7009F455A /* CardView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CardView.app; sourceTree = BUILT_PRODUCTS_DIR; };
967513C91C136BB7009F455A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 967513C91C136BB7009F455A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
967513CB1C136BB7009F455A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 967513CB1C136BB7009F455A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
...@@ -40,6 +44,7 @@ ...@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
960B23541C3870A500E96216 /* MaterialKit.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -49,6 +54,7 @@ ...@@ -49,6 +54,7 @@
967513BD1C136BB7009F455A = { 967513BD1C136BB7009F455A = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
960B23531C3870A500E96216 /* MaterialKit.framework */,
967513C81C136BB7009F455A /* CardView */, 967513C81C136BB7009F455A /* CardView */,
967513C71C136BB7009F455A /* Products */, 967513C71C136BB7009F455A /* Products */,
); );
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -27,8 +27,8 @@ class ViewController: UIViewController { ...@@ -27,8 +27,8 @@ class ViewController: UIViewController {
// Examples of using CardView. // Examples of using CardView.
// Uncomment different examples and read // Uncomment different examples and read
// the comments below. // the comments below.
// prepareGeneralCardViewExample() prepareGeneralCardViewExample()
prepareCardViewWithoutPulseBackgroundImageExample() // prepareCardViewWithoutPulseBackgroundImageExample()
// prepareCardViewWithAlteredAlignmentExample() // prepareCardViewWithAlteredAlignmentExample()
// prepareCardViewButtonBarExample() // prepareCardViewButtonBarExample()
} }
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io>. // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved..
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -65,7 +65,7 @@ public class MaterialButton : UIButton { ...@@ -65,7 +65,7 @@ public class MaterialButton : UIButton {
/** /**
:name: pulseColorOpacity :name: pulseColorOpacity
*/ */
public var pulseColorOpacity: CGFloat = MaterialTheme.pulseView.pulseColorOpacity { public var pulseColorOpacity: CGFloat = 0.25 {
didSet { didSet {
updatePulseLayer() updatePulseLayer()
} }
...@@ -428,7 +428,7 @@ public class MaterialButton : UIButton { ...@@ -428,7 +428,7 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrink() shrinkAnimation()
} }
/** /**
...@@ -436,7 +436,7 @@ public class MaterialButton : UIButton { ...@@ -436,7 +436,7 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrink() shrinkAnimation()
} }
/** /**
...@@ -500,7 +500,7 @@ public class MaterialButton : UIButton { ...@@ -500,7 +500,7 @@ public class MaterialButton : UIButton {
/** /**
:name: shrink :name: shrink
*/ */
internal func shrink() { internal func shrinkAnimation() {
let t: CFTimeInterval = 0.25 let t: CFTimeInterval = 0.25
let s: CGFloat = 1 let s: CGFloat = 1
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -22,13 +22,13 @@ public extension UIImage { ...@@ -22,13 +22,13 @@ public extension UIImage {
/** /**
:name: contentsOfURL :name: contentsOfURL
*/ */
public class func contentsOfURL(URL: NSURL, completion: ((image: UIImage?, error: NSError?) -> Void)?) { public class func contentsOfURL(URL: NSURL, completion: ((image: UIImage?, error: NSError?) -> Void)) {
let request: NSURLRequest = NSURLRequest(URL: URL) let request: NSURLRequest = NSURLRequest(URL: URL)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response: NSURLResponse?, data: NSData?, error: NSError?) -> Void in NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response: NSURLResponse?, data: NSData?, error: NSError?) -> Void in
if let v: NSError = error { if let v: NSError = error {
completion?(image: nil, error: v) completion(image: nil, error: v)
} else if let v: NSData = data { } else if let v: NSData = data {
completion?(image: UIImage(data: v), error: nil) completion(image: UIImage(data: v), error: nil)
} }
} }
} }
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -19,19 +19,13 @@ ...@@ -19,19 +19,13 @@
import UIKit import UIKit
public class MaterialPulseView : MaterialView { public class MaterialPulseView : MaterialView {
/** /// A CAShapeLayer used in the pulse animation.
:name: pulseLayer
*/
public private(set) lazy var pulseLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var pulseLayer: CAShapeLayer = CAShapeLayer()
/** /// Sets whether the scaling animation should be used.
:name: pulseScale
*/
public lazy var pulseScale: Bool = true public lazy var pulseScale: Bool = true
/** /// Enables and disables the spotlight effect.
:name: spotlight
*/
public var spotlight: Bool = false { public var spotlight: Bool = false {
didSet { didSet {
if spotlight { if spotlight {
...@@ -41,7 +35,8 @@ public class MaterialPulseView : MaterialView { ...@@ -41,7 +35,8 @@ public class MaterialPulseView : MaterialView {
} }
/** /**
:name: pulseFill Determines if the pulse animation should fill the entire
view.
*/ */
public var pulseFill: Bool = false { public var pulseFill: Bool = false {
didSet { didSet {
...@@ -51,18 +46,14 @@ public class MaterialPulseView : MaterialView { ...@@ -51,18 +46,14 @@ public class MaterialPulseView : MaterialView {
} }
} }
/** /// The opcaity value for the pulse animation.
:name: pulseColorOpacity public var pulseColorOpacity: CGFloat = 0.25 {
*/
public var pulseColorOpacity: CGFloat = MaterialTheme.pulseView.pulseColorOpacity {
didSet { didSet {
updatedPulseLayer() updatedPulseLayer()
} }
} }
/** /// The color of the pulse effect.
:name: pulseColor
*/
public var pulseColor: UIColor? { public var pulseColor: UIColor? {
didSet { didSet {
updatedPulseLayer() updatedPulseLayer()
...@@ -70,7 +61,10 @@ public class MaterialPulseView : MaterialView { ...@@ -70,7 +61,10 @@ public class MaterialPulseView : MaterialView {
} }
/** /**
:name: touchesBegan A delegation method that is executed when the view has began a
touch event.
- Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object.
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, withEvent: event)
...@@ -100,7 +94,10 @@ public class MaterialPulseView : MaterialView { ...@@ -100,7 +94,10 @@ public class MaterialPulseView : MaterialView {
} }
/** /**
:name: touchesMoved A delegation method that is executed when the view touch event is
moving.
- Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object.
*/ */
public override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesMoved(touches, withEvent: event) super.touchesMoved(touches, withEvent: event)
...@@ -115,63 +112,54 @@ public class MaterialPulseView : MaterialView { ...@@ -115,63 +112,54 @@ public class MaterialPulseView : MaterialView {
} }
/** /**
:name: touchesEnded A delegation method that is executed when the view touch event has
ended.
- Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object.
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrink() shrinkAnimation()
} }
/** /**
:name: touchesCancelled A delegation method that is executed when the view touch event has
been cancelled.
- Parameter touches: A set of UITouch objects.
- Parameter event: A UIEvent object.
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrink() shrinkAnimation()
} }
/** /**
:name: prepareView Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled pulseColor = MaterialColor.white
backgroundColor = MaterialTheme.pulseView.backgroundColor
pulseColor = MaterialTheme.pulseView.pulseColor
contentsRect = MaterialTheme.pulseView.contentsRect
contentsCenter = MaterialTheme.pulseView.contentsCenter
contentsScale = MaterialTheme.pulseView.contentsScale
contentsGravity = MaterialTheme.pulseView.contentsGravity
depth = MaterialTheme.pulseView.depth
shadowColor = MaterialTheme.pulseView.shadowColor
zPosition = MaterialTheme.pulseView.zPosition
borderWidth = MaterialTheme.pulseView.borderWidth
borderColor = MaterialTheme.pulseView.bordercolor
preparePulseLayer() preparePulseLayer()
} }
/** /// Prepares the pulseLayer property.
:name: preparePulseLayer
*/
internal func preparePulseLayer() { internal func preparePulseLayer() {
pulseLayer.hidden = true pulseLayer.hidden = true
pulseLayer.zPosition = 1 pulseLayer.zPosition = 1
visualLayer.addSublayer(pulseLayer) visualLayer.addSublayer(pulseLayer)
} }
/** /// Updates the pulseLayer when settings have changed.
:name: updatedPulseLayer
*/
internal func updatedPulseLayer() { internal func updatedPulseLayer() {
pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(pulseColorOpacity).CGColor pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(pulseColorOpacity).CGColor
} }
/** /// Executes the shrink animation for the pulse effect.
:name: shrink internal func shrinkAnimation() {
*/
internal func shrink() {
let t: CFTimeInterval = 0.25 let t: CFTimeInterval = 0.25
let s: CGFloat = 1 let s: CGFloat = 1
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
import UIKit import UIKit
public struct MaterialTheme { public struct MaterialTheme {
public struct view {}
public struct pulseView {}
public struct basicCardView {} public struct basicCardView {}
public struct imageCardView {} public struct imageCardView {}
public struct navigationBarView {} public struct navigationBarView {}
...@@ -32,60 +30,6 @@ public struct MaterialTheme { ...@@ -32,60 +30,6 @@ public struct MaterialTheme {
public struct fabButton {} public struct fabButton {}
} }
// view
public extension MaterialTheme.view {
// shadow
public static var depth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black
// border
public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black
// color
public static var backgroundColor: UIColor = MaterialColor.white
// interaction
public static var userInteractionEnabled: Bool = true
// image
public static var contentsRect: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsCenter: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsScale: CGFloat = UIScreen.mainScreen().scale
public static var contentsGravity: MaterialGravity = .ResizeAspectFill
// position
public static var zPosition: CGFloat = 0
}
// pulseView
public extension MaterialTheme.pulseView {
// shadow
public static var depth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black
// border
public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black
// color
public static var backgroundColor: UIColor = MaterialColor.clear
public static var pulseColor: UIColor = MaterialColor.white
public static var pulseColorOpacity: CGFloat = 0.25
// interaction
public static var userInteractionEnabled: Bool = true
// image
public static var contentsRect: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsCenter: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsScale: CGFloat = UIScreen.mainScreen().scale
public static var contentsGravity: MaterialGravity = .ResizeAspectFill
// position
public static var zPosition: CGFloat = 0
}
// basicCardView // basicCardView
public extension MaterialTheme.basicCardView { public extension MaterialTheme.basicCardView {
// shadow // shadow
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -248,7 +248,8 @@ public class MaterialView : UIView { ...@@ -248,7 +248,8 @@ public class MaterialView : UIView {
} }
/** /**
:name: borderWidth A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: MaterialBorder {
didSet { didSet {
...@@ -256,18 +257,14 @@ public class MaterialView : UIView { ...@@ -256,18 +257,14 @@ public class MaterialView : UIView {
} }
} }
/** /// A property that accesses the layer.borderColor property.
:name: borderColor
*/
public var borderColor: UIColor? { public var borderColor: UIColor? {
didSet { didSet {
layer.borderColor = borderColor?.CGColor layer.borderColor = borderColor?.CGColor
} }
} }
/** /// A property that accesses the layer.position property.
:name: position
*/
public var position: CGPoint { public var position: CGPoint {
get { get {
return layer.position return layer.position
...@@ -277,9 +274,7 @@ public class MaterialView : UIView { ...@@ -277,9 +274,7 @@ public class MaterialView : UIView {
} }
} }
/** /// A property that accesses the layer.zPosition property.
:name: zPosition
*/
public var zPosition: CGFloat { public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
...@@ -290,15 +285,16 @@ public class MaterialView : UIView { ...@@ -290,15 +285,16 @@ public class MaterialView : UIView {
} }
/** /**
:name: init An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
contentsRect = MaterialTheme.view.contentsRect contentsRect = CGRectMake(0, 0, 1, 1)
contentsCenter = MaterialTheme.view.contentsCenter contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = MaterialTheme.view.contentsScale contentsScale = UIScreen.mainScreen().scale
contentsGravity = MaterialTheme.view.contentsGravity contentsGravity = .ResizeAspectFill
borderWidth = MaterialTheme.view.borderWidth borderWidth = .None
depth = MaterialTheme.view.depth depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
...@@ -306,31 +302,30 @@ public class MaterialView : UIView { ...@@ -306,31 +302,30 @@ public class MaterialView : UIView {
} }
/** /**
:name: init An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
contentsRect = MaterialTheme.view.contentsRect contentsRect = CGRectMake(0, 0, 1, 1)
contentsCenter = MaterialTheme.view.contentsCenter contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = MaterialTheme.view.contentsScale contentsScale = UIScreen.mainScreen().scale
contentsGravity = MaterialTheme.view.contentsGravity contentsGravity = .ResizeAspectFill
borderWidth = MaterialTheme.view.borderWidth borderWidth = .None
depth = MaterialTheme.view.depth depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
} }
/** /// A convenience initializer that is mostly used with AutoLayout.
:name: init
*/
public convenience init() { public convenience init() {
self.init(frame: CGRectNull) self.init(frame: CGRectNull)
} }
/** /// Overriding the layout callback for layer sublayers.
:name: layoutSublayersOfLayer
*/
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
...@@ -340,14 +335,19 @@ public class MaterialView : UIView { ...@@ -340,14 +335,19 @@ public class MaterialView : UIView {
} }
/** /**
:name: actionForLayer By default CALayer values are animated. The UIView class supresses this
behavior for its backing layer. By overrinding the actionForLayer method
and returning nil, the backing layer's default animation behavior
is enabled.
*/ */
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? { public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil return nil
} }
/** /**
:name: animate A method that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animation: A CAAnimation instance.
*/ */
public func animate(animation: CAAnimation) { public func animate(animation: CAAnimation) {
animation.delegate = self animation.delegate = self
...@@ -364,14 +364,21 @@ public class MaterialView : UIView { ...@@ -364,14 +364,21 @@ public class MaterialView : UIView {
} }
/** /**
:name: animationDidStart A delegation method that is executed when the backing layer starts
running an animation.
- Parameter anim: The currently running CAAnimation instance.
*/ */
public override func animationDidStart(anim: CAAnimation) { public override func animationDidStart(anim: CAAnimation) {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStart?(anim) (delegate as? MaterialAnimationDelegate)?.materialAnimationDidStart?(anim)
} }
/** /**
:name: animationDidStop A delegation method that is executed when the backing layer stops
running an animation.
- Parameter anim: The CAAnimation instance that stopped running.
- Parameter flag: A boolean that indicates if the animation stopped
because it was completed or interrupted. True if completed, false
if interrupted.
*/ */
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) { public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation { if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
...@@ -391,40 +398,33 @@ public class MaterialView : UIView { ...@@ -391,40 +398,33 @@ public class MaterialView : UIView {
} }
/** /**
:name: prepareView Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/ */
public func prepareView() { public func prepareView() {
userInteractionEnabled = MaterialTheme.view.userInteractionEnabled
backgroundColor = MaterialTheme.view.backgroundColor
shadowColor = MaterialTheme.view.shadowColor
zPosition = MaterialTheme.view.zPosition
borderColor = MaterialTheme.view.bordercolor
prepareVisualLayer() prepareVisualLayer()
shadowColor = MaterialColor.black
borderColor = MaterialColor.black
} }
/** /// Prepares the visualLayer property.
:name: prepareVisualLayer
*/
internal func prepareVisualLayer() { internal func prepareVisualLayer() {
visualLayer.zPosition = 0 visualLayer.zPosition = 0
visualLayer.masksToBounds = true visualLayer.masksToBounds = true
layer.addSublayer(visualLayer) layer.addSublayer(visualLayer)
} }
/** /// Manages the layout for the visualLayer property.
:name: layoutVisualLayer
*/
internal func layoutVisualLayer() { internal func layoutVisualLayer() {
visualLayer.frame = bounds visualLayer.frame = bounds
visualLayer.position = CGPointMake(width / 2, height / 2) visualLayer.position = CGPointMake(width / 2, height / 2)
visualLayer.cornerRadius = layer.cornerRadius visualLayer.cornerRadius = layer.cornerRadius
} }
/** /// Manages the layout for the shape of the view instance.
:name: layoutShape
*/
internal func layoutShape() { internal func layoutShape() {
if .Circle == shape { if .Circle == shape {
layer.cornerRadius = width / 2 layer.cornerRadius = width / 2
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -18,75 +18,97 @@ ...@@ -18,75 +18,97 @@
import UIKit import UIKit
/**
:name: unique
*/
public func unique<S: SequenceType, E: Hashable where E == S.Generator.Element>(source: S) -> [E] {
var seen: [E: Bool] = [:]
return source.filter { nil == seen.updateValue(true, forKey: $0) }
}
@objc(TextDelegate) @objc(TextDelegate)
public protocol TextDelegate { public protocol TextDelegate {
/**
An optional delegation method that is executed when
text will be processed during editing.
- Parameter text: The Text instance assodicated with the
delegation object.
- Parameter textStorage: The TextStorage instance
associated with the delegation object.
- Parameter string: The string value that is currently
being edited.
- Parameter range: The range of characters that are being
edited.
*/
optional func textWillProcessEdit(text: Text, textStorage: TextStorage, string: String, range: NSRange) optional func textWillProcessEdit(text: Text, textStorage: TextStorage, string: String, range: NSRange)
/**
An optional delegation method that is executed after
the edit processing has completed.
- Parameter text: The Text instance assodicated with the
delegation object.
- Parameter textStorage: The TextStorage instance
associated with the delegation object.
- Parameter string: The string value that was edited.
- Parameter result: A NSTextCheckingResult associated
with the processing result.
- Parameter flags: Matching flags.
- Parameter stop: Halts a service which is either
publishing or resolving.
*/
optional func textDidProcessEdit(text: Text, textStorage: TextStorage, string: String, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) optional func textDidProcessEdit(text: Text, textStorage: TextStorage, string: String, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>)
} }
@objc(Text) @objc(Text)
public class Text : NSObject { public class Text : NSObject {
/** /// The string pattern to match within the textStorage.
:name: pattern
*/
public var pattern: String = "(^|\\s)#[\\d\\w_\u{203C}\u{2049}\u{20E3}\u{2122}\u{2139}\u{2194}-\u{2199}\u{21A9}-\u{21AA}\u{231A}-\u{231B}\u{23E9}-\u{23EC}\u{23F0}\u{23F3}\u{24C2}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2600}-\u{2601}\u{260E}\u{2611}\u{2614}-\u{2615}\u{261D}\u{263A}\u{2648}-\u{2653}\u{2660}\u{2663}\u{2665}-\u{2666}\u{2668}\u{267B}\u{267F}\u{2693}\u{26A0}-\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270C}\u{270F}\u{2712}\u{2714}\u{2716}\u{2728}\u{2733}-\u{2734}\u{2744}\u{2747}\u{274C}\u{274E}\u{2753}-\u{2755}\u{2757}\u{2764}\u{2795}-\u{2797}\u{27A1}\u{27B0}\u{2934}-\u{2935}\u{2B05}-\u{2B07}\u{2B1B}-\u{2B1C}\u{2B50}\u{2B55}\u{3030}\u{303D}\u{3297}\u{3299}\u{1F004}\u{1F0CF}\u{1F170}-\u{1F171}\u{1F17E}-\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E7}-\u{1F1EC}\u{1F1EE}-\u{1F1F0}\u{1F1F3}\u{1F1F5}\u{1F1F7}-\u{1F1FA}\u{1F201}-\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}-\u{1F251}\u{1F300}-\u{1F320}\u{1F330}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F380}-\u{1F393}\u{1F3A0}-\u{1F3C4}\u{1F3C6}-\u{1F3CA}\u{1F3E0}-\u{1F3F0}\u{1F400}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4F7}\u{1F4F9}-\u{1F4FC}\u{1F500}-\u{1F507}\u{1F509}-\u{1F53D}\u{1F550}-\u{1F567}\u{1F5FB}-\u{1F640}\u{1F645}-\u{1F64F}\u{1F680}-\u{1F68A}]+" { public var pattern: String = "(^|\\s)#[\\d\\w_\u{203C}\u{2049}\u{20E3}\u{2122}\u{2139}\u{2194}-\u{2199}\u{21A9}-\u{21AA}\u{231A}-\u{231B}\u{23E9}-\u{23EC}\u{23F0}\u{23F3}\u{24C2}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2600}-\u{2601}\u{260E}\u{2611}\u{2614}-\u{2615}\u{261D}\u{263A}\u{2648}-\u{2653}\u{2660}\u{2663}\u{2665}-\u{2666}\u{2668}\u{267B}\u{267F}\u{2693}\u{26A0}-\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270C}\u{270F}\u{2712}\u{2714}\u{2716}\u{2728}\u{2733}-\u{2734}\u{2744}\u{2747}\u{274C}\u{274E}\u{2753}-\u{2755}\u{2757}\u{2764}\u{2795}-\u{2797}\u{27A1}\u{27B0}\u{2934}-\u{2935}\u{2B05}-\u{2B07}\u{2B1B}-\u{2B1C}\u{2B50}\u{2B55}\u{3030}\u{303D}\u{3297}\u{3299}\u{1F004}\u{1F0CF}\u{1F170}-\u{1F171}\u{1F17E}-\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E7}-\u{1F1EC}\u{1F1EE}-\u{1F1F0}\u{1F1F3}\u{1F1F5}\u{1F1F7}-\u{1F1FA}\u{1F201}-\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}-\u{1F251}\u{1F300}-\u{1F320}\u{1F330}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F380}-\u{1F393}\u{1F3A0}-\u{1F3C4}\u{1F3C6}-\u{1F3CA}\u{1F3E0}-\u{1F3F0}\u{1F400}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4F7}\u{1F4F9}-\u{1F4FC}\u{1F500}-\u{1F507}\u{1F509}-\u{1F53D}\u{1F550}-\u{1F567}\u{1F5FB}-\u{1F640}\u{1F645}-\u{1F64F}\u{1F680}-\u{1F68A}]+" {
didSet { didSet {
textStorage.expression = try? NSRegularExpression(pattern: pattern, options: []) prepareTextStorageExpression()
} }
} }
/** /// TextStorage instance that is observed while editing.
:name: textStorage
*/
public private(set) var textStorage: TextStorage = TextStorage() public private(set) var textStorage: TextStorage = TextStorage()
/** /// Delegation object for pre and post text processing.
:name: delegate
*/
public weak var delegate: TextDelegate? public weak var delegate: TextDelegate?
/** /// Initializer.
:name: init
*/
public override init() { public override init() {
super.init() super.init()
textStorage.expression = try? NSRegularExpression(pattern: pattern, options: []) prepareTextStorageExpression()
textStorage.textWillProcessEdit = { (textStorage: TextStorage, string: String, range: NSRange) -> Void in prepareTextStorageProcessingCallbacks()
self.delegate?.textWillProcessEdit?(self, textStorage: textStorage, string: string, range: range)
}
textStorage.textDidProcessEdit = { (textStorage: TextStorage, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.delegate?.textDidProcessEdit?(self, textStorage: textStorage, string: textStorage.string, result: result, flags: flags, stop: stop)
}
} }
/** /**
:name: string A convenience property that accesses the textStorage
string.
*/ */
public var string: String { public var string: String {
return textStorage.string return textStorage.string
} }
/** /// An Array of matches that match the pattern expression.
:name: matches
*/
public var matches: Array<String> { public var matches: Array<String> {
return textStorage.expression!.matchesInString(string, options: [], range: NSMakeRange(0, string.utf16.count)).map { return textStorage.expression!.matchesInString(string, options: [], range: NSMakeRange(0, string.utf16.count)).map {
(self.string as NSString).substringWithRange($0.range).stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) (self.string as NSString).substringWithRange($0.range).trim()
} }
} }
/** /**
:name: uniqueMatches An Array of unique matches that match the pattern
expression.
*/ */
public var uniqueMatches: Array<String> { public var uniqueMatches: Array<String> {
return unique(matches) var seen: [String: Bool] = [:]
return matches.filter { nil == seen.updateValue(true, forKey: $0) }
}
/// Prepares the TextStorage regular expression for matching.
private func prepareTextStorageExpression() {
textStorage.expression = try? NSRegularExpression(pattern: pattern, options: [])
}
/// Prepares the pre and post processing callbacks.
private func prepareTextStorageProcessingCallbacks() {
textStorage.textWillProcessEdit = { [unowned self] (textStorage: TextStorage, string: String, range: NSRange) -> Void in
self.delegate?.textWillProcessEdit?(self, textStorage: textStorage, string: string, range: range)
}
textStorage.textDidProcessEdit = { [unowned self] (textStorage: TextStorage, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.delegate?.textDidProcessEdit?(self, textStorage: textStorage, string: textStorage.string, result: result, flags: flags, stop: stop)
}
} }
} }
\ No newline at end of file
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -21,23 +21,17 @@ import UIKit ...@@ -21,23 +21,17 @@ import UIKit
public protocol TextFieldDelegate : UITextFieldDelegate {} public protocol TextFieldDelegate : UITextFieldDelegate {}
public class TextField : UITextField { public class TextField : UITextField {
/** /// The bottom border layer.
:name: bottomBorderLayer
*/
public private(set) lazy var bottomBorderLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var bottomBorderLayer: CAShapeLayer = CAShapeLayer()
/** /// A property that accesses the backing layer's backgroundColor.
:name: backgroundColor
*/
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/** /// A property that accesses the layer.frame.origin.x property.
:name: x
*/
public var x: CGFloat { public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
...@@ -47,9 +41,7 @@ public class TextField : UITextField { ...@@ -47,9 +41,7 @@ public class TextField : UITextField {
} }
} }
/** /// A property that accesses the layer.frame.origin.y property.
:name: y
*/
public var y: CGFloat { public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
...@@ -60,7 +52,10 @@ public class TextField : UITextField { ...@@ -60,7 +52,10 @@ public class TextField : UITextField {
} }
/** /**
:name: width A property that accesses the layer.frame.origin.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
*/ */
public var width: CGFloat { public var width: CGFloat {
get { get {
...@@ -72,7 +67,10 @@ public class TextField : UITextField { ...@@ -72,7 +67,10 @@ public class TextField : UITextField {
} }
/** /**
:name: height A property that accesses the layer.frame.origin.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
*/ */
public var height: CGFloat { public var height: CGFloat {
get { get {
...@@ -84,7 +82,8 @@ public class TextField : UITextField { ...@@ -84,7 +82,8 @@ public class TextField : UITextField {
} }
/** /**
:name: borderWidth A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: MaterialBorder {
didSet { didSet {
...@@ -92,18 +91,14 @@ public class TextField : UITextField { ...@@ -92,18 +91,14 @@ public class TextField : UITextField {
} }
} }
/** /// A property that accesses the layer.borderColor property.
:name: borderColor
*/
public var borderColor: UIColor? { public var borderColor: UIColor? {
didSet { didSet {
layer.borderColor = borderColor?.CGColor layer.borderColor = borderColor?.CGColor
} }
} }
/** /// A property that accesses the layer.position property.
:name: position
*/
public var position: CGPoint { public var position: CGPoint {
get { get {
return layer.position return layer.position
...@@ -113,9 +108,7 @@ public class TextField : UITextField { ...@@ -113,9 +108,7 @@ public class TextField : UITextField {
} }
} }
/** /// A property that accesses the layer.zPosition property.
:name: zPosition
*/
public var zPosition: CGFloat { public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -22,55 +22,39 @@ internal typealias TextWillProcessEdit = (TextStorage, String, NSRange) -> Void ...@@ -22,55 +22,39 @@ internal typealias TextWillProcessEdit = (TextStorage, String, NSRange) -> Void
internal typealias TextDidProcessEdit = (TextStorage, NSTextCheckingResult?, NSMatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void internal typealias TextDidProcessEdit = (TextStorage, NSTextCheckingResult?, NSMatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void
public class TextStorage: NSTextStorage { public class TextStorage: NSTextStorage {
/** /// A callback that is executed when a process edit will happen.
:name: store
*/
private lazy var store: NSMutableAttributedString = NSMutableAttributedString()
/**
:name: expression
*/
internal var expression: NSRegularExpression?
/**
:name: textWillProcessEdit
*/
internal var textWillProcessEdit: TextWillProcessEdit? internal var textWillProcessEdit: TextWillProcessEdit?
/** /// A callback that is executed when a process edit did happen.
:name: textDidProcessEdit
*/
internal var textDidProcessEdit: TextDidProcessEdit? internal var textDidProcessEdit: TextDidProcessEdit?
/** /// A storage facility for attributed text.
:name: init public lazy var store: NSMutableAttributedString = NSMutableAttributedString()
*/
/// The regular expression to match text fragments against.
public var expression: NSRegularExpression?
/// Initializer.
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
/** /// Initializer.
:name: init
*/
public override init() { public override init() {
super.init() super.init()
} }
/** /// A String value of the attirbutedString property.
:name: string public override var string: String {
*/
override public var string: String {
get {
return store.string return store.string
} }
}
/** /// Processes the text when editing.
:name: processEditing
*/
public override func processEditing() { public override func processEditing() {
let range: NSRange = (string as NSString).paragraphRangeForRange(editedRange) let range: NSRange = (string as NSString).paragraphRangeForRange(editedRange)
textWillProcessEdit?(self, string, range) textWillProcessEdit?(self, string, range)
expression!.enumerateMatchesInString(string, options: [], range: range) { (result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in expression!.enumerateMatchesInString(string, options: [], range: range) { (result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.textDidProcessEdit?(self, result, flags, stop) self.textDidProcessEdit?(self, result, flags, stop)
} }
...@@ -78,14 +62,26 @@ public class TextStorage: NSTextStorage { ...@@ -78,14 +62,26 @@ public class TextStorage: NSTextStorage {
} }
/** /**
:name: attributesAtIndex Returns the attributes for the character at a given index.
- Parameter location: The index for which to return attributes.
This value must lie within the bounds of the receiver.
- Parameter range: Upon return, the range over which the
attributes and values are the same as those at index. This range
isn’t necessarily the maximum range covered, and its extent is
implementation-dependent. If you need the maximum range, use
attributesAtIndex:longestEffectiveRange:inRange:.
If you don't need this value, pass NULL.
- Returns: The attributes for the character at index.
*/ */
public override func attributesAtIndex(location: Int, effectiveRange range: NSRangePointer) -> [String : AnyObject] { public override func attributesAtIndex(location: Int, effectiveRange range: NSRangePointer) -> [String : AnyObject] {
return store.attributesAtIndex(location, effectiveRange: range) return store.attributesAtIndex(location, effectiveRange: range)
} }
/** /**
:name: replaceCharactersInRange Replaces a range of text with a string value.
- Parameter range: The character range to replace.
- Parameter str: The string value that the characters
will be replaced with.
*/ */
public override func replaceCharactersInRange(range: NSRange, withString str: String) { public override func replaceCharactersInRange(range: NSRange, withString str: String) {
store.replaceCharactersInRange(range, withString: str) store.replaceCharactersInRange(range, withString: str)
...@@ -93,7 +89,10 @@ public class TextStorage: NSTextStorage { ...@@ -93,7 +89,10 @@ public class TextStorage: NSTextStorage {
} }
/** /**
:name: setAttributes Sets the attributedString attribute values.
- Parameter attrs: The attributes to set.
- Parameter range: A range of characters that will have their
attributes updated.
*/ */
public override func setAttributes(attrs: [String : AnyObject]?, range: NSRange) { public override func setAttributes(attrs: [String : AnyObject]?, range: NSRange) {
store.setAttributes(attrs, range: range) store.setAttributes(attrs, range: range)
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
// //
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> // Copyright (C) 2015 - 2016 CosmicMind, Inc. <http://cosmicmind.io>. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
......
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