git.iko.soy/dashared/GDproject
on master help sign in
created settings and invite new user page
commit30b7ba4ca4d88e121a5ce330bc0439ec0d3925a9 authorDarya Rednikina <rednikina.com@yandex.ru> dateSat 16 Feb 2019, 21:01 (8 years ago) parent77ad34c
10 files changed+358−4
GDproject.xcodeproj/project.pbxproj+12 GDproject/Base.lproj/Main.storyboard+81 GDproject/Constants.swift+4 GDproject/Controller/BasicInfoCell.swift+2−1 GDproject/Controller/BasicInfoController.swift+3−2 GDproject/Controller/InfoCell.swift+44 GDproject/Controller/InviteViewController.swift+140 GDproject/Controller/ProfileViewController.swift+9−1 GDproject/Controller/SettingsViewController.swift+49 GDproject/Extentions.swift+14
GDproject.xcodeproj/project.pbxproj+12
@@ -12,6 +12,9 @@
1212 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
1313 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD622181CD20096878E /* BasicInfoController.swift */; };
1414 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FD822181E660096878E /* BasicInfoCell.swift */; };
15+ 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FDA2218590C0096878E /* InfoCell.swift */; };
16+ 12DB7FDD221872F80096878E /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FDC221872F80096878E /* SettingsViewController.swift */; };
17+ 12DB7FDF221877160096878E /* InviteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12DB7FDE221877160096878E /* InviteViewController.swift */; };
1518 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */; };
1619 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36D9D221424EA006FCDD7 /* NewsController.swift */; };
1720 12E36DA1221424EA006FCDD7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12E36D9F221424EA006FCDD7 /* Main.storyboard */; };
@@ -62,6 +65,9 @@
6265 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
6366 12DB7FD622181CD20096878E /* BasicInfoController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoController.swift; sourceTree = "<group>"; };
6467 12DB7FD822181E660096878E /* BasicInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicInfoCell.swift; sourceTree = "<group>"; };
68+ 12DB7FDA2218590C0096878E /* InfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoCell.swift; sourceTree = "<group>"; };
69+ 12DB7FDC221872F80096878E /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
70+ 12DB7FDE221877160096878E /* InviteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteViewController.swift; sourceTree = "<group>"; };
6571 12E36D98221424EA006FCDD7 /* GDproject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GDproject.app; sourceTree = BUILT_PRODUCTS_DIR; };
6672 12E36D9B221424EA006FCDD7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6773 12E36D9D221424EA006FCDD7 /* NewsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsController.swift; sourceTree = "<group>"; };
@@ -161,7 +167,10 @@
161167 isa = PBXGroup;
162168 children = (
163169 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
170+ 12DB7FDE221877160096878E /* InviteViewController.swift */,
171+ 12DB7FDC221872F80096878E /* SettingsViewController.swift */,
164172 12DB7FD622181CD20096878E /* BasicInfoController.swift */,
173+ 12DB7FDA2218590C0096878E /* InfoCell.swift */,
165174 12DB7FD822181E660096878E /* BasicInfoCell.swift */,
166175 12E36DD322156519006FCDD7 /* News */,
167176 );
@@ -266,6 +275,7 @@
266275 12E36DB922144016006FCDD7 /* User.swift in Sources */,
267276 125BD5812217314A008A3575 /* NewsVC.swift in Sources */,
268277 12E36DB72214400A006FCDD7 /* Post.swift in Sources */,
278+ 12DB7FDF221877160096878E /* InviteViewController.swift in Sources */,
269279 12E36DCA22144635006FCDD7 /* NewPostViewController.swift in Sources */,
270280 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */,
271281 12E36DC622144266006FCDD7 /* HeaderNewsChannels.swift in Sources */,
@@ -273,10 +283,12 @@
273283 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
274284 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
275285 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
286+ 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */,
276287 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
277288 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
278289 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
279290 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
291+ 12DB7FDD221872F80096878E /* SettingsViewController.swift in Sources */,
280292 );
281293 runOnlyForDeploymentPostprocessing = 0;
282294 };
GDproject/Base.lproj/Main.storyboard+81
@@ -164,6 +164,87 @@
164164 </objects>
165165 <point key="canvasLocation" x="2013.5999999999999" y="957.57121439280365"/>
166166 </scene>
167+ <!--Settings View Controller-->
168+ <scene sceneID="WVn-Qy-9tO">
169+ <objects>
170+ <tableViewController storyboardIdentifier="SettingsViewController" id="zy1-9Z-5P6" customClass="SettingsViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
171+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="VhJ-pr-aLb">
172+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
173+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
174+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
175+ <prototypes>
176+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsCell" textLabel="QDL-KY-T1r" style="IBUITableViewCellStyleDefault" id="IGo-n9-HiV">
177+ <rect key="frame" x="0.0" y="28" width="375" height="44"/>
178+ <autoresizingMask key="autoresizingMask"/>
179+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="IGo-n9-HiV" id="gMT-ei-M43">
180+ <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
181+ <autoresizingMask key="autoresizingMask"/>
182+ <subviews>
183+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QDL-KY-T1r">
184+ <rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
185+ <autoresizingMask key="autoresizingMask"/>
186+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
187+ <nil key="textColor"/>
188+ <nil key="highlightedColor"/>
189+ </label>
190+ </subviews>
191+ </tableViewCellContentView>
192+ </tableViewCell>
193+ </prototypes>
194+ <connections>
195+ <outlet property="dataSource" destination="zy1-9Z-5P6" id="7hY-TM-IK0"/>
196+ <outlet property="delegate" destination="zy1-9Z-5P6" id="J9r-Hh-aVU"/>
197+ </connections>
198+ </tableView>
199+ </tableViewController>
200+ <placeholder placeholderIdentifier="IBFirstResponder" id="xdg-ZK-4Jv" userLabel="First Responder" sceneMemberID="firstResponder"/>
201+ </objects>
202+ <point key="canvasLocation" x="1986" y="1756"/>
203+ </scene>
204+ <!--Invite View Controller-->
205+ <scene sceneID="DcO-6Y-Iko">
206+ <objects>
207+ <viewController storyboardIdentifier="InviteViewController" id="UFZ-Q3-pIW" customClass="InviteViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
208+ <view key="view" contentMode="scaleToFill" id="Tex-e4-Huf">
209+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
210+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
211+ <subviews>
212+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="Oc6-Ho-qfI">
213+ <rect key="frame" x="16" y="100" width="343" height="83"/>
214+ <subviews>
215+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Invite:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D2l-JD-WXP">
216+ <rect key="frame" x="0.0" y="0.0" width="343" height="41"/>
217+ <fontDescription key="fontDescription" type="boldSystem" pointSize="34"/>
218+ <nil key="textColor"/>
219+ <nil key="highlightedColor"/>
220+ </label>
221+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Bk1-tC-5g3">
222+ <rect key="frame" x="0.0" y="53" width="343" height="30"/>
223+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
224+ <nil key="textColor"/>
225+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
226+ <textInputTraits key="textInputTraits"/>
227+ </textField>
228+ </subviews>
229+ </stackView>
230+ </subviews>
231+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
232+ <constraints>
233+ <constraint firstItem="Oc6-Ho-qfI" firstAttribute="top" secondItem="WUm-xh-PeM" secondAttribute="top" constant="80" id="2uM-Ya-0qT"/>
234+ <constraint firstItem="WUm-xh-PeM" firstAttribute="trailing" secondItem="Oc6-Ho-qfI" secondAttribute="trailing" constant="16" id="DAS-R5-CYz"/>
235+ <constraint firstItem="Oc6-Ho-qfI" firstAttribute="leading" secondItem="WUm-xh-PeM" secondAttribute="leading" constant="16" id="vTc-Zq-XMS"/>
236+ </constraints>
237+ <viewLayoutGuide key="safeArea" id="WUm-xh-PeM"/>
238+ </view>
239+ <connections>
240+ <outlet property="inviteLabel" destination="D2l-JD-WXP" id="g0g-Oo-uzs"/>
241+ <outlet property="mailTextField" destination="Bk1-tC-5g3" id="JQ3-v9-MK6"/>
242+ </connections>
243+ </viewController>
244+ <placeholder placeholderIdentifier="IBFirstResponder" id="t8a-Sv-mbh" userLabel="First Responder" sceneMemberID="firstResponder"/>
245+ </objects>
246+ <point key="canvasLocation" x="2803" y="1756"/>
247+ </scene>
167248 <!--New Post View Controller-->
168249 <scene sceneID="TVK-xu-UdJ">
169250 <objects>
GDproject/Constants.swift+4
@@ -14,3 +14,7 @@ let headerNewsChannelsVC = "HeaderSegmentedControll"
1414let fullPostControllerId = "FullPostController"
1515
1616let basicInfoCellId = "BasicInfoCell"
17+
18+let infoCellId = "InfoCell"
19+
20+let inviteVC = "InviteViewController"
GDproject/Controller/BasicInfoCell.swift+2−1
@@ -24,7 +24,8 @@ class BasicInfoCell: UITableViewCell{
2424
2525 func setUpView(){
2626 addSubview(titleLabel)
27− titleLabel.edgesToSuperview(excluding: .bottom, insets: .top(8) + .left(16) + .right(16))
27+ titleLabel.horizontalToSuperview(insets: .left(16) + .right(16))
28+ titleLabel.verticalToSuperview(insets: .top(8) + .bottom(8))
2829 }
2930
3031 required init?(coder aDecoder: NSCoder) {
GDproject/Controller/BasicInfoController.swift+3−2
@@ -20,7 +20,7 @@ class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDat
2020 CellData(opened: false, title: "Phone", sectionData: ["+7 901 733 01 79"]),
2121 CellData(opened: false, title: "Mail", sectionData: ["vbogomazova@edu.hse.ru"]),
2222 CellData(opened: false, title: "Research ID", sectionData: ["4567834336789456737"]),
23− CellData(opened: false, title: "Published", sectionData: ["Книга 1", "Книга 2", "Книга 3"]),
23+ CellData(opened: false, title: "Published", sectionData: ["Это будет очень длинное название книги 1, чтобы сделать проверку", "Книга 2", "Книга 3"]),
2424 CellData(opened: false, title: "Courses", sectionData: ["Курс 1", "Курс 2"]),
2525 CellData(opened: false, title: "Link", sectionData: ["https://wwww.hse.ru"])
2626 ]
@@ -41,10 +41,11 @@ class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDat
4141 if indexPath.row == 0 {
4242 let cell = tableView.dequeueReusableCell(withIdentifier: basicInfoCellId, for: indexPath) as! BasicInfoCell
4343 cell.fill(title: dataSourse[indexPath.section].title)
44+ cell.accessoryType = .disclosureIndicator
4445 cell.selectionStyle = .none
4546 return cell
4647 } else {
47− let cell = tableView.dequeueReusableCell(withIdentifier: basicInfoCellId, for: indexPath) as! BasicInfoCell
48+ let cell = tableView.dequeueReusableCell(withIdentifier: infoCellId, for: indexPath) as! InfoCell
4849 cell.fill(title: dataSourse[indexPath.section].sectionData[indexPath.row - 1])
4950 cell.selectionStyle = .none
5051 return cell
GDproject/Controller/InfoCell.swiftnew file+44
@@ -0,0 +1,44 @@
1+//
2+// BasicInfoCell.swift
3+// NewsFeed
4+//
5+// Created by cstore on 23/01/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+import TinyConstraints
11+
12+class InfoCell: UITableViewCell{
13+
14+ var textView: UITextView = {
15+ let label = UITextView()
16+ label.font = UIFont.systemFont(ofSize: 16)
17+ label.sizeToFit()
18+ label.isScrollEnabled = false
19+ label.isUserInteractionEnabled = false
20+ label.isEditable = false
21+ label.textColor = .black
22+ return label
23+ }()
24+
25+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
26+ super.init(style: style, reuseIdentifier: reuseIdentifier)
27+ }
28+
29+ func setUpView()
30+ {
31+ addSubview(textView)
32+ textView.horizontalToSuperview(insets: .left(32) + .right(16))
33+ textView.verticalToSuperview(insets: .top(8) + .bottom(8))
34+ }
35+
36+ required init?(coder aDecoder: NSCoder) {
37+ fatalError("init(coder:) has not been implemented")
38+ }
39+
40+ func fill(title: String){
41+ setUpView()
42+ textView.text = title
43+ }
44+}
GDproject/Controller/InviteViewController.swiftnew file+140
@@ -0,0 +1,140 @@
1+//
2+// LogInViewController.swift
3+// NewsFeed
4+//
5+// Created by cstore on 20/01/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class InviteViewController: UIViewController {
12+
13+ @IBOutlet weak var mailTextField: UITextField!
14+
15+ @IBOutlet weak var inviteLabel: UILabel!
16+
17+ static let titleColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)
18+
19+ var bottomConstraint: NSLayoutConstraint?
20+
21+ let logInButton: UIButton = {
22+ let button = UIButton(type: .system)
23+ button.setTitle("Invite", for: .normal)
24+ button.setTitleColor(titleColor, for: .normal)
25+ button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
26+ button.isEnabled = false
27+ button.addTarget(self, action: #selector(activateLogInProcess), for: .touchUpInside)
28+ return button
29+ }()
30+
31+ let keyboardBar: UIView = {
32+ let view = UIView()
33+ view.backgroundColor = .white
34+ return view
35+ }()
36+
37+ override func viewDidLoad() {
38+ super.viewDidLoad()
39+ setUpView()
40+ configureTapgesture()
41+ }
42+
43+ override func viewWillAppear(_ animated: Bool) {
44+ super.viewWillAppear(animated)
45+ // MARK:- uncomment when mail registration will be availiable
46+ //self.navigationController?.setNavigationBarHidden(true, animated: animated)
47+
48+
49+ navigationController?.navigationBar.prefersLargeTitles = false
50+ }
51+
52+ override func viewWillDisappear(_ animated: Bool) {
53+ super.viewWillDisappear(animated)
54+ // MARK:- uncomment when mail registration will be availiable
55+ //self.navigationController?.setNavigationBarHidden(false, animated: animated)
56+ }
57+
58+ private func configureTapgesture(){
59+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
60+ view.addGestureRecognizer(tapGesture)
61+ }
62+
63+ @objc func handleTap(){
64+ view.endEditing(true)
65+ }
66+
67+ @objc func activateLogInProcess(){
68+ if logInButton.isEnabled {
69+ // instead of transporting user for new vc, make him a sign that everything was complete
70+ inviteLabel.text?.append(" ✅")
71+ view.endEditing(true)
72+ }
73+ }
74+
75+ func setUpView(){
76+ mailTextField.delegate = self
77+ view.addSubview(keyboardBar)
78+
79+ view.addConstraintsWithFormat(format: "H:|[v0]|", views: keyboardBar)
80+ view.addConstraintsWithFormat(format: "V:[v0(50)]", views: keyboardBar)
81+
82+ setUpBarComponents()
83+
84+ bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
85+ view.addConstraint(bottomConstraint!)
86+
87+ // for keyboard notifications
88+ NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
89+
90+ NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillHideNotification, object: nil)
91+
92+ // for log in button notifications
93+ NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidChangeNotification, object: mailTextField)
94+
95+ NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidBeginEditingNotification, object: mailTextField)
96+ }
97+
98+
99+ @objc func inputDidChanged(notification: NSNotification){
100+ if mailTextField.text?.isEmpty ?? true
101+ {
102+ logInButton.isEnabled = false
103+ logInButton.setTitleColor(InviteViewController.titleColor.withAlphaComponent(0.5), for: .normal)
104+ }
105+ else
106+ {
107+ logInButton.isEnabled = true
108+ logInButton.setTitleColor(InviteViewController.titleColor.withAlphaComponent(1), for: .normal)
109+ }
110+ }
111+
112+ @objc func handleKeyboardNotifications(notification: NSNotification){
113+ if let userInfo = notification.userInfo{
114+ // UIKeyboardFrameEndUserInfoKey
115+ let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
116+ bottomConstraint?.constant = notification.name == UIResponder.keyboardWillShowNotification ? -keyBoardFrame.height+view.safeAreaInsets.bottom : 0
117+
118+ UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
119+ self.view.layoutIfNeeded()
120+ }) { (completed) in
121+
122+ }
123+ }
124+ }
125+
126+ func setUpBarComponents(){
127+ keyboardBar.addSubview(logInButton)
128+ keyboardBar.addConstraintsWithFormat(format: "H:[v0(60)]-16-|", views: logInButton)
129+ keyboardBar.addConstraintsWithFormat(format: "V:|[v0]|", views: logInButton)
130+ }
131+}
132+
133+
134+extension InviteViewController: UITextFieldDelegate{
135+ func textFieldShouldReturn(_ textField: UITextField) -> Bool
136+ {
137+ textField.resignFirstResponder()
138+ return true
139+ }
140+}
GDproject/Controller/ProfileViewController.swift+9−1
@@ -62,6 +62,8 @@ class ProfileViewController: UIViewController
6262
6363 tableView.register(BasicInfoCell.self, forCellReuseIdentifier: basicInfoCellId)
6464
65+ tableView.register(InfoCell.self, forCellReuseIdentifier: infoCellId)
66+
6567 posts.viewController = self
6668
6769 fill(with: user)
@@ -95,7 +97,13 @@ class ProfileViewController: UIViewController
9597
9698 let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
9799 let editAction = UIAlertAction(title: "Edit profile", style: .default)
98− let settingsAction = UIAlertAction(title: "Settings", style: .default)
100+ let settingsAction = UIAlertAction(title: "Setting", style: .default)
101+ { [weak self] (_) in
102+
103+ let vc = self?.storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
104+ self?.navigationController?.pushViewController(vc, animated: true)
105+ }
106+
99107 let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
100108 let shareAction = UIAlertAction(title: "Share", style: .default)
101109
GDproject/Controller/SettingsViewController.swiftnew file+49
@@ -0,0 +1,49 @@
1+//
2+// SettingsViewController.swift
3+// GDproject
4+//
5+// Created by cstore on 16/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class SettingsViewController: UITableViewController {
12+
13+ var dataSourse: [String] = ["Пригласить преподавателя"]
14+
15+ override func viewDidLoad() {
16+ super.viewDidLoad()
17+ navigationItem.title = "Settings"
18+ }
19+
20+ // MARK: - Table view data source
21+
22+ override func viewWillAppear(_ animated: Bool) {
23+ super.viewWillAppear(animated)
24+
25+ navigationController?.navigationBar.prefersLargeTitles = true
26+ }
27+
28+
29+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
30+ return dataSourse.count
31+ }
32+
33+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
34+ if dataSourse[indexPath.row] == "Пригласить преподавателя" {
35+ let vc = storyboard?.instantiateViewController(withIdentifier: inviteVC) as! InviteViewController
36+ navigationController?.pushViewController(vc, animated: true)
37+ }
38+ }
39+
40+
41+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
42+ {
43+ let cell = tableView.dequeueReusableCell(withIdentifier: "SettingsCell", for: indexPath)
44+ cell.textLabel?.text = dataSourse[indexPath.row]
45+ cell.selectionStyle = .none
46+ return cell
47+ }
48+
49+}
GDproject/Extentions.swift+14
@@ -20,3 +20,17 @@ extension UIImage{
2020 return UIGraphicsGetImageFromCurrentImageContext()!
2121 }
2222}
23+
24+extension UIView
25+{
26+ func addConstraintsWithFormat(format: String, views: UIView...){
27+ var viewsDictionary = [String: UIView]()
28+ for (index, view) in views.enumerated(){
29+ let key = "v\(index)"
30+ viewsDictionary[key] = view
31+ view.translatesAutoresizingMaskIntoConstraints = false
32+ }
33+
34+ addConstraints(NSLayoutConstraint.constraints(withVisualFormat: format, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDictionary))
35+ }
36+}