Commit bc0d00c7 by Daniel Dahan

initil reorganization of TextView

parent 53092d1d
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
960590221C388FD800691E88 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960590211C388FD800691E88 /* ViewController.swift */; }; 960590221C388FD800691E88 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960590211C388FD800691E88 /* ViewController.swift */; };
960590271C388FD800691E88 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 960590261C388FD800691E88 /* Assets.xcassets */; }; 960590271C388FD800691E88 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 960590261C388FD800691E88 /* Assets.xcassets */; };
9605902A1C388FD800691E88 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 960590281C388FD800691E88 /* LaunchScreen.storyboard */; }; 9605902A1C388FD800691E88 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 960590281C388FD800691E88 /* LaunchScreen.storyboard */; };
96977E161CBD7F59000BEFC4 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96977E151CBD7F59000BEFC4 /* Material.framework */; };
96977E171CBD7F59000BEFC4 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96977E151CBD7F59000BEFC4 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -20,6 +22,7 @@ ...@@ -20,6 +22,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96977E171CBD7F59000BEFC4 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -33,6 +36,7 @@ ...@@ -33,6 +36,7 @@
960590261C388FD800691E88 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 960590261C388FD800691E88 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
960590291C388FD800691E88 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 960590291C388FD800691E88 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9605902B1C388FD800691E88 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 9605902B1C388FD800691E88 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96977E151CBD7F59000BEFC4 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -40,6 +44,7 @@ ...@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96977E161CBD7F59000BEFC4 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -49,6 +54,7 @@ ...@@ -49,6 +54,7 @@
960590131C388FD800691E88 = { 960590131C388FD800691E88 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96977E151CBD7F59000BEFC4 /* Material.framework */,
9605901E1C388FD800691E88 /* TextView */, 9605901E1C388FD800691E88 /* TextView */,
9605901D1C388FD800691E88 /* Products */, 9605901D1C388FD800691E88 /* Products */,
); );
......
...@@ -56,28 +56,13 @@ class ViewController: UIViewController, TextDelegate { ...@@ -56,28 +56,13 @@ class ViewController: UIViewController, TextDelegate {
/// Prepares the textView. /// Prepares the textView.
func prepareTextView() { func prepareTextView() {
let layoutManager: NSLayoutManager = NSLayoutManager() textView = TextView()
let textContainer: NSTextContainer = NSTextContainer(size: view.bounds.size) // textView.font = RobotoFont.regular
layoutManager.addTextContainer(textContainer) textView.backgroundColor = MaterialColor.grey.base
text.delegate = self
text.textStorage.addLayoutManager(layoutManager)
textView = TextView(textContainer: textContainer)
textView.font = RobotoFont.regular
textView.placeholderLabel = UILabel()
textView.placeholderLabel!.textColor = MaterialColor.grey.base
textView.placeholderLabel!.text = "Description"
textView.titleLabel = UILabel()
textView.titleLabel!.font = RobotoFont.mediumWithSize(12)
textView.titleLabelColor = MaterialColor.grey.base
textView.titleLabelActiveColor = MaterialColor.blue.accent3
view.addSubview(textView) view.addSubview(textView)
textView!.translatesAutoresizingMaskIntoConstraints = false textView!.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: textView!, top: 124, left: 24, bottom: 24, right: 24) MaterialLayout.alignToParent(view, child: textView!, top: 124, left: 24, bottom: 200, right: 24)
} }
/** /**
...@@ -97,4 +82,3 @@ class ViewController: UIViewController, TextDelegate { ...@@ -97,4 +82,3 @@ class ViewController: UIViewController, TextDelegate {
textStorage.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(16), range: result!.range) textStorage.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(16), range: result!.range)
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
9660162A1CB2F04E00AAB661 /* Material.h in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C091C1328D800B91418 /* Material.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9660162A1CB2F04E00AAB661 /* Material.h in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C091C1328D800B91418 /* Material.h */; settings = {ATTRIBUTES = (Public, ); }; };
96815B381CA07BA20006CBE2 /* MaterialViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967887881C9777CB0037F6C9 /* MaterialViewTests.swift */; }; 96815B381CA07BA20006CBE2 /* MaterialViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967887881C9777CB0037F6C9 /* MaterialViewTests.swift */; };
96977DA61CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96977DA51CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift */; }; 96977DA61CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96977DA51CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift */; };
96977E191CBDA44B000BEFC4 /* MaterialTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96977E181CBDA44B000BEFC4 /* MaterialTextView.swift */; };
96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7581CB40DC500C806FE /* BottomNavigationController.swift */; }; 96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7581CB40DC500C806FE /* BottomNavigationController.swift */; };
96BCB7A21CB40DC500C806FE /* BottomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */; }; 96BCB7A21CB40DC500C806FE /* BottomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */; };
96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75A1CB40DC500C806FE /* CapturePreview.swift */; }; 96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75A1CB40DC500C806FE /* CapturePreview.swift */; };
...@@ -199,6 +200,7 @@ ...@@ -199,6 +200,7 @@
9660161C1CB2ED6C00AAB661 /* Material OSX Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Material OSX Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 9660161C1CB2ED6C00AAB661 /* Material OSX Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Material OSX Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
967887881C9777CB0037F6C9 /* MaterialViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialViewTests.swift; sourceTree = "<group>"; }; 967887881C9777CB0037F6C9 /* MaterialViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialViewTests.swift; sourceTree = "<group>"; };
96977DA51CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+FilterBlur.swift"; sourceTree = "<group>"; }; 96977DA51CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+FilterBlur.swift"; sourceTree = "<group>"; };
96977E181CBDA44B000BEFC4 /* MaterialTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextView.swift; sourceTree = "<group>"; };
96BCB7581CB40DC500C806FE /* BottomNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomNavigationController.swift; sourceTree = "<group>"; }; 96BCB7581CB40DC500C806FE /* BottomNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomNavigationController.swift; sourceTree = "<group>"; };
96BCB7591CB40DC500C806FE /* BottomTabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomTabBar.swift; sourceTree = "<group>"; }; 96BCB7591CB40DC500C806FE /* BottomTabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomTabBar.swift; sourceTree = "<group>"; };
96BCB75A1CB40DC500C806FE /* CapturePreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapturePreview.swift; sourceTree = "<group>"; }; 96BCB75A1CB40DC500C806FE /* CapturePreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapturePreview.swift; sourceTree = "<group>"; };
...@@ -577,6 +579,7 @@ ...@@ -577,6 +579,7 @@
96BCB79C1CB40DC500C806FE /* TextField.swift */, 96BCB79C1CB40DC500C806FE /* TextField.swift */,
96BCB79D1CB40DC500C806FE /* TextStorage.swift */, 96BCB79D1CB40DC500C806FE /* TextStorage.swift */,
96BCB79E1CB40DC500C806FE /* TextView.swift */, 96BCB79E1CB40DC500C806FE /* TextView.swift */,
96977E181CBDA44B000BEFC4 /* MaterialTextView.swift */,
); );
name = Text; name = Text;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -863,6 +866,7 @@ ...@@ -863,6 +866,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96977E191CBDA44B000BEFC4 /* MaterialTextView.swift in Sources */,
96BCB7C01CB40DC500C806FE /* MaterialDataSourceItem.swift in Sources */, 96BCB7C01CB40DC500C806FE /* MaterialDataSourceItem.swift in Sources */,
96BCB7AC1CB40DC500C806FE /* Material+Obj-C.swift in Sources */, 96BCB7AC1CB40DC500C806FE /* Material+Obj-C.swift in Sources */,
96BCB7BB1CB40DC500C806FE /* MaterialCollectionViewCell.swift in Sources */, 96BCB7BB1CB40DC500C806FE /* MaterialCollectionViewCell.swift in Sources */,
......
...@@ -92,7 +92,7 @@ public class BottomTabBar : UITabBar { ...@@ -92,7 +92,7 @@ public class BottomTabBar : UITabBar {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -107,7 +107,7 @@ public class BottomTabBar : UITabBar { ...@@ -107,7 +107,7 @@ public class BottomTabBar : UITabBar {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -111,7 +111,7 @@ public class MaterialButton : UIButton { ...@@ -111,7 +111,7 @@ public class MaterialButton : UIButton {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -129,7 +129,7 @@ public class MaterialButton : UIButton { ...@@ -129,7 +129,7 @@ public class MaterialButton : UIButton {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -218,7 +218,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -218,7 +218,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -236,7 +236,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -236,7 +236,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -97,7 +97,7 @@ public class MaterialSwitch : UIControl { ...@@ -97,7 +97,7 @@ public class MaterialSwitch : UIControl {
/// A property that accesses the layer.frame.size.width property. /// A property that accesses the layer.frame.size.width property.
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -107,7 +107,7 @@ public class MaterialSwitch : UIControl { ...@@ -107,7 +107,7 @@ public class MaterialSwitch : UIControl {
/// A property that accesses the layer.frame.size.height property. /// A property that accesses the layer.frame.size.height property.
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -110,7 +110,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -110,7 +110,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -125,7 +125,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -125,7 +125,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -166,7 +166,7 @@ public class MaterialView : UIView { ...@@ -166,7 +166,7 @@ public class MaterialView : UIView {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -184,7 +184,7 @@ public class MaterialView : UIView { ...@@ -184,7 +184,7 @@ public class MaterialView : UIView {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -134,7 +134,7 @@ public class NavigationBar : UINavigationBar { ...@@ -134,7 +134,7 @@ public class NavigationBar : UINavigationBar {
*/ */
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -149,7 +149,7 @@ public class NavigationBar : UINavigationBar { ...@@ -149,7 +149,7 @@ public class NavigationBar : UINavigationBar {
*/ */
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
...@@ -80,7 +80,7 @@ public class TextField : UITextField { ...@@ -80,7 +80,7 @@ public class TextField : UITextField {
/// A property that accesses the layer.frame.size.width property. /// A property that accesses the layer.frame.size.width property.
@IBInspectable public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.width
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
...@@ -90,7 +90,7 @@ public class TextField : UITextField { ...@@ -90,7 +90,7 @@ public class TextField : UITextField {
/// A property that accesses the layer.frame.size.height property. /// A property that accesses the layer.frame.size.height property.
@IBInspectable public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.height
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
......
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