From 512fe7df36b86b1a39c26f3d9dfd46ace69ef318 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 14:30:07 +0800 Subject: [PATCH 01/18] add PickFeedSkillView --- Podfile.lock | 2 +- Yep.xcodeproj/project.pbxproj | 12 +++++ .../NewFeed/NewFeed.storyboard | 12 +++++ .../NewFeed/NewFeedViewController.swift | 4 +- .../PickFeedSkill/PickFeedSkillView.swift | 50 +++++++++++++++++++ 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 Yep/Views/PickFeedSkill/PickFeedSkillView.swift diff --git a/Podfile.lock b/Podfile.lock index ac242a5a..4f1ab3ae 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -52,7 +52,7 @@ DEPENDENCIES: EXTERNAL SOURCES: MZFayeClient: - :path: "../CatchLib-iOS/MZFayeClient/" + :path: ../CatchLib-iOS/MZFayeClient/ SPEC CHECKSUMS: 1PasswordExtension: 676a216461ffa9189db66541b5a2465e10ae4743 diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 78880765..02b3ab83 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -207,6 +207,7 @@ 50A640EA1B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */; }; 50A640EC1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */; }; 50A820241B969B0F007CD30E /* NSTimeZone+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */; }; + 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */; settings = {ASSET_TAGS = (); }; }; 50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */; }; 50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */; }; 50A9D4511ACD383E000B2599 /* NSDate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */; }; @@ -510,6 +511,7 @@ 50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DoNotDisturbPeriodCell.xib; path = Views/Cells/DoNotDisturb/DoNotDisturbPeriodCell.xib; sourceTree = ""; }; 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DoNotDisturbPeriodViewController.swift; path = ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift; sourceTree = ""; }; 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSTimeZone+Yep.swift"; path = "Extensions/NSTimeZone+Yep.swift"; sourceTree = ""; }; + 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillView.swift; path = Views/PickFeedSkill/PickFeedSkillView.swift; sourceTree = ""; }; 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSFileManager+Yep.swift"; path = "Extensions/NSFileManager+Yep.swift"; sourceTree = ""; }; 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = NSDateTimeAgo.bundle; path = Extensions/NSDateTimeAgo.bundle; sourceTree = ""; }; 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSDate+Extension.swift"; path = "Extensions/NSDate+Extension.swift"; sourceTree = ""; }; @@ -994,6 +996,7 @@ 50AACEC91BB54132004DD54B /* Feed */, 50F5AF891BBBB2B30033C9BC /* HorizontalLine */, 50535D1B1BCD19B4002FE1A4 /* TouchClosures */, + 50A93A941BD8B887007005DB /* PickFeedSkill */, ); name = Views; sourceTree = ""; @@ -1676,6 +1679,14 @@ name = DoNotDisturbPeriod; sourceTree = ""; }; + 50A93A941BD8B887007005DB /* PickFeedSkill */ = { + isa = PBXGroup; + children = ( + 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */, + ); + name = PickFeedSkill; + sourceTree = ""; + }; 50A9D4581ACD3943000B2599 /* AudioWaves */ = { isa = PBXGroup; children = ( @@ -2311,6 +2322,7 @@ 0A9018821B0120A500AE4B7F /* OAuthViewController.swift in Sources */, 508D17471ACCF4710092D666 /* ChatLeftAudioCell.swift in Sources */, 50894D021AEA6433000981AF /* EditProfileLessInfoCell.swift in Sources */, + 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */, 501138261BCB59120055A014 /* FeedConversationsViewController.swift in Sources */, 50894CFA1AEA54BA000981AF /* SettingsMoreCell.swift in Sources */, 50AFBF4B1BB2A44C007D19DA /* InfoView.swift in Sources */, diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 7111d8ff..6af75386 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -45,17 +45,27 @@ + + + + + + + + + + @@ -66,6 +76,8 @@ + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 225d96b8..58e61177 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -20,6 +20,8 @@ class NewFeedViewController: UIViewController { @IBOutlet weak var messageTextView: UITextView! @IBOutlet weak var mediaCollectionView: UICollectionView! + @IBOutlet weak var pickFeedSkillView: PickFeedSkillView! + @IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint! var imageAssets: [PHAsset] = [] @@ -53,7 +55,7 @@ class NewFeedViewController: UIViewController { messageTextView.text = "" messageTextView.textContainer.lineFragmentPadding = 0 messageTextView.textContainerInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) - messageTextView.becomeFirstResponder() + //messageTextView.becomeFirstResponder() mediaCollectionView.backgroundColor = UIColor.clearColor() diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift new file mode 100644 index 00000000..93b0f937 --- /dev/null +++ b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift @@ -0,0 +1,50 @@ +// +// PickFeedSkillView.swift +// Yep +// +// Created by nixzhu on 15/10/22. +// Copyright © 2015年 Catch Inc. All rights reserved. +// + +import UIKit + +class PickFeedSkillView: UIView { + + lazy var skillsCollectionView: UICollectionView = { + let view = UICollectionView(frame: CGRectZero, collectionViewLayout: UICollectionViewFlowLayout()) + view.backgroundColor = UIColor.redColor() + return view + }() + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + + makeUI() + } + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + } + + private func makeUI() { + + backgroundColor = UIColor.lightGrayColor() + + addSubview(skillsCollectionView) + skillsCollectionView.translatesAutoresizingMaskIntoConstraints = false + + let views = [ + "skillsCollectionView": skillsCollectionView, + ] + + let skillsCollectionViewConstraintsH = NSLayoutConstraint.constraintsWithVisualFormat("H:|[skillsCollectionView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views) + + let skillsCollectionViewConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat("V:|[skillsCollectionView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views) + + NSLayoutConstraint.activateConstraints(skillsCollectionViewConstraintsH) + NSLayoutConstraint.activateConstraints(skillsCollectionViewConstraintsV) + } +} + From 965926c396d4d10608aa7d113cfd506c7fb02902 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 14:48:53 +0800 Subject: [PATCH 02/18] add PickFeedSkillCell --- Yep.xcodeproj/project.pbxproj | 16 +++++++ .../PickFeedSkill/PickFeedSkillCell.swift | 18 ++++++++ .../Cells/PickFeedSkill/PickFeedSkillCell.xib | 42 ++++++++++++++++++ .../PickFeedSkill/PickFeedSkillView.swift | 43 ++++++++++++++++++- 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift create mode 100644 Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 02b3ab83..0d05ca65 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -208,6 +208,8 @@ 50A640EC1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */; }; 50A820241B969B0F007CD30E /* NSTimeZone+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */; }; 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */; settings = {ASSET_TAGS = (); }; }; + 50A93A971BD8BB0A007005DB /* PickFeedSkillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */; settings = {ASSET_TAGS = (); }; }; + 50A93A981BD8BB0A007005DB /* PickFeedSkillCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */; settings = {ASSET_TAGS = (); }; }; 50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */; }; 50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */; }; 50A9D4511ACD383E000B2599 /* NSDate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */; }; @@ -512,6 +514,8 @@ 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DoNotDisturbPeriodViewController.swift; path = ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift; sourceTree = ""; }; 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSTimeZone+Yep.swift"; path = "Extensions/NSTimeZone+Yep.swift"; sourceTree = ""; }; 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillView.swift; path = Views/PickFeedSkill/PickFeedSkillView.swift; sourceTree = ""; }; + 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillCell.swift; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.swift; sourceTree = ""; }; + 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PickFeedSkillCell.xib; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.xib; sourceTree = ""; }; 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSFileManager+Yep.swift"; path = "Extensions/NSFileManager+Yep.swift"; sourceTree = ""; }; 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = NSDateTimeAgo.bundle; path = Extensions/NSDateTimeAgo.bundle; sourceTree = ""; }; 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSDate+Extension.swift"; path = "Extensions/NSDate+Extension.swift"; sourceTree = ""; }; @@ -1055,6 +1059,7 @@ 502B605C1BD1102F00D9C17E /* Title */, 502B60611BD112EA00D9C17E /* QuickPickPhotos */, 502B60661BD1209300D9C17E /* Camera */, + 50A93A991BD8BB26007005DB /* PickFeedSkill */, ); name = Cells; sourceTree = ""; @@ -1687,6 +1692,15 @@ name = PickFeedSkill; sourceTree = ""; }; + 50A93A991BD8BB26007005DB /* PickFeedSkill */ = { + isa = PBXGroup; + children = ( + 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */, + 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */, + ); + name = PickFeedSkill; + sourceTree = ""; + }; 50A9D4581ACD3943000B2599 /* AudioWaves */ = { isa = PBXGroup; children = ( @@ -2180,6 +2194,7 @@ 0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */, 5053AD511AF82A1700B3CBFA /* PickLocationCell.xib in Resources */, 5011382D1BCB5E150055A014 /* FeedConversationDockCell.xib in Resources */, + 50A93A981BD8BB0A007005DB /* PickFeedSkillCell.xib in Resources */, 5053AD5B1AF83B4200B3CBFA /* ChatLeftLocationCell.xib in Resources */, 0A8F54B81AB67D11004AD60E /* Images.xcassets in Resources */, 50EB8CC51AE89F12001AC1EE /* ChatRightVideoCell.xib in Resources */, @@ -2345,6 +2360,7 @@ 50535D201BCE43ED002FE1A4 /* ImageCacheController.swift in Sources */, 50FA9A441B661698009BF2A0 /* UIViewController+Yep.swift in Sources */, 0AC25F061B1105D5009E6E13 /* YepChildScrollView.swift in Sources */, + 50A93A971BD8BB0A007005DB /* PickFeedSkillCell.swift in Sources */, 0A943A7B1B0F8EAE0022DD67 /* BaseViewController.swift in Sources */, 50165C451AC2860900C7AEBE /* ConversationLayout.swift in Sources */, 50AFBF491BB2830E007D19DA /* EdgeBorderButton.swift in Sources */, diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift new file mode 100644 index 00000000..1d5eeccf --- /dev/null +++ b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift @@ -0,0 +1,18 @@ +// +// PickFeedSkillCell.swift +// Yep +// +// Created by nixzhu on 15/10/22. +// Copyright © 2015年 Catch Inc. All rights reserved. +// + +import UIKit + +class PickFeedSkillCell: UICollectionViewCell { + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + +} diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib new file mode 100644 index 00000000..d918bc84 --- /dev/null +++ b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift index 93b0f937..a2484f9a 100644 --- a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift +++ b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift @@ -10,9 +10,20 @@ import UIKit class PickFeedSkillView: UIView { + let pickFeedSkillCellID = "PickFeedSkillCell" + lazy var skillsCollectionView: UICollectionView = { + + let layout = UICollectionViewFlowLayout() + let view = UICollectionView(frame: CGRectZero, collectionViewLayout: UICollectionViewFlowLayout()) - view.backgroundColor = UIColor.redColor() + view.backgroundColor = UIColor.purpleColor() + + view.registerNib(UINib(nibName: self.pickFeedSkillCellID, bundle: nil), forCellWithReuseIdentifier: self.pickFeedSkillCellID) + + view.dataSource = self + view.delegate = self + return view }() @@ -48,3 +59,33 @@ class PickFeedSkillView: UIView { } } +// MARK: - UICollectionViewDataSource, UICollectionViewDelegate + +extension PickFeedSkillView: UICollectionViewDataSource, UICollectionViewDelegate { + + func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + return 1 + } + + func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 15 + } + + func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(pickFeedSkillCellID, forIndexPath: indexPath) as! PickFeedSkillCell + cell.backgroundColor = UIColor.blueColor() + return cell + } + + func collectionView(collectionView: UICollectionView!, layout collectionViewLayout: UICollectionViewLayout!, sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize { + + return CGSize(width: collectionView.bounds.width, height: 44) + } + + func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets { + + return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) + } +} + From b45f2728f54e1c0fb358ab826766ed34db29af9e Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 15:40:08 +0800 Subject: [PATCH 03/18] add FeedSkillPickerItemView --- Yep.xcodeproj/project.pbxproj | 24 ++++++++ .../NewFeed/NewFeed.storyboard | 22 +++---- .../NewFeed/NewFeedViewController.swift | 36 ++++++++++- .../PickFeedSkill/PickFeedSkillCell.swift | 2 + .../Cells/PickFeedSkill/PickFeedSkillCell.xib | 3 + .../PickFeedSkill/PickFeedSkillLayout.swift | 61 +++++++++++++++++++ .../PickFeedSkill/PickFeedSkillView.swift | 13 ++-- .../FeedSkill/FeedSkillPickerItemView.swift | 60 ++++++++++++++++++ 8 files changed, 204 insertions(+), 17 deletions(-) create mode 100644 Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift create mode 100644 Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 0d05ca65..95d1f7d4 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -210,6 +210,8 @@ 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */; settings = {ASSET_TAGS = (); }; }; 50A93A971BD8BB0A007005DB /* PickFeedSkillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */; settings = {ASSET_TAGS = (); }; }; 50A93A981BD8BB0A007005DB /* PickFeedSkillCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */; settings = {ASSET_TAGS = (); }; }; + 50A93A9B1BD8BFC3007005DB /* PickFeedSkillLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */; settings = {ASSET_TAGS = (); }; }; + 50A93A9D1BD8C515007005DB /* FeedSkillPickerItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */; settings = {ASSET_TAGS = (); }; }; 50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */; }; 50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */; }; 50A9D4511ACD383E000B2599 /* NSDate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */; }; @@ -516,6 +518,8 @@ 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillView.swift; path = Views/PickFeedSkill/PickFeedSkillView.swift; sourceTree = ""; }; 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillCell.swift; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.swift; sourceTree = ""; }; 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PickFeedSkillCell.xib; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.xib; sourceTree = ""; }; + 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillLayout.swift; path = Views/PickFeedSkill/PickFeedSkillLayout.swift; sourceTree = ""; }; + 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedSkillPickerItemView.swift; path = Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift; sourceTree = ""; }; 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSFileManager+Yep.swift"; path = "Extensions/NSFileManager+Yep.swift"; sourceTree = ""; }; 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = NSDateTimeAgo.bundle; path = Extensions/NSDateTimeAgo.bundle; sourceTree = ""; }; 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSDate+Extension.swift"; path = "Extensions/NSDate+Extension.swift"; sourceTree = ""; }; @@ -1001,6 +1005,7 @@ 50F5AF891BBBB2B30033C9BC /* HorizontalLine */, 50535D1B1BCD19B4002FE1A4 /* TouchClosures */, 50A93A941BD8B887007005DB /* PickFeedSkill */, + 50A93A9E1BD8C51D007005DB /* PickerItems */, ); name = Views; sourceTree = ""; @@ -1688,6 +1693,7 @@ isa = PBXGroup; children = ( 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */, + 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */, ); name = PickFeedSkill; sourceTree = ""; @@ -1701,6 +1707,22 @@ name = PickFeedSkill; sourceTree = ""; }; + 50A93A9E1BD8C51D007005DB /* PickerItems */ = { + isa = PBXGroup; + children = ( + 50A93A9F1BD8C52C007005DB /* FeedSkill */, + ); + name = PickerItems; + sourceTree = ""; + }; + 50A93A9F1BD8C52C007005DB /* FeedSkill */ = { + isa = PBXGroup; + children = ( + 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */, + ); + name = FeedSkill; + sourceTree = ""; + }; 50A9D4581ACD3943000B2599 /* AudioWaves */ = { isa = PBXGroup; children = ( @@ -2439,6 +2461,7 @@ 50F5AF8C1BBBB64C0033C9BC /* FeedCell.swift in Sources */, 50894CF11AEA4726000981AF /* SettingsViewController.swift in Sources */, 5023DE2A1AB685BA00B3EE96 /* ContactsViewController.swift in Sources */, + 50A93A9B1BD8BFC3007005DB /* PickFeedSkillLayout.swift in Sources */, 50CDBE491ACBAD3200459CE0 /* ChatLeftImageCell.swift in Sources */, 5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */, 50E1D7291B870D7500D90A82 /* NSParagraphStyle+Yep.swift in Sources */, @@ -2478,6 +2501,7 @@ 84385C441B8592120071130D /* ShowStepGeniusViewController.swift in Sources */, 6A5632931BC911CB00397B53 /* DiscoverNormalUserCell.swift in Sources */, 5053AD5A1AF83B4200B3CBFA /* ChatLeftLocationCell.swift in Sources */, + 50A93A9D1BD8C515007005DB /* FeedSkillPickerItemView.swift in Sources */, 50A640E91B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift in Sources */, 502B605A1BD1102B00D9C17E /* TitleCell.swift in Sources */, 840CD23C1B7B59D5000D2680 /* ShowStepViewController.swift in Sources */, diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 6af75386..524c8733 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -45,27 +45,28 @@ - - + + - - - - + + + + + - + + + - - @@ -76,8 +77,7 @@ - - + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 58e61177..e131daf0 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -20,8 +20,9 @@ class NewFeedViewController: UIViewController { @IBOutlet weak var messageTextView: UITextView! @IBOutlet weak var mediaCollectionView: UICollectionView! - @IBOutlet weak var pickFeedSkillView: PickFeedSkillView! - @IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint! + //@IBOutlet weak var pickFeedSkillView: PickFeedSkillView! + //@IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint! + @IBOutlet weak var skillPickerView: UIPickerView! var imageAssets: [PHAsset] = [] @@ -265,3 +266,34 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel } } +// MARK: - UIPickerViewDataSource, UIPickerViewDelegate + +extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { + + func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { + return 1 + } + + func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + return 15 + } + + func pickerView(pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { + return 44 + } + + func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView { + + if let view = view as? FeedSkillPickerItemView { + view.skillLabel.text = "Swift \(row)" + return view + + } else { + let view = FeedSkillPickerItemView() + view.skillLabel.text = "Swift \(row)" + return view + } + } +} + + diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift index 1d5eeccf..7703cb9b 100644 --- a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift +++ b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift @@ -10,6 +10,8 @@ import UIKit class PickFeedSkillCell: UICollectionViewCell { + @IBOutlet weak var skillLabel: UILabel! + override func awakeFromNib() { super.awakeFromNib() // Initialization code diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib index d918bc84..726a8d21 100644 --- a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib +++ b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib @@ -33,6 +33,9 @@ + + + diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift b/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift new file mode 100644 index 00000000..6357be45 --- /dev/null +++ b/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift @@ -0,0 +1,61 @@ +// +// PickFeedSkillLayout.swift +// Yep +// +// Created by nixzhu on 15/10/22. +// Copyright © 2015年 Catch Inc. All rights reserved. +// + +import UIKit + +class PickFeedSkillLayout: UICollectionViewFlowLayout { + + override func prepareLayout() { + super.prepareLayout() + + minimumLineSpacing = 0 + } + + override func targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint { + + if let cv = self.collectionView { + + let cvBounds = cv.bounds + let halfWidth = cvBounds.size.width * 0.5; + let proposedContentOffsetCenterX = proposedContentOffset.x + halfWidth; + + if let attributesForVisibleCells = layoutAttributesForElementsInRect(cvBounds) { + + var candidateAttributes : UICollectionViewLayoutAttributes? + for attributes in attributesForVisibleCells { + + // == Skip comparison with non-cell items (headers and footers) == // + if attributes.representedElementCategory != UICollectionElementCategory.Cell { + continue + } + + if let candAttrs = candidateAttributes { + + let a = attributes.center.x - proposedContentOffsetCenterX + let b = candAttrs.center.x - proposedContentOffsetCenterX + + if abs(a) < abs(b) { + candidateAttributes = attributes; + } + + } else { // == First time in the loop == // + + candidateAttributes = attributes; + continue; + } + } + + return CGPoint(x: round(candidateAttributes!.center.x - halfWidth), y: proposedContentOffset.y) + } + } + + // Fallback + return super.targetContentOffsetForProposedContentOffset(proposedContentOffset) + } +} + diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift index a2484f9a..cb7f787c 100644 --- a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift +++ b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift @@ -14,10 +14,13 @@ class PickFeedSkillView: UIView { lazy var skillsCollectionView: UICollectionView = { - let layout = UICollectionViewFlowLayout() + let layout = PickFeedSkillLayout() - let view = UICollectionView(frame: CGRectZero, collectionViewLayout: UICollectionViewFlowLayout()) - view.backgroundColor = UIColor.purpleColor() + let view = UICollectionView(frame: CGRectZero, collectionViewLayout: layout) + + view.pagingEnabled = true + + view.backgroundColor = UIColor.lightGrayColor() view.registerNib(UINib(nibName: self.pickFeedSkillCellID, bundle: nil), forCellWithReuseIdentifier: self.pickFeedSkillCellID) @@ -74,7 +77,9 @@ extension PickFeedSkillView: UICollectionViewDataSource, UICollectionViewDelegat func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier(pickFeedSkillCellID, forIndexPath: indexPath) as! PickFeedSkillCell - cell.backgroundColor = UIColor.blueColor() + + cell.skillLabel.text = "Swift \(indexPath.item)" + return cell } diff --git a/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift b/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift new file mode 100644 index 00000000..84ee30fa --- /dev/null +++ b/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift @@ -0,0 +1,60 @@ +// +// FeedSkillPickerItemView.swift +// Yep +// +// Created by nixzhu on 15/10/22. +// Copyright © 2015年 Catch Inc. All rights reserved. +// + +import UIKit + +class FeedSkillPickerItemView: UIView { + + lazy var bubbleImageView: UIImageView = { + let view = UIImageView(image: UIImage(named: "skill_bubble")!) + return view + }() + + lazy var skillLabel: UILabel = { + let label = UILabel() + label.font = UIFont.systemFontOfSize(15) + label.textColor = UIColor.whiteColor() + return label + }() + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + + makeUI() + } + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + } + + private func makeUI() { + + addSubview(bubbleImageView) + bubbleImageView.translatesAutoresizingMaskIntoConstraints = false + + addSubview(skillLabel) + skillLabel.translatesAutoresizingMaskIntoConstraints = false + + let skillLabelCenterY = NSLayoutConstraint(item: skillLabel, attribute: .CenterY, relatedBy: .Equal, toItem: self, attribute: .CenterY, multiplier: 1, constant: 0) + + let skillLabelTrailing = NSLayoutConstraint(item: skillLabel, attribute: .Trailing, relatedBy: .Equal, toItem: self, attribute: .Trailing, multiplier: 1, constant: -50) + + NSLayoutConstraint.activateConstraints([skillLabelCenterY, skillLabelTrailing]) + + let bubbleImageViewCenterY = NSLayoutConstraint(item: bubbleImageView, attribute: .CenterY, relatedBy: .Equal, toItem: self, attribute: .CenterY, multiplier: 1, constant: 0) + + let bubbleImageViewLeading = NSLayoutConstraint(item: bubbleImageView, attribute: .Leading, relatedBy: .Equal, toItem: skillLabel, attribute: .Leading, multiplier: 1, constant: -10) + + let bubbleImageViewTrailing = NSLayoutConstraint(item: bubbleImageView, attribute: .Trailing, relatedBy: .Equal, toItem: skillLabel, attribute: .Trailing, multiplier: 1, constant: 10) + + NSLayoutConstraint.activateConstraints([bubbleImageViewCenterY, bubbleImageViewLeading, bubbleImageViewTrailing]) + } +} + From ff114a39167e5c3fe555689bda08d36af8539e33 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 15:57:18 +0800 Subject: [PATCH 04/18] use masterSkills; infinity picker --- .../NewFeed/NewFeedViewController.swift | 35 ++++++++++++++++--- .../FeedSkill/FeedSkillPickerItemView.swift | 4 +++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index e131daf0..794729e9 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -7,10 +7,11 @@ // import UIKit -import Proposer import CoreLocation import MobileCoreServices import Photos +import Proposer +import RealmSwift class NewFeedViewController: UIViewController { @@ -37,6 +38,30 @@ class NewFeedViewController: UIViewController { let feedMediaAddCellID = "FeedMediaAddCell" let feedMediaCellID = "FeedMediaCell" + let max = Int(INT16_MAX) + + let masterSkills: [Skill] = { + if let + myUserID = YepUserDefaults.userID.value, + realm = try? Realm(), + me = userWithUserID(myUserID, inRealm: realm) { + return skillsFromUserSkillList(me.masterSkills) + } + + return [] + }() + + let learningSkills: [Skill] = { + if let + myUserID = YepUserDefaults.userID.value, + realm = try? Realm(), + me = userWithUserID(myUserID, inRealm: realm) { + return skillsFromUserSkillList(me.learningSkills) + } + + return [] + }() + override func viewDidLoad() { super.viewDidLoad() @@ -275,7 +300,7 @@ extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { } func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { - return 15 + return max } func pickerView(pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { @@ -284,13 +309,15 @@ extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView { + let skill = masterSkills[row % masterSkills.count] + if let view = view as? FeedSkillPickerItemView { - view.skillLabel.text = "Swift \(row)" + view.configureWithSkill(skill) return view } else { let view = FeedSkillPickerItemView() - view.skillLabel.text = "Swift \(row)" + view.configureWithSkill(skill) return view } } diff --git a/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift b/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift index 84ee30fa..d58e40f9 100644 --- a/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift +++ b/Yep/Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift @@ -56,5 +56,9 @@ class FeedSkillPickerItemView: UIView { NSLayoutConstraint.activateConstraints([bubbleImageViewCenterY, bubbleImageViewLeading, bubbleImageViewTrailing]) } + + func configureWithSkill(skill: Skill) { + skillLabel.text = skill.localName + } } From bc568d54a92e2d4e578e2f77aaed057c5e258234 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 15:59:42 +0800 Subject: [PATCH 05/18] skills --- .../NewFeed/NewFeedViewController.swift | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 794729e9..e047f09e 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -40,23 +40,12 @@ class NewFeedViewController: UIViewController { let max = Int(INT16_MAX) - let masterSkills: [Skill] = { + let skills: [Skill] = { if let myUserID = YepUserDefaults.userID.value, realm = try? Realm(), me = userWithUserID(myUserID, inRealm: realm) { - return skillsFromUserSkillList(me.masterSkills) - } - - return [] - }() - - let learningSkills: [Skill] = { - if let - myUserID = YepUserDefaults.userID.value, - realm = try? Realm(), - me = userWithUserID(myUserID, inRealm: realm) { - return skillsFromUserSkillList(me.learningSkills) + return skillsFromUserSkillList(me.masterSkills) + skillsFromUserSkillList(me.learningSkills) } return [] @@ -309,7 +298,7 @@ extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView { - let skill = masterSkills[row % masterSkills.count] + let skill = skills[row % skills.count] if let view = view as? FeedSkillPickerItemView { view.configureWithSkill(skill) From 4c5a92259a85ea37ad148820fc6c86523d07ff4d Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 16:09:47 +0800 Subject: [PATCH 06/18] pickedSkill --- .../NewFeed/NewFeedViewController.swift | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index e047f09e..2bed327b 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -51,6 +51,8 @@ class NewFeedViewController: UIViewController { return [] }() + var pickedSkill: Skill? + override func viewDidLoad() { super.viewDidLoad() @@ -80,6 +82,12 @@ class NewFeedViewController: UIViewController { mediaCollectionView.dataSource = self mediaCollectionView.delegate = self + if !skills.isEmpty { + let centerRow = max / 2 + skillPickerView.selectRow(centerRow, inComponent: 0, animated: false) + pickedSkill = skills[centerRow % skills.count] + } + // try turn on location let locationResource = PrivateResource.Location(.WhenInUse) @@ -285,7 +293,7 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { - return 1 + return skills.isEmpty ? 0 : 1 } func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { @@ -310,6 +318,13 @@ extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { return view } } + + func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + + pickedSkill = skills[row % skills.count] + + println(pickedSkill?.localName) + } } From a3cb4fa267a0b5cc205733512e0de2a0d2f98df1 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 16:19:23 +0800 Subject: [PATCH 07/18] channel --- .../Contents.json | 12 ++++++++ .../feed_skill_channel_arrow.pdf | Bin 0 -> 3963 bytes .../NewFeed/NewFeed.storyboard | 28 ++++++++++++++++++ .../NewFeed/NewFeedViewController.swift | 2 -- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 Yep/Images.xcassets/feed_skill_channel_arrow.imageset/Contents.json create mode 100644 Yep/Images.xcassets/feed_skill_channel_arrow.imageset/feed_skill_channel_arrow.pdf diff --git a/Yep/Images.xcassets/feed_skill_channel_arrow.imageset/Contents.json b/Yep/Images.xcassets/feed_skill_channel_arrow.imageset/Contents.json new file mode 100644 index 00000000..d4431997 --- /dev/null +++ b/Yep/Images.xcassets/feed_skill_channel_arrow.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "feed_skill_channel_arrow.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/feed_skill_channel_arrow.imageset/feed_skill_channel_arrow.pdf b/Yep/Images.xcassets/feed_skill_channel_arrow.imageset/feed_skill_channel_arrow.pdf new file mode 100644 index 0000000000000000000000000000000000000000..28649110e4ede4d6c81410c3aa4bd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++^K#LfX}x<--jyw zGivzHf#HbOaRdyGhQkmD*fBU9jWL74q=5S$%U_}anBUfu1Poi-I|B29CNN`BDQ>P> zOkm&k$s8iwY=8a#PnFe8Uh34^S|s+%=mxTkO*e@ziTj*(x3anF@M-0kqDqEeqW13D*dUU z5Wo1Nx)UhQWcTff)|lc4 + + + + + + + + + + + + + + + + + @@ -62,7 +84,9 @@ + + @@ -70,6 +94,7 @@ + @@ -94,4 +119,7 @@ + + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 2bed327b..1d3cf872 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -322,8 +322,6 @@ extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { pickedSkill = skills[row % skills.count] - - println(pickedSkill?.localName) } } From 18e72f835a270804a69b50cc2a46fffd8f26cd71 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 16:59:54 +0800 Subject: [PATCH 08/18] UI detail; animation --- Yep/Services/YepService.swift | 2 +- .../NewFeed/NewFeed.storyboard | 34 +++++++++++++++--- .../NewFeed/NewFeedViewController.swift | 36 +++++++++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Yep/Services/YepService.swift b/Yep/Services/YepService.swift index 89dd26db..d21dead9 100644 --- a/Yep/Services/YepService.swift +++ b/Yep/Services/YepService.swift @@ -2306,7 +2306,7 @@ struct DiscoveredFeed: Hashable { let parseFeeds: JSONDictionary -> [DiscoveredFeed]? = { data in - println("feedsData: \(data)") + //println("feedsData: \(data)") if let feedsData = data["topics"] as? [JSONDictionary] { return feedsData.map({ DiscoveredFeed.fromJSONDictionary($0) }).flatMap({ $0 }) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index e9df6cd8..8632631c 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -54,31 +54,52 @@ - + + + + + + + + + + + + + + + - + - + + + + + + + + @@ -86,7 +107,6 @@ - @@ -99,6 +119,10 @@ + + + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 1d3cf872..550d9ab2 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -23,6 +23,13 @@ class NewFeedViewController: UIViewController { @IBOutlet weak var mediaCollectionView: UICollectionView! //@IBOutlet weak var pickFeedSkillView: PickFeedSkillView! //@IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint! + + @IBOutlet weak var channelView: UIView! + @IBOutlet weak var channelViewTopConstraint: NSLayoutConstraint! + + @IBOutlet weak var channelViewTopLineView: HorizontalLineView! + @IBOutlet weak var channelViewBottomLineView: HorizontalLineView! + @IBOutlet weak var skillPickerView: UIPickerView! var imageAssets: [PHAsset] = [] @@ -88,6 +95,17 @@ class NewFeedViewController: UIViewController { pickedSkill = skills[centerRow % skills.count] } + // pick skill + + channelViewTopConstraint.constant = 30 + + skillPickerView.alpha = 0 + + channelView.backgroundColor = UIColor.whiteColor() + channelView.userInteractionEnabled = true + let tap = UITapGestureRecognizer(target: self, action: "showSkillPickerView:") + channelView.addGestureRecognizer(tap) + // try turn on location let locationResource = PrivateResource.Location(.WhenInUse) @@ -131,6 +149,24 @@ class NewFeedViewController: UIViewController { // MARK: Actions + func showSkillPickerView(tap: UITapGestureRecognizer) { + + UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in + + self?.channelView.backgroundColor = UIColor.clearColor() + self?.channelViewTopLineView.alpha = 0 + self?.channelViewBottomLineView.alpha = 0 + + self?.skillPickerView.alpha = 1 + + self?.channelViewTopConstraint.constant = 108 + self?.view.layoutIfNeeded() + + }, completion: { [weak self] _ in + self?.channelView.userInteractionEnabled = false + }) + } + func cancel(sender: UIBarButtonItem) { messageTextView.resignFirstResponder() self.dismissViewControllerAnimated(true, completion: nil) From e5d774f08147eadbabf9f653adb920c1ed8a279e Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 17:06:21 +0800 Subject: [PATCH 09/18] choosePromptLabel --- Yep/ViewControllers/NewFeed/NewFeed.storyboard | 10 ++++++++++ .../NewFeed/NewFeedViewController.swift | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 8632631c..03167bc5 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -76,6 +76,12 @@ + @@ -86,6 +92,8 @@ + + @@ -119,10 +127,12 @@ + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 550d9ab2..6b39ad1c 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -30,6 +30,9 @@ class NewFeedViewController: UIViewController { @IBOutlet weak var channelViewTopLineView: HorizontalLineView! @IBOutlet weak var channelViewBottomLineView: HorizontalLineView! + @IBOutlet weak var channelLabel: UILabel! + @IBOutlet weak var choosePromptLabel: UILabel! + @IBOutlet weak var skillPickerView: UIPickerView! var imageAssets: [PHAsset] = [] @@ -156,6 +159,7 @@ class NewFeedViewController: UIViewController { self?.channelView.backgroundColor = UIColor.clearColor() self?.channelViewTopLineView.alpha = 0 self?.channelViewBottomLineView.alpha = 0 + self?.choosePromptLabel.alpha = 0 self?.skillPickerView.alpha = 1 From 73f315eb908a7ea1b81def2d3f3e7873f85ccbd4 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 17:16:19 +0800 Subject: [PATCH 10/18] create feed with skill --- Yep/ViewControllers/NewFeed/NewFeedViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 6b39ad1c..585089df 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -213,7 +213,7 @@ class NewFeedViewController: UIViewController { } }) - dispatch_group_notify(uploadMediaImagesGroup, dispatch_get_main_queue()) { + dispatch_group_notify(uploadMediaImagesGroup, dispatch_get_main_queue()) { [weak self] in var mediaInfo: JSONDictionary? @@ -231,7 +231,7 @@ class NewFeedViewController: UIViewController { ] } - createFeedWithMessage(message, attachments: mediaInfo, coordinate: coordinate, skill: nil, allowComment: true, failureHandler: { [weak self] reason, errorMessage in + createFeedWithMessage(message, attachments: mediaInfo, coordinate: coordinate, skill: self?.pickedSkill, allowComment: true, failureHandler: { [weak self] reason, errorMessage in defaultFailureHandler(reason, errorMessage: errorMessage) YepAlert.alertSorry(message: errorMessage ?? NSLocalizedString("Create feed failed!", comment: ""), inViewController: self) From 0a06346c52dde0f148e44f65ae96e4537d6ffd9e Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 17:29:43 +0800 Subject: [PATCH 11/18] skillLabel FeedCell --- .../skill_bubble_empty.imageset/Contents.json | 23 ++++++++++++++++++ .../skill_bubble_empty.pdf | Bin 0 -> 3968 bytes Yep/Views/Cells/Feed/FeedCell.swift | 14 +++++++++++ Yep/Views/Cells/Feed/FeedCell.xib | 23 +++++++++++++++--- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 Yep/Images.xcassets/skill_bubble_empty.imageset/Contents.json create mode 100644 Yep/Images.xcassets/skill_bubble_empty.imageset/skill_bubble_empty.pdf diff --git a/Yep/Images.xcassets/skill_bubble_empty.imageset/Contents.json b/Yep/Images.xcassets/skill_bubble_empty.imageset/Contents.json new file mode 100644 index 00000000..830112a3 --- /dev/null +++ b/Yep/Images.xcassets/skill_bubble_empty.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "skill_bubble_empty.pdf", + "resizing" : { + "mode" : "3-part-horizontal", + "center" : { + "mode" : "tile", + "width" : 1 + }, + "cap-insets" : { + "right" : 11, + "left" : 11 + } + } + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/skill_bubble_empty.imageset/skill_bubble_empty.pdf b/Yep/Images.xcassets/skill_bubble_empty.imageset/skill_bubble_empty.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d8df7280b2c63de99ce2ee13aa117b16c45bc2f2 GIT binary patch literal 3968 zcmai%c|6o@_s1<$7(!)q z!TzkL5*l4vpgh?5wHUPUd%bH!%c-}4mgGUc&%_Feh@5S{1MOjQZ69`BM_#e59E(8r zg9Mvd2lg)WmeH>U*Vt^Xjs|Tv@Cn$~j3$Ruq%Z@vtyLPDrZi(2>6`wk*u^B1M2dS( zzNWv!`eB*Z8d*&scus$(77QUDOPijisprORo$_tQjL2jW~ofw&^t82z8h5GKM zPke?|>>j&H$X#6=(e@ziF9=>8c)gM9dK~smq&)7?IP6_RTYb$IYkj`v0GQ}u|MNzS z88Z;f+cTdqG@AL6IfefgBhvs+BA{T1cl`cKCVF@Sh#&DXCVG*4$aX|8K=Fs5Me^`w zy!Qf_F=hnx6w%%puSxO;ETIfR84keV)?h|Nf9}Fu^(zyGWRjf;(HpR2Y=zYUtN{fr zk{gL^;)%B-0?brtdBFgs?`|;|W>$XsQ2x!w&upT09mQqeD{_14EAU!2?w+hMSi` zP2Og#p~x&Vflo7yR(tk#wyd!2<7eeHV{I67Z~);}v24AYwW?`p_fNEyEq{^^wXc37 zTW=`o)xRB*D6XU>v6BU?-KTi`lB6)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BZNbvk%ttD7UA&qnP*r1iwP!q{Ui#aUmDKLS%u9Y7wT^_2md~!;GihpiBlqjj>;22_Q}!Pwdi-!c6#5;d6=CpSu*&3D zrpAC=T`et5ycf|PU;?Z$VExO4iPpcE_;2#|`u|y)3CTVT9)|%6C!OuR81T#lcZRp$ z02#(a?|*vK!h7T0NRB_C-s>mL|Bciz*v}P5PT}nU0~5dufI;OMs*w+#>>UU&`20KQ z`+H0OIyLN9!*B$93=V~%U{E+5ie`MF7Eq`ZM1}zrBwgqvQI%Bcor?Vl-Ob z&Lj^k6WG7|WHu2b```cneNKNe(E$tvU5|2FwiY+l}s()gYb1PTQMLm=7)I^h2TZ&SLn literal 0 HcmV?d00001 diff --git a/Yep/Views/Cells/Feed/FeedCell.swift b/Yep/Views/Cells/Feed/FeedCell.swift index afecb8e1..9a214dfb 100644 --- a/Yep/Views/Cells/Feed/FeedCell.swift +++ b/Yep/Views/Cells/Feed/FeedCell.swift @@ -13,6 +13,8 @@ class FeedCell: UITableViewCell { @IBOutlet weak var avatarImageView: UIImageView! @IBOutlet weak var nicknameLabel: UILabel! @IBOutlet weak var distanceLabel: UILabel! + @IBOutlet weak var skillBubbleImageView: UIImageView! + @IBOutlet weak var skillLabel: UILabel! @IBOutlet weak var messageTextView: FeedTextView! @IBOutlet weak var messageTextViewHeightConstraint: NSLayoutConstraint! @@ -78,6 +80,7 @@ class FeedCell: UITableViewCell { distanceLabel.textColor = UIColor.grayColor() timeLabel.textColor = UIColor.grayColor() messageCountLabel.textColor = UIColor.yepTintColor() + skillLabel.textColor = UIColor.yepTintColor() messageTextView.font = UIFont.feedMessageFont() messageTextView.textContainer.lineFragmentPadding = 0 @@ -144,6 +147,17 @@ class FeedCell: UITableViewCell { calHeightOfMessageTextView() + if let skill = feed.skill { + skillLabel.text = skill.localName + + skillBubbleImageView.hidden = false + skillLabel.hidden = false + + } else { + skillBubbleImageView.hidden = true + skillLabel.hidden = true + } + let hasMedia = !feed.attachments.isEmpty if feed.attachments.count > 1 { diff --git a/Yep/Views/Cells/Feed/FeedCell.xib b/Yep/Views/Cells/Feed/FeedCell.xib index 82cdc640..7f9bb0ff 100644 --- a/Yep/Views/Cells/Feed/FeedCell.xib +++ b/Yep/Views/Cells/Feed/FeedCell.xib @@ -43,7 +43,7 @@ - + @@ -61,7 +61,7 @@ @@ -119,5 +135,6 @@ + From df856191d39ee27d341fca5afea276780dadc1ca Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 17:41:15 +0800 Subject: [PATCH 12/18] fill skill to feed if can --- Yep/Services/YepService.swift | 54 ++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/Yep/Services/YepService.swift b/Yep/Services/YepService.swift index d21dead9..d03e27f5 100644 --- a/Yep/Services/YepService.swift +++ b/Yep/Services/YepService.swift @@ -178,6 +178,31 @@ struct Skill: Hashable { var hashValue: Int { return id.hashValue } + + static func fromJSONDictionary(skillInfo: JSONDictionary) -> Skill? { + if + let skillID = skillInfo["id"] as? String, + let skillName = skillInfo["name"] as? String, + let skillLocalName = skillInfo["name_string"] as? String { + + var skillCategory: SkillCategory? + if + let skillCategoryData = skillInfo["category"] as? JSONDictionary, + let categoryID = skillCategoryData["id"] as? String, + let categoryName = skillCategoryData["name"] as? String, + let categoryLocalName = skillCategoryData["name_string"] as? String { + skillCategory = SkillCategory(id: categoryID, name: categoryName, localName: categoryLocalName, skills: []) + } + + let coverURLString = skillInfo["cover_url"] as? String + + let skill = Skill(category: skillCategory, id: skillID, name: skillName, localName: skillLocalName, coverURLString: coverURLString) + + return skill + } + + return nil + } } func ==(lhs: Skill, rhs: Skill) -> Bool { @@ -222,25 +247,9 @@ func skillsFromSkillsData(skillsData: [JSONDictionary]) -> [Skill] { var skills = [Skill]() for skillInfo in skillsData { - if - let skillID = skillInfo["id"] as? String, - let skillName = skillInfo["name"] as? String, - let skillLocalName = skillInfo["name_string"] as? String { - var skillCategory: SkillCategory? - if - let skillCategoryData = skillInfo["category"] as? JSONDictionary, - let categoryID = skillCategoryData["id"] as? String, - let categoryName = skillCategoryData["name"] as? String, - let categoryLocalName = skillCategoryData["name_string"] as? String { - skillCategory = SkillCategory(id: categoryID, name: categoryName, localName: categoryLocalName, skills: []) - } - - let coverURLString = skillInfo["cover_url"] as? String - - let skill = Skill(category: skillCategory, id: skillID, name: skillName, localName: skillLocalName, coverURLString: coverURLString) - - skills.append(skill) + if let skill = Skill.fromJSONDictionary(skillInfo) { + skills.append(skill) } } @@ -2300,13 +2309,18 @@ struct DiscoveredFeed: Hashable { let attachments = attachmentsData.map({ DiscoveredAttachment.fromJSONDictionary($0) }).flatMap({ $0 }) - return DiscoveredFeed(id: id, allowComment: allowComment, createdUnixTime: createdUnixTime, updatedUnixTime: updatedUnixTime, creator: creator, body: body, attachments: attachments, distance: distance, skill: nil, groupID: groupID, messageCount: messageCount) + var skill: Skill? + if let skillInfo = json["skill"] as? JSONDictionary { + skill = Skill.fromJSONDictionary(skillInfo) + } + + return DiscoveredFeed(id: id, allowComment: allowComment, createdUnixTime: createdUnixTime, updatedUnixTime: updatedUnixTime, creator: creator, body: body, attachments: attachments, distance: distance, skill: skill, groupID: groupID, messageCount: messageCount) } } let parseFeeds: JSONDictionary -> [DiscoveredFeed]? = { data in - //println("feedsData: \(data)") + println("feedsData: \(data)") if let feedsData = data["topics"] as? [JSONDictionary] { return feedsData.map({ DiscoveredFeed.fromJSONDictionary($0) }).flatMap({ $0 }) From a06d26ec60537d48f92ca05a43f68862694416c3 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 18:19:53 +0800 Subject: [PATCH 13/18] create new feed in scroll view (Fuck Ray! And Ray fuck Kevin!) --- .../NewFeed/NewFeed.storyboard | 203 ++++++++++-------- 1 file changed, 108 insertions(+), 95 deletions(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 03167bc5..6d94c42a 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -17,112 +17,125 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -130,7 +143,7 @@ - + From ad4c663377e9d6894fc2d0750bfc8d48df597fc9 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 18:28:34 +0800 Subject: [PATCH 14/18] scroll hide keyboard --- Yep/ViewControllers/NewFeed/NewFeed.storyboard | 3 +++ .../NewFeed/NewFeedViewController.swift | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 6d94c42a..d65babcc 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -117,6 +117,9 @@ + + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 585089df..47b7ad1d 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -328,6 +328,16 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel } } +// MARK: - UIScrollViewDelegate + +extension NewFeedViewController: UIScrollViewDelegate { + + func scrollViewWillBeginDragging(scrollView: UIScrollView) { + + messageTextView.resignFirstResponder() + } +} + // MARK: - UIPickerViewDataSource, UIPickerViewDelegate extension NewFeedViewController: UIPickerViewDataSource, UIPickerViewDelegate { From c2d40e0ec743e6ab92a7d1a0ff790e95747f6126 Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 18:34:39 +0800 Subject: [PATCH 15/18] trans --- Yep/ViewControllers/NewFeed/NewFeedViewController.swift | 3 +++ Yep/en.lproj/Localizable.strings | 4 ++++ Yep/zh-Hans.lproj/Localizable.strings | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 47b7ad1d..27b8f46f 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -100,6 +100,9 @@ class NewFeedViewController: UIViewController { // pick skill + channelLabel.text = NSLocalizedString("Channel:", comment: "") + choosePromptLabel.text = NSLocalizedString("Choose...", comment: "") + channelViewTopConstraint.constant = 30 skillPickerView.alpha = 0 diff --git a/Yep/en.lproj/Localizable.strings b/Yep/en.lproj/Localizable.strings index 71b13c35..0e4f6afb 100644 --- a/Yep/en.lproj/Localizable.strings +++ b/Yep/en.lproj/Localizable.strings @@ -636,3 +636,7 @@ "Send Photos (%d)" = "Send Photos (%d)"; +"Channel:" = "Channel:"; + +"Choose..." = "Choose..."; + diff --git a/Yep/zh-Hans.lproj/Localizable.strings b/Yep/zh-Hans.lproj/Localizable.strings index ba9e569d..10130ba7 100644 --- a/Yep/zh-Hans.lproj/Localizable.strings +++ b/Yep/zh-Hans.lproj/Localizable.strings @@ -646,3 +646,7 @@ "Send Photos (%d)" = "发送相片(%d)"; +"Channel:" = "频道:"; + +"Choose..." = "选择…"; + From 50e620bfcbe1752c6bd479ec27e1b84e73da37db Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 18:41:57 +0800 Subject: [PATCH 16/18] hideSkillPickerView --- .../NewFeed/NewFeed.storyboard | 3 ++ .../NewFeed/NewFeedViewController.swift | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index d65babcc..2cda2ae9 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -33,6 +33,9 @@ + + + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 27b8f46f..faa9a878 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -174,8 +174,29 @@ class NewFeedViewController: UIViewController { }) } + func hideSkillPickerView() { + + UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in + + self?.channelView.backgroundColor = UIColor.whiteColor() + self?.channelViewTopLineView.alpha = 1 + self?.channelViewBottomLineView.alpha = 1 + self?.choosePromptLabel.alpha = 1 + + self?.skillPickerView.alpha = 0 + + self?.channelViewTopConstraint.constant = 30 + self?.view.layoutIfNeeded() + + }, completion: { [weak self] _ in + self?.channelView.userInteractionEnabled = true + }) + } + func cancel(sender: UIBarButtonItem) { + messageTextView.resignFirstResponder() + self.dismissViewControllerAnimated(true, completion: nil) } @@ -333,6 +354,16 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel // MARK: - UIScrollViewDelegate +extension NewFeedViewController: UITextViewDelegate { + + func textViewDidBeginEditing(textView: UITextView) { + + hideSkillPickerView() + } +} + +// MARK: - UIScrollViewDelegate + extension NewFeedViewController: UIScrollViewDelegate { func scrollViewWillBeginDragging(scrollView: UIScrollView) { From 2ee5be62863a6f549f8860ffabcaaf0b01370cbe Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 18:56:13 +0800 Subject: [PATCH 17/18] logic of pickedSkillLabel --- .../NewFeed/NewFeed.storyboard | 17 +++++++++ .../NewFeed/NewFeedViewController.swift | 36 ++++++++++++++----- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/Yep/ViewControllers/NewFeed/NewFeed.storyboard b/Yep/ViewControllers/NewFeed/NewFeed.storyboard index 2cda2ae9..b3a9728f 100644 --- a/Yep/ViewControllers/NewFeed/NewFeed.storyboard +++ b/Yep/ViewControllers/NewFeed/NewFeed.storyboard @@ -91,9 +91,20 @@ + + + + + + @@ -102,11 +113,14 @@ + + + @@ -155,6 +169,8 @@ + + @@ -174,5 +190,6 @@ + diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index faa9a878..dea895ed 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -32,7 +32,10 @@ class NewFeedViewController: UIViewController { @IBOutlet weak var channelLabel: UILabel! @IBOutlet weak var choosePromptLabel: UILabel! - + + @IBOutlet weak var pickedSkillBubbleImageView: UIImageView! + @IBOutlet weak var pickedSkillLabel: UILabel! + @IBOutlet weak var skillPickerView: UIPickerView! var imageAssets: [PHAsset] = [] @@ -61,7 +64,13 @@ class NewFeedViewController: UIViewController { return [] }() - var pickedSkill: Skill? + var pickedSkill: Skill? { + willSet { + pickedSkillLabel.text = newValue?.localName + + choosePromptLabel.hidden = (newValue != nil) + } + } override func viewDidLoad() { super.viewDidLoad() @@ -92,12 +101,6 @@ class NewFeedViewController: UIViewController { mediaCollectionView.dataSource = self mediaCollectionView.delegate = self - if !skills.isEmpty { - let centerRow = max / 2 - skillPickerView.selectRow(centerRow, inComponent: 0, animated: false) - pickedSkill = skills[centerRow % skills.count] - } - // pick skill channelLabel.text = NSLocalizedString("Channel:", comment: "") @@ -107,6 +110,9 @@ class NewFeedViewController: UIViewController { skillPickerView.alpha = 0 + pickedSkillBubbleImageView.alpha = 0 + pickedSkillLabel.alpha = 0 + channelView.backgroundColor = UIColor.whiteColor() channelView.userInteractionEnabled = true let tap = UITapGestureRecognizer(target: self, action: "showSkillPickerView:") @@ -157,6 +163,14 @@ class NewFeedViewController: UIViewController { func showSkillPickerView(tap: UITapGestureRecognizer) { + if pickedSkill == nil { + if !skills.isEmpty { + let centerRow = max / 2 + skillPickerView.selectRow(centerRow, inComponent: 0, animated: false) + pickedSkill = skills[centerRow % skills.count] + } + } + UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in self?.channelView.backgroundColor = UIColor.clearColor() @@ -164,6 +178,9 @@ class NewFeedViewController: UIViewController { self?.channelViewBottomLineView.alpha = 0 self?.choosePromptLabel.alpha = 0 + self?.pickedSkillBubbleImageView.alpha = 0 + self?.pickedSkillLabel.alpha = 0 + self?.skillPickerView.alpha = 1 self?.channelViewTopConstraint.constant = 108 @@ -183,6 +200,9 @@ class NewFeedViewController: UIViewController { self?.channelViewBottomLineView.alpha = 1 self?.choosePromptLabel.alpha = 1 + self?.pickedSkillBubbleImageView.alpha = 1 + self?.pickedSkillLabel.alpha = 1 + self?.skillPickerView.alpha = 0 self?.channelViewTopConstraint.constant = 30 From ffe3e6c53a89624b551230325ef06bb6afc034bb Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 22 Oct 2015 19:01:58 +0800 Subject: [PATCH 18/18] remove unused code --- Yep.xcodeproj/project.pbxproj | 32 ------- .../NewFeed/NewFeedViewController.swift | 6 +- .../PickFeedSkill/PickFeedSkillCell.swift | 20 ---- .../Cells/PickFeedSkill/PickFeedSkillCell.xib | 45 --------- .../PickFeedSkill/PickFeedSkillLayout.swift | 61 ------------ .../PickFeedSkill/PickFeedSkillView.swift | 96 ------------------- 6 files changed, 2 insertions(+), 258 deletions(-) delete mode 100644 Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift delete mode 100644 Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib delete mode 100644 Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift delete mode 100644 Yep/Views/PickFeedSkill/PickFeedSkillView.swift diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 95d1f7d4..34bd7fa0 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -207,10 +207,6 @@ 50A640EA1B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */; }; 50A640EC1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */; }; 50A820241B969B0F007CD30E /* NSTimeZone+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */; }; - 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */; settings = {ASSET_TAGS = (); }; }; - 50A93A971BD8BB0A007005DB /* PickFeedSkillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */; settings = {ASSET_TAGS = (); }; }; - 50A93A981BD8BB0A007005DB /* PickFeedSkillCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */; settings = {ASSET_TAGS = (); }; }; - 50A93A9B1BD8BFC3007005DB /* PickFeedSkillLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */; settings = {ASSET_TAGS = (); }; }; 50A93A9D1BD8C515007005DB /* FeedSkillPickerItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */; settings = {ASSET_TAGS = (); }; }; 50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */; }; 50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */; }; @@ -515,10 +511,6 @@ 50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DoNotDisturbPeriodCell.xib; path = Views/Cells/DoNotDisturb/DoNotDisturbPeriodCell.xib; sourceTree = ""; }; 50A640EB1B6F4E420050E4A3 /* DoNotDisturbPeriodViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DoNotDisturbPeriodViewController.swift; path = ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift; sourceTree = ""; }; 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSTimeZone+Yep.swift"; path = "Extensions/NSTimeZone+Yep.swift"; sourceTree = ""; }; - 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillView.swift; path = Views/PickFeedSkill/PickFeedSkillView.swift; sourceTree = ""; }; - 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillCell.swift; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.swift; sourceTree = ""; }; - 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PickFeedSkillCell.xib; path = Views/Cells/PickFeedSkill/PickFeedSkillCell.xib; sourceTree = ""; }; - 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PickFeedSkillLayout.swift; path = Views/PickFeedSkill/PickFeedSkillLayout.swift; sourceTree = ""; }; 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedSkillPickerItemView.swift; path = Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift; sourceTree = ""; }; 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSFileManager+Yep.swift"; path = "Extensions/NSFileManager+Yep.swift"; sourceTree = ""; }; 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = NSDateTimeAgo.bundle; path = Extensions/NSDateTimeAgo.bundle; sourceTree = ""; }; @@ -1004,7 +996,6 @@ 50AACEC91BB54132004DD54B /* Feed */, 50F5AF891BBBB2B30033C9BC /* HorizontalLine */, 50535D1B1BCD19B4002FE1A4 /* TouchClosures */, - 50A93A941BD8B887007005DB /* PickFeedSkill */, 50A93A9E1BD8C51D007005DB /* PickerItems */, ); name = Views; @@ -1064,7 +1055,6 @@ 502B605C1BD1102F00D9C17E /* Title */, 502B60611BD112EA00D9C17E /* QuickPickPhotos */, 502B60661BD1209300D9C17E /* Camera */, - 50A93A991BD8BB26007005DB /* PickFeedSkill */, ); name = Cells; sourceTree = ""; @@ -1689,24 +1679,6 @@ name = DoNotDisturbPeriod; sourceTree = ""; }; - 50A93A941BD8B887007005DB /* PickFeedSkill */ = { - isa = PBXGroup; - children = ( - 50A93A921BD8B883007005DB /* PickFeedSkillView.swift */, - 50A93A9A1BD8BFC3007005DB /* PickFeedSkillLayout.swift */, - ); - name = PickFeedSkill; - sourceTree = ""; - }; - 50A93A991BD8BB26007005DB /* PickFeedSkill */ = { - isa = PBXGroup; - children = ( - 50A93A951BD8BB0A007005DB /* PickFeedSkillCell.swift */, - 50A93A961BD8BB0A007005DB /* PickFeedSkillCell.xib */, - ); - name = PickFeedSkill; - sourceTree = ""; - }; 50A93A9E1BD8C51D007005DB /* PickerItems */ = { isa = PBXGroup; children = ( @@ -2216,7 +2188,6 @@ 0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */, 5053AD511AF82A1700B3CBFA /* PickLocationCell.xib in Resources */, 5011382D1BCB5E150055A014 /* FeedConversationDockCell.xib in Resources */, - 50A93A981BD8BB0A007005DB /* PickFeedSkillCell.xib in Resources */, 5053AD5B1AF83B4200B3CBFA /* ChatLeftLocationCell.xib in Resources */, 0A8F54B81AB67D11004AD60E /* Images.xcassets in Resources */, 50EB8CC51AE89F12001AC1EE /* ChatRightVideoCell.xib in Resources */, @@ -2359,7 +2330,6 @@ 0A9018821B0120A500AE4B7F /* OAuthViewController.swift in Sources */, 508D17471ACCF4710092D666 /* ChatLeftAudioCell.swift in Sources */, 50894D021AEA6433000981AF /* EditProfileLessInfoCell.swift in Sources */, - 50A93A931BD8B883007005DB /* PickFeedSkillView.swift in Sources */, 501138261BCB59120055A014 /* FeedConversationsViewController.swift in Sources */, 50894CFA1AEA54BA000981AF /* SettingsMoreCell.swift in Sources */, 50AFBF4B1BB2A44C007D19DA /* InfoView.swift in Sources */, @@ -2382,7 +2352,6 @@ 50535D201BCE43ED002FE1A4 /* ImageCacheController.swift in Sources */, 50FA9A441B661698009BF2A0 /* UIViewController+Yep.swift in Sources */, 0AC25F061B1105D5009E6E13 /* YepChildScrollView.swift in Sources */, - 50A93A971BD8BB0A007005DB /* PickFeedSkillCell.swift in Sources */, 0A943A7B1B0F8EAE0022DD67 /* BaseViewController.swift in Sources */, 50165C451AC2860900C7AEBE /* ConversationLayout.swift in Sources */, 50AFBF491BB2830E007D19DA /* EdgeBorderButton.swift in Sources */, @@ -2461,7 +2430,6 @@ 50F5AF8C1BBBB64C0033C9BC /* FeedCell.swift in Sources */, 50894CF11AEA4726000981AF /* SettingsViewController.swift in Sources */, 5023DE2A1AB685BA00B3EE96 /* ContactsViewController.swift in Sources */, - 50A93A9B1BD8BFC3007005DB /* PickFeedSkillLayout.swift in Sources */, 50CDBE491ACBAD3200459CE0 /* ChatLeftImageCell.swift in Sources */, 5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */, 50E1D7291B870D7500D90A82 /* NSParagraphStyle+Yep.swift in Sources */, diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index dea895ed..6c0f5723 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -15,14 +15,12 @@ import RealmSwift class NewFeedViewController: UIViewController { - @IBOutlet weak var feedWhiteBGView: UIView! - var afterCreatedFeedAction: ((feed: DiscoveredFeed) -> Void)? + @IBOutlet weak var feedWhiteBGView: UIView! + @IBOutlet weak var messageTextView: UITextView! @IBOutlet weak var mediaCollectionView: UICollectionView! - //@IBOutlet weak var pickFeedSkillView: PickFeedSkillView! - //@IBOutlet weak var pickFeedSkillViewHeightConstraint: NSLayoutConstraint! @IBOutlet weak var channelView: UIView! @IBOutlet weak var channelViewTopConstraint: NSLayoutConstraint! diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift deleted file mode 100644 index 7703cb9b..00000000 --- a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// PickFeedSkillCell.swift -// Yep -// -// Created by nixzhu on 15/10/22. -// Copyright © 2015年 Catch Inc. All rights reserved. -// - -import UIKit - -class PickFeedSkillCell: UICollectionViewCell { - - @IBOutlet weak var skillLabel: UILabel! - - override func awakeFromNib() { - super.awakeFromNib() - // Initialization code - } - -} diff --git a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib b/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib deleted file mode 100644 index 726a8d21..00000000 --- a/Yep/Views/Cells/PickFeedSkill/PickFeedSkillCell.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift b/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift deleted file mode 100644 index 6357be45..00000000 --- a/Yep/Views/PickFeedSkill/PickFeedSkillLayout.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// PickFeedSkillLayout.swift -// Yep -// -// Created by nixzhu on 15/10/22. -// Copyright © 2015年 Catch Inc. All rights reserved. -// - -import UIKit - -class PickFeedSkillLayout: UICollectionViewFlowLayout { - - override func prepareLayout() { - super.prepareLayout() - - minimumLineSpacing = 0 - } - - override func targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint { - - if let cv = self.collectionView { - - let cvBounds = cv.bounds - let halfWidth = cvBounds.size.width * 0.5; - let proposedContentOffsetCenterX = proposedContentOffset.x + halfWidth; - - if let attributesForVisibleCells = layoutAttributesForElementsInRect(cvBounds) { - - var candidateAttributes : UICollectionViewLayoutAttributes? - for attributes in attributesForVisibleCells { - - // == Skip comparison with non-cell items (headers and footers) == // - if attributes.representedElementCategory != UICollectionElementCategory.Cell { - continue - } - - if let candAttrs = candidateAttributes { - - let a = attributes.center.x - proposedContentOffsetCenterX - let b = candAttrs.center.x - proposedContentOffsetCenterX - - if abs(a) < abs(b) { - candidateAttributes = attributes; - } - - } else { // == First time in the loop == // - - candidateAttributes = attributes; - continue; - } - } - - return CGPoint(x: round(candidateAttributes!.center.x - halfWidth), y: proposedContentOffset.y) - } - } - - // Fallback - return super.targetContentOffsetForProposedContentOffset(proposedContentOffset) - } -} - diff --git a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift b/Yep/Views/PickFeedSkill/PickFeedSkillView.swift deleted file mode 100644 index cb7f787c..00000000 --- a/Yep/Views/PickFeedSkill/PickFeedSkillView.swift +++ /dev/null @@ -1,96 +0,0 @@ -// -// PickFeedSkillView.swift -// Yep -// -// Created by nixzhu on 15/10/22. -// Copyright © 2015年 Catch Inc. All rights reserved. -// - -import UIKit - -class PickFeedSkillView: UIView { - - let pickFeedSkillCellID = "PickFeedSkillCell" - - lazy var skillsCollectionView: UICollectionView = { - - let layout = PickFeedSkillLayout() - - let view = UICollectionView(frame: CGRectZero, collectionViewLayout: layout) - - view.pagingEnabled = true - - view.backgroundColor = UIColor.lightGrayColor() - - view.registerNib(UINib(nibName: self.pickFeedSkillCellID, bundle: nil), forCellWithReuseIdentifier: self.pickFeedSkillCellID) - - view.dataSource = self - view.delegate = self - - return view - }() - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - - makeUI() - } - - override init(frame: CGRect) { - super.init(frame: frame) - - makeUI() - } - - private func makeUI() { - - backgroundColor = UIColor.lightGrayColor() - - addSubview(skillsCollectionView) - skillsCollectionView.translatesAutoresizingMaskIntoConstraints = false - - let views = [ - "skillsCollectionView": skillsCollectionView, - ] - - let skillsCollectionViewConstraintsH = NSLayoutConstraint.constraintsWithVisualFormat("H:|[skillsCollectionView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views) - - let skillsCollectionViewConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat("V:|[skillsCollectionView]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views) - - NSLayoutConstraint.activateConstraints(skillsCollectionViewConstraintsH) - NSLayoutConstraint.activateConstraints(skillsCollectionViewConstraintsV) - } -} - -// MARK: - UICollectionViewDataSource, UICollectionViewDelegate - -extension PickFeedSkillView: UICollectionViewDataSource, UICollectionViewDelegate { - - func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { - return 1 - } - - func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return 15 - } - - func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - - let cell = collectionView.dequeueReusableCellWithReuseIdentifier(pickFeedSkillCellID, forIndexPath: indexPath) as! PickFeedSkillCell - - cell.skillLabel.text = "Swift \(indexPath.item)" - - return cell - } - - func collectionView(collectionView: UICollectionView!, layout collectionViewLayout: UICollectionViewLayout!, sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize { - - return CGSize(width: collectionView.bounds.width, height: 44) - } - - func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets { - - return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) - } -} -