From 5643cf9194718c7c772b965c3bf13337cc7d4e8c Mon Sep 17 00:00:00 2001 From: Natasha Murashev Date: Mon, 15 Dec 2014 07:33:11 -0500 Subject: [PATCH] updated app to make it run --- .../xcschemes/CharacterText.xcscheme | 112 ++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 27 +++++ .../xcshareddata/CharacterText.xccheckout | 41 +++++++ .../UserInterfaceState.xcuserstate | Bin 0 -> 15478 bytes .../CharacterLabel/CharacterLabel.swift | 74 ++++++------ .../CharacterLabel/CharacterTextView.swift | 9 +- .../Flickr/FlickrCollectionViewCell.swift | 7 +- .../Classes/Utilities/CLMLayerAnimation.swift | 2 +- .../ViewControllers/ViewController.swift | 11 +- .../xcschemes/Pods-FlickrKit.xcscheme | 77 ++++++++++++ .../xcschemes/Pods-SDWebImage.xcscheme | 77 ++++++++++++ .../xcschemes/Pods.xcscheme | 77 ++++++++++++ .../xcschemes/xcschememanagement.plist | 42 +++++++ 13 files changed, 511 insertions(+), 45 deletions(-) create mode 100644 CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/CharacterText.xcscheme create mode 100644 CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 CharacterText.xcworkspace/xcshareddata/CharacterText.xccheckout create mode 100644 CharacterText.xcworkspace/xcuserdata/natashatherobot.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-FlickrKit.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-SDWebImage.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods.xcscheme create mode 100644 Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/CharacterText.xcscheme b/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/CharacterText.xcscheme new file mode 100644 index 0000000..be9790f --- /dev/null +++ b/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/CharacterText.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist b/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..db39eac --- /dev/null +++ b/CharacterText.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + CharacterText.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + AF7BB31E195C749600E46AF2 + + primary + + + AF7BB330195C749600E46AF2 + + primary + + + + + diff --git a/CharacterText.xcworkspace/xcshareddata/CharacterText.xccheckout b/CharacterText.xcworkspace/xcshareddata/CharacterText.xccheckout new file mode 100644 index 0000000..589c8d1 --- /dev/null +++ b/CharacterText.xcworkspace/xcshareddata/CharacterText.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 3217EBBE-11A0-4C10-9972-D779A8AC3569 + IDESourceControlProjectName + CharacterText + IDESourceControlProjectOriginsDictionary + + B762B879E1986148CFB9935B4BCC2FFABE987B82 + github.com:NatashaTheRobot/CharacterText.git + + IDESourceControlProjectPath + CharacterText.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + B762B879E1986148CFB9935B4BCC2FFABE987B82 + .. + + IDESourceControlProjectURL + github.com:NatashaTheRobot/CharacterText.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + B762B879E1986148CFB9935B4BCC2FFABE987B82 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + B762B879E1986148CFB9935B4BCC2FFABE987B82 + IDESourceControlWCCName + CharacterText + + + + diff --git a/CharacterText.xcworkspace/xcuserdata/natashatherobot.xcuserdatad/UserInterfaceState.xcuserstate b/CharacterText.xcworkspace/xcuserdata/natashatherobot.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..dc4508b6e0663e70b21836652a32ebbc07a3a6d8 GIT binary patch literal 15478 zcmds8d0bP+_Me%1lMoU}2oS=eB3TF_frK6Fh62@!h-@yXG{6;7fzTwVNUf9F+RfV4 z?zI9|tF7H#YFDdvQ`@T5uCKMbwToTsYJL5kdv6km+V|@pzxO`x^V1K6J2UspnKNh3 z@|}~Wu6CE#XSctJFd~RSERrB8yOVukrePuH@w(idGY#&hi@0W=cb38FX>M~tbFIPW z?$RK~`X3(7=RWJ6gf8`+Tq<)91D6jXtxqDnLkRiWvq8r7g$ zREO%(3^W(bL(OObYDXQY6S+}0T8b`3m!T`r_2>q4Bf1IQk2a!B=mGQ~+Ke7T52HuW zqv$d8INFMKpl8tYXcu}B9YJrQx6wQ3UGyIM2z`u>qp#4{=vVX``W>A@e_$3%umY>F z8f$S9PQ@mig|l%XF2dt+37&v2z*BGqo{F1s3+C{A+=|<<3txm6;CAf6UfhG1;LGt9 zcm=)^UyJX-Yw*2zE$+kpcmS`%_u)tJWB76W1m1$T;%#_4egW^od+`B$5Ff&C;rHSN9W@4ClM$05I$;=2Ql`$|zCWEmsSxh!_ z9y6L5!;EDvV5Tq?%v5F;Gn;8(TA4P+#azTJWEL@tnI7f}W(9L4a}{$7vzob;xs4fM z)-m@n>zT)x$C)RX9n7=LbIe|5AG4o%jd`6p%)HBd%zVOp%6!dy!+gv9!2HVm#$uMR z49l`|Hj0g9?W}{%VRP9$HlHnE3)v#Jn4QR$vSn;JTglF3XR)){ z26hfRmz~G9u`c!^b^+VXE@T(6i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4VM@$HBiH4hRY2r4A&d(Hf%IJW_ZG|)v(>L!?4S+$MBNj6~kV`e!~&NQNx#p zpACN+v5_%Kj54Fzs4>PFwMLyW$*4D4jrqn2#wo_B#%ads#v0=s<2>Vq#wH_YY&CWn zFEL(aTy0!qTx;w%t~0JTK5Trm zZ?>8p<~(zux!7E8o?@PAo@TB!&oIw6&oNW;)#h8xcbV@o-)mlHUT@xLe!%>M`4#g) z^I`Mb=6B6snSV0>YCdKDX9muQ%t**c$rzE5mXV%e$*^W*W#ng!&X}GtJ7YW zTgL8;JsB@%yqs}3|cCT5YYf&a^gKo2;C* z&3cjbX6sJtH`br6r)>(G&Njl9W;5E%wrpFDE#FpT8)chlE3-|p&9pVznrxh{&E~dw zY~8lSwk5XZwiUKpY<;%-Z4cNUvOQ|sZhOl1tZk=lmu;WzknMfjr}i3qy}i-iVfWd4 z?N`}X+i$nuWnW|Ov#+ynus>nnW`ENDwEa2zPWvwV9{X{J%2DiScCdKRJGJ{N_02IGuxXNDiAL&5`FQa&$RKIVm|K aayI8Ym$N(P)j*0s#7}llScZUd_Wci0q{fs0 literal 0 HcmV?d00001 diff --git a/CharacterText/Classes/CharacterLabel/CharacterLabel.swift b/CharacterText/Classes/CharacterLabel/CharacterLabel.swift index 1d3ced1..13f7550 100644 --- a/CharacterText/Classes/CharacterLabel/CharacterLabel.swift +++ b/CharacterText/Classes/CharacterLabel/CharacterLabel.swift @@ -60,7 +60,7 @@ class CharacterLabel: UILabel, NSLayoutManagerDelegate { } set { - let wordRange = NSMakeRange(0, newValue.utf16count) + let wordRange = NSMakeRange(0, newValue.utf16Count) var attributedText = NSMutableAttributedString(string: newValue) attributedText.addAttribute(NSForegroundColorAttributeName , value:self.textColor, range:wordRange) attributedText.addAttribute(NSFontAttributeName , value:self.font, range:wordRange) @@ -92,10 +92,15 @@ class CharacterLabel: UILabel, NSLayoutManagerDelegate { } - init(frame: CGRect) { + override init(frame: CGRect) { super.init(frame: frame) setupLayoutManager() } + + required init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupLayoutManager() + } override func awakeFromNib() { super.awakeFromNib() @@ -117,41 +122,40 @@ class CharacterLabel: UILabel, NSLayoutManagerDelegate { func calculateTextLayers() { characterTextLayers.removeAll(keepCapacity: false) - if let attributedText = textStorage.string? { - - let wordRange = NSMakeRange(0, attributedText.utf16count); - let attributedString = self.internalAttributedText(); - let layoutRect = layoutManager.usedRectForTextContainer(textContainer); + let attributedText = textStorage.string + + let wordRange = NSMakeRange(0, attributedText.utf16Count) + let attributedString = self.internalAttributedText() + let layoutRect = layoutManager.usedRectForTextContainer(textContainer) + + for var index = wordRange.location; index < wordRange.length+wordRange.location; index += 0 { + let glyphRange = NSMakeRange(index, 1); + let characterRange = layoutManager.characterRangeForGlyphRange(glyphRange, actualGlyphRange:nil); + let textContainer = layoutManager.textContainerForGlyphAtIndex(index, effectiveRange: nil) + var glyphRect = layoutManager.boundingRectForGlyphRange(glyphRange, inTextContainer: textContainer!) + var location = layoutManager.locationForGlyphAtIndex(index) + var kerningRange = layoutManager.rangeOfNominallySpacedGlyphsContainingIndex(index); - for var index = wordRange.location; index < wordRange.length+wordRange.location; index += 0 { - let glyphRange = NSMakeRange(index, 1); - let characterRange = layoutManager.characterRangeForGlyphRange(glyphRange, actualGlyphRange:nil); - let textContainer = layoutManager.textContainerForGlyphAtIndex(index, effectiveRange: nil); - var glyphRect = layoutManager.boundingRectForGlyphRange(glyphRange, inTextContainer: textContainer); - var location = layoutManager.locationForGlyphAtIndex(index); - var kerningRange = layoutManager.rangeOfNominallySpacedGlyphsContainingIndex(index); - - if kerningRange.length > 1 && kerningRange.location == index { - if countElements(characterTextLayers) > 0 { - var previousLayer = characterTextLayers[characterTextLayers.endIndex-1] - var frame = previousLayer.frame - frame.size.width += CGRectGetMaxX(glyphRect)-CGRectGetMaxX(frame) - previousLayer.frame = frame - } + if kerningRange.length > 1 && kerningRange.location == index { + if countElements(characterTextLayers) > 0 { + var previousLayer = characterTextLayers[characterTextLayers.endIndex-1] + var frame = previousLayer.frame + frame.size.width += CGRectGetMaxX(glyphRect)-CGRectGetMaxX(frame) + previousLayer.frame = frame } - - - glyphRect.origin.y += location.y-(glyphRect.height/2)+(self.bounds.size.height/2)-(layoutRect.size.height/2); - - - var textLayer = CATextLayer(frame: glyphRect, string: attributedString.attributedSubstringFromRange(characterRange)); - initialTextLayerAttributes(textLayer) - - layer.addSublayer(textLayer); - characterTextLayers.append(textLayer); - - index += characterRange.length; } + + + glyphRect.origin.y += location.y-(glyphRect.height/2)+(self.bounds.size.height/2)-(layoutRect.size.height/2); + + + var textLayer = CATextLayer(frame: glyphRect, string: attributedString.attributedSubstringFromRange(characterRange)); + initialTextLayerAttributes(textLayer) + + layer.addSublayer(textLayer); + characterTextLayers.append(textLayer); + + index += characterRange.length; } } @@ -160,7 +164,7 @@ class CharacterLabel: UILabel, NSLayoutManagerDelegate { } func internalAttributedText() -> NSMutableAttributedString! { - let wordRange = NSMakeRange(0, textStorage.string.utf16count); + let wordRange = NSMakeRange(0, textStorage.string.utf16Count) var attributedText = NSMutableAttributedString(string: textStorage.string); attributedText.addAttribute(kCTForegroundColorAttributeName , value:self.textColor.CGColor, range:wordRange); attributedText.addAttribute(kCTFontAttributeName , value:self.font, range:wordRange); diff --git a/CharacterText/Classes/CharacterLabel/CharacterTextView.swift b/CharacterText/Classes/CharacterLabel/CharacterTextView.swift index 44211b2..9060160 100644 --- a/CharacterText/Classes/CharacterLabel/CharacterTextView.swift +++ b/CharacterText/Classes/CharacterLabel/CharacterTextView.swift @@ -41,10 +41,15 @@ class CharacterTextView: UITextView, NSLayoutManagerDelegate { } - init(frame: CGRect, textContainer: NSTextContainer!) { + override init(frame: CGRect, textContainer: NSTextContainer!) { super.init(frame: frame, textContainer: textContainer); setupLayoutManager(); } + + required init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupLayoutManager() + } override func awakeFromNib() { super.awakeFromNib(); @@ -68,7 +73,7 @@ class CharacterTextView: UITextView, NSLayoutManagerDelegate { let glyphRange = NSMakeRange(index, 1); let characterRange = layoutManager.characterRangeForGlyphRange(glyphRange, actualGlyphRange:nil); let textContainer = layoutManager.textContainerForGlyphAtIndex(index, effectiveRange: nil); - var glyphRect = layoutManager.boundingRectForGlyphRange(glyphRange, inTextContainer: textContainer); + var glyphRect = layoutManager.boundingRectForGlyphRange(glyphRange, inTextContainer: textContainer!); var location = layoutManager.locationForGlyphAtIndex(index); var kerningRange = layoutManager.rangeOfNominallySpacedGlyphsContainingIndex(index); diff --git a/CharacterText/Classes/Flickr/FlickrCollectionViewCell.swift b/CharacterText/Classes/Flickr/FlickrCollectionViewCell.swift index 3a6bb19..79d56e5 100644 --- a/CharacterText/Classes/Flickr/FlickrCollectionViewCell.swift +++ b/CharacterText/Classes/Flickr/FlickrCollectionViewCell.swift @@ -12,10 +12,15 @@ class FlickrCollectionViewCell: UICollectionViewCell { var photoImageView: UIImageView! var darkenMask: UIView! - init(frame: CGRect) { + override init(frame: CGRect) { super.init(frame: frame) initialSetup() } + + required init(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + initialSetup() + } override func awakeFromNib() { super.awakeFromNib() diff --git a/CharacterText/Classes/Utilities/CLMLayerAnimation.swift b/CharacterText/Classes/Utilities/CLMLayerAnimation.swift index 6a0ab0c..ea4477b 100644 --- a/CharacterText/Classes/Utilities/CLMLayerAnimation.swift +++ b/CharacterText/Classes/Utilities/CLMLayerAnimation.swift @@ -87,7 +87,7 @@ class CLMLayerAnimation: NSObject { } if animations.count > 0 { - animationGroup = CAAnimationGroup() + animationGroup = CAAnimationGroup() as CAAnimationGroup animationGroup!.animations = animations } diff --git a/CharacterText/Classes/ViewControllers/ViewController.swift b/CharacterText/Classes/ViewControllers/ViewController.swift index ac17fb1..23ea3a4 100644 --- a/CharacterText/Classes/ViewControllers/ViewController.swift +++ b/CharacterText/Classes/ViewControllers/ViewController.swift @@ -10,7 +10,7 @@ import UIKit class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { - @IBOutlet var collectionView: UICollectionView + @IBOutlet var collectionView: UICollectionView! var dataArray = Array() var characterLabel: MotionLabel!; @@ -26,7 +26,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection FlickrKit.sharedFlickrKit().initializeWithAPIKey("334626934a41897193b6a0613f1c94a0", sharedSecret: "b0132e5cfd44574b") let flickrKit = FlickrKit.sharedFlickrKit() flickrKit.call(FKFlickrInterestingnessGetList()) { response, error in - if response { + if let response = response { var photoUrls = Array() var photos: NSDictionary = response["photos"] as NSDictionary; var photoArray: NSArray = photos["photo"] as NSArray; @@ -54,13 +54,12 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection characterLabel.text = "You" self.view.addSubview(characterLabel) } - - func collectionView(collectionView: UICollectionView!, numberOfItemsInSection section: Int) -> Int { + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return dataArray.count } - func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell - { + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var collectionViewCell : FlickrCollectionViewCell! = collectionView.dequeueReusableCellWithReuseIdentifier("FlickrCollectionViewCell", forIndexPath: indexPath) as FlickrCollectionViewCell collectionViewCell.configure(dataArray[indexPath.row]) diff --git a/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-FlickrKit.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-FlickrKit.xcscheme new file mode 100644 index 0000000..1249c09 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-FlickrKit.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-SDWebImage.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-SDWebImage.xcscheme new file mode 100644 index 0000000..5c48a99 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods-SDWebImage.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods.xcscheme new file mode 100644 index 0000000..df545af --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/Pods.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..31a2285 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/natashatherobot.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,42 @@ + + + + + SchemeUserState + + Pods-FlickrKit.xcscheme + + orderHint + 2 + + Pods-SDWebImage.xcscheme + + orderHint + 3 + + Pods.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + 432590842CC541BEA2C5F3B6 + + primary + + + 5E052698215B41498BAF5177 + + primary + + + BCD5DF8710C248BBA0378911 + + primary + + + + +