git.iko.soy/dashared/GDproject
on master help sign in
added user defaults for log in process. working on multiple entries and general channel
commit478eb7896ec88914a46acf294380f01ef2858125 authorDarya Rednikina <rednikina.com@yandex.ru> dateThu 21 Feb 2019, 22:40 (8 years ago) parentdaecc84
21 files changed+330−20
GDproject.xcodeproj/project.pbxproj+31−11 GDproject/Base.lproj/Main.storyboard+44−1 GDproject/Constants.swift+16−3 GDproject/Controller/ChannelController.swift → GDproject/Controller/ News and channels/ChannelController.swift GDproject/Controller/ChannelListController.swift → GDproject/Controller/ News and channels/ChannelListController.swift+2 GDproject/Controller/News/FullPostController.swift → GDproject/Controller/ News and channels/FullPostController.swift GDproject/Controller/News/NewPostViewController.swift → GDproject/Controller/ News and channels/NewPostViewController.swift GDproject/Controller/News/NewsController.swift → GDproject/Controller/ News and channels/NewsController.swift GDproject/Controller/News/NewsVC.swift → GDproject/Controller/ News and channels/NewsVC.swift GDproject/Controller/News/PostViewCell.swift → GDproject/Controller/ News and channels/PostViewCell.swift GDproject/Controller/LogInViewController.swift+138 GDproject/Controller/BasicInfoCell.swift → GDproject/Controller/Profile/BasicInfoCell.swift GDproject/Controller/BasicInfoController.swift → GDproject/Controller/Profile/BasicInfoController.swift GDproject/Controller/InfoCell.swift → GDproject/Controller/Profile/InfoCell.swift GDproject/Controller/InviteViewController.swift → GDproject/Controller/Profile/InviteViewController.swift GDproject/Controller/ProfileViewController.swift → GDproject/Controller/Profile/ProfileViewController.swift GDproject/Controller/SettingsViewController.swift → GDproject/Controller/Profile/SettingsViewController.swift GDproject/DataStorage.swift+45 GDproject/MainController.swift+44 GDproject/Supporting files/AppDelegate.swift+3−2 GDproject/Supporting files/Base.lproj/LaunchScreen.storyboard+7−3
GDproject.xcodeproj/project.pbxproj+31−11
@@ -7,9 +7,12 @@
77 objects = {
88
99/* Begin PBXBuildFile section */
10+ 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
11+ 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A6221F1DD700F6E42A /* MainController.swift */; };
1012 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
1113 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
1214 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
15+ 1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1288B5CD221F1158002BE6B1 /* DataStorage.swift */; };
1316 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D132221C321600B35452 /* ChannelListController.swift */; };
1417 12D7D135221C42B700B35452 /* ChannelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D134221C42B700B35452 /* ChannelController.swift */; };
1518 12D7D137221D78E800B35452 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D136221D78E800B35452 /* Channel.swift */; };
@@ -61,9 +64,12 @@
6164/* End PBXCopyFilesBuildPhase section */
6265
6366/* Begin PBXFileReference section */
67+ 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
68+ 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
6469 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
6570 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
6671 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
72+ 1288B5CD221F1158002BE6B1 /* DataStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStorage.swift; sourceTree = "<group>"; };
6773 12D7D132221C321600B35452 /* ChannelListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelListController.swift; sourceTree = "<group>"; };
6874 12D7D134221C42B700B35452 /* ChannelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelController.swift; sourceTree = "<group>"; };
6975 12D7D136221D78E800B35452 /* Channel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
@@ -109,6 +115,19 @@
109115/* End PBXFrameworksBuildPhase section */
110116
111117/* Begin PBXGroup section */
118+ 1288B5CC221F0EFE002BE6B1 /* Profile */ = {
119+ isa = PBXGroup;
120+ children = (
121+ 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
122+ 12DB7FDE221877160096878E /* InviteViewController.swift */,
123+ 12DB7FDC221872F80096878E /* SettingsViewController.swift */,
124+ 12DB7FD622181CD20096878E /* BasicInfoController.swift */,
125+ 12DB7FDA2218590C0096878E /* InfoCell.swift */,
126+ 12DB7FD822181E660096878E /* BasicInfoCell.swift */,
127+ );
128+ path = Profile;
129+ sourceTree = "<group>";
130+ };
112131 12E36D8F221424EA006FCDD7 = {
113132 isa = PBXGroup;
114133 children = (
@@ -134,6 +153,8 @@
134153 12E36D9A221424EA006FCDD7 /* GDproject */ = {
135154 isa = PBXGroup;
136155 children = (
156+ 1288B5CD221F1158002BE6B1 /* DataStorage.swift */,
157+ 123E37A6221F1DD700F6E42A /* MainController.swift */,
137158 12E36DCF22145923006FCDD7 /* Controller */,
138159 12E36DCD22144756006FCDD7 /* Constants.swift */,
139160 125BD57E22171D73008A3575 /* Extentions.swift */,
@@ -169,29 +190,25 @@
169190 12E36DCF22145923006FCDD7 /* Controller */ = {
170191 isa = PBXGroup;
171192 children = (
172− 12D7D134221C42B700B35452 /* ChannelController.swift */,
173− 12D7D132221C321600B35452 /* ChannelListController.swift */,
174− 125BD57C22171D2A008A3575 /* ProfileViewController.swift */,
175− 12DB7FDE221877160096878E /* InviteViewController.swift */,
176− 12DB7FDC221872F80096878E /* SettingsViewController.swift */,
177− 12DB7FD622181CD20096878E /* BasicInfoController.swift */,
178− 12DB7FDA2218590C0096878E /* InfoCell.swift */,
179− 12DB7FD822181E660096878E /* BasicInfoCell.swift */,
180− 12E36DD322156519006FCDD7 /* News */,
193+ 123E37A4221F1B3200F6E42A /* LogInViewController.swift */,
194+ 1288B5CC221F0EFE002BE6B1 /* Profile */,
195+ 12E36DD322156519006FCDD7 /* News and channels */,
181196 );
182197 path = Controller;
183198 sourceTree = "<group>";
184199 };
185− 12E36DD322156519006FCDD7 /* News */ = {
200+ 12E36DD322156519006FCDD7 /* News and channels */ = {
186201 isa = PBXGroup;
187202 children = (
203+ 12D7D134221C42B700B35452 /* ChannelController.swift */,
204+ 12D7D132221C321600B35452 /* ChannelListController.swift */,
188205 12E36DC922144635006FCDD7 /* NewPostViewController.swift */,
189206 12E36DD022148122006FCDD7 /* FullPostController.swift */,
190207 12E36D9D221424EA006FCDD7 /* NewsController.swift */,
191208 125BD5802217314A008A3575 /* NewsVC.swift */,
192209 12E36DCB22144725006FCDD7 /* PostViewCell.swift */,
193210 );
194− path = News;
211+ path = " News and channels";
195212 sourceTree = "<group>";
196213 };
197214 12E36DDA221594B1006FCDD7 /* Frameworks */ = {
@@ -282,9 +299,11 @@
282299 12E36DCA22144635006FCDD7 /* NewPostViewController.swift in Sources */,
283300 12E36D9E221424EA006FCDD7 /* NewsController.swift in Sources */,
284301 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
302+ 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */,
285303 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
286304 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */,
287305 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
306+ 1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */,
288307 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
289308 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */,
290309 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
@@ -293,6 +312,7 @@
293312 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
294313 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
295314 12DB7FDD221872F80096878E /* SettingsViewController.swift in Sources */,
315+ 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */,
296316 );
297317 runOnlyForDeploymentPostprocessing = 0;
298318 };
GDproject/Base.lproj/Main.storyboard+44−1
@@ -392,6 +392,49 @@
392392 </objects>
393393 <point key="canvasLocation" x="3444" y="129.98500749625188"/>
394394 </scene>
395+ <!--Log In View Controller-->
396+ <scene sceneID="Pkd-pB-bQs">
397+ <objects>
398+ <viewController storyboardIdentifier="LogInController" id="ZCz-70-hDh" customClass="LogInViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
399+ <view key="view" contentMode="scaleToFill" id="1q2-4g-KZs">
400+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
401+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
402+ <subviews>
403+ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="UwC-m5-jA5">
404+ <rect key="frame" x="16" y="100" width="343" height="83"/>
405+ <subviews>
406+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Log In" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="efn-ze-jca">
407+ <rect key="frame" x="0.0" y="0.0" width="343" height="41"/>
408+ <fontDescription key="fontDescription" type="boldSystem" pointSize="34"/>
409+ <nil key="textColor"/>
410+ <nil key="highlightedColor"/>
411+ </label>
412+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Mail" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mFP-WG-jY5">
413+ <rect key="frame" x="0.0" y="53" width="343" height="30"/>
414+ <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
415+ <nil key="textColor"/>
416+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
417+ <textInputTraits key="textInputTraits"/>
418+ </textField>
419+ </subviews>
420+ </stackView>
421+ </subviews>
422+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
423+ <constraints>
424+ <constraint firstItem="UwC-m5-jA5" firstAttribute="leading" secondItem="LOR-Yw-0FU" secondAttribute="leading" constant="16" id="M6z-nU-H40"/>
425+ <constraint firstItem="LOR-Yw-0FU" firstAttribute="trailing" secondItem="UwC-m5-jA5" secondAttribute="trailing" constant="16" id="jST-rr-MMX"/>
426+ <constraint firstItem="UwC-m5-jA5" firstAttribute="top" secondItem="LOR-Yw-0FU" secondAttribute="top" constant="80" id="rvy-Ii-bwS"/>
427+ </constraints>
428+ <viewLayoutGuide key="safeArea" id="LOR-Yw-0FU"/>
429+ </view>
430+ <connections>
431+ <outlet property="mailTextField" destination="mFP-WG-jY5" id="7SN-qe-DDm"/>
432+ </connections>
433+ </viewController>
434+ <placeholder placeholderIdentifier="IBFirstResponder" id="6e8-oo-bbc" userLabel="First Responder" sceneMemberID="firstResponder"/>
435+ </objects>
436+ <point key="canvasLocation" x="-466" y="-821"/>
437+ </scene>
395438 <!--Posts-->
396439 <scene sceneID="RSd-UJ-34B">
397440 <objects>
@@ -433,7 +476,7 @@
433476 <!--Tab Bar Controller-->
434477 <scene sceneID="HCR-WO-p7g">
435478 <objects>
436− <tabBarController automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
479+ <tabBarController storyboardIdentifier="TabBar" automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
437480 <toolbarItems/>
438481 <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3pl-mU-U30">
439482 <rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
GDproject/Constants.swift+16−3
@@ -6,25 +6,38 @@
66// Copyright © 2019 drHSE. All rights reserved.
77//
88
9−//constant for cell in posts NewsController.swift
9+/// constant for cell in posts NewsController.swift
1010let postCellId = "PostCell"
11−// constant for segmented controll in NewsController.swift and ChannelsController.swift
11+
12+/// constant for segmented controll in NewsController.swift and ChannelsController.swift
1213let headerNewsChannelsVC = "HeaderSegmentedControll"
13−// for transitioning to full post view
14+
15+/// for transitioning to full post view
1416let fullPostControllerId = "FullPostController"
1517
18+/// constant for dequing basic cell
1619let basicInfoCellId = "BasicInfoCell"
1720
21+/// constant for dequing info cell
1822let infoCellId = "InfoCell"
1923
24+/// constant for switching to view controller for invitations
2025let inviteVC = "InviteViewController"
2126
27+/// constant for dequing basic cell
2228let channelCellId = "ChannelCell"
2329
30+/// constant for switching to channel list view controller for choosing channel
2431let channelListControllerId = "ChannelListController"
2532
33+/// constant for dequing channel item cell
2634let itemCellId = "ItemCell"
2735
36+/// constant for switching to view controller to add or edit one channel
2837let channelControllerId = "ChannelController"
2938
39+/// constant for switching to news controller
3040let newsController = "NewsController"
41+
42+/// constant for switching to view controller for log in app
43+let logInController = "LogInController"
GDproject/Controller/ChannelController.swift → GDproject/Controller/ News and channels/ChannelController.swiftrenamed

The content is the same.

GDproject/Controller/ChannelListController.swift → GDproject/Controller/ News and channels/ChannelListController.swiftrenamed+2
@@ -21,6 +21,8 @@ class ChannelListController: UITableViewController, DataDelegate {
2121 var filteredDataSource = [Channel]()
2222 var myProtocol: DataDelegate?
2323
24+ var generalChannel: Channel = Channel(title: "General", subtitle: "All posts", hashtags: ["All"], people: ["All"], posts: [])
25+
2426 var isFiltering: Bool {
2527 return searchController.isActive && !searchBarIsEmpty()
2628 }
GDproject/Controller/News/FullPostController.swift → GDproject/Controller/ News and channels/FullPostController.swiftrenamed

The content is the same.

GDproject/Controller/News/NewPostViewController.swift → GDproject/Controller/ News and channels/NewPostViewController.swiftrenamed

The content is the same.

GDproject/Controller/News/NewsController.swift → GDproject/Controller/ News and channels/NewsController.swiftrenamed

The content is the same.

GDproject/Controller/News/NewsVC.swift → GDproject/Controller/ News and channels/NewsVC.swiftrenamed

The content is the same.

GDproject/Controller/News/PostViewCell.swift → GDproject/Controller/ News and channels/PostViewCell.swiftrenamed

The content is the same.

GDproject/Controller/LogInViewController.swiftnew file+138
@@ -0,0 +1,138 @@
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 LogInViewController: UIViewController {
12+
13+ @IBOutlet weak var mailTextField: UITextField!
14+
15+ static let titleColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)
16+
17+ var bottomConstraint: NSLayoutConstraint?
18+
19+ let logInButton: UIButton = {
20+ let button = UIButton(type: .system)
21+ button.setTitle("Log In", for: .normal)
22+ button.setTitleColor(titleColor, for: .normal)
23+ button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
24+ button.isEnabled = false
25+ button.addTarget(self, action: #selector(activateLogInProcess), for: .touchUpInside)
26+ return button
27+ }()
28+
29+ let keyboardBar: UIView = {
30+ let view = UIView()
31+ view.backgroundColor = .white
32+ return view
33+ }()
34+
35+ override func viewDidLoad() {
36+ super.viewDidLoad()
37+ setUpView()
38+ configureTapgesture()
39+ }
40+
41+ override func viewWillAppear(_ animated: Bool) {
42+ super.viewWillAppear(animated)
43+ // MARK:- uncomment when mail registration will be availiable
44+ //self.navigationController?.setNavigationBarHidden(true, animated: animated)
45+ }
46+
47+ override func viewWillDisappear(_ animated: Bool) {
48+ super.viewWillDisappear(animated)
49+ // MARK:- uncomment when mail registration will be availiable
50+ //self.navigationController?.setNavigationBarHidden(false, animated: animated)
51+ }
52+
53+ private func configureTapgesture(){
54+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
55+ view.addGestureRecognizer(tapGesture)
56+ }
57+
58+ @objc func handleTap(){
59+ view.endEditing(true)
60+ }
61+
62+ @objc func activateLogInProcess(){
63+ if logInButton.isEnabled {
64+ // MARK:- when log in is succeeded do I need to go there?
65+ let vc = storyboard!.instantiateViewController(withIdentifier: newsController) as! NewsController
66+ present(vc, animated: true) {
67+ print("logged in")
68+ }
69+ DataStorage.standard.setIsLoggedIn(value: true)
70+ view.endEditing(true)
71+ }
72+ }
73+
74+ func setUpView(){
75+ mailTextField.delegate = self
76+ view.addSubview(keyboardBar)
77+
78+ view.addConstraintsWithFormat(format: "H:|[v0]|", views: keyboardBar)
79+ view.addConstraintsWithFormat(format: "V:[v0(50)]", views: keyboardBar)
80+
81+ setUpBarComponents()
82+
83+ bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
84+ view.addConstraint(bottomConstraint!)
85+
86+ // for keyboard notifications
87+ NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
88+
89+ NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillHideNotification, object: nil)
90+
91+ // for log in button notifications
92+ NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidChangeNotification, object: mailTextField)
93+
94+ NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidBeginEditingNotification, object: mailTextField)
95+ }
96+
97+ @objc func inputDidChanged(notification: NSNotification){
98+ if mailTextField.text?.isEmpty ?? true
99+ {
100+ logInButton.isEnabled = false
101+ logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(0.5), for: .normal)
102+ }
103+ else
104+ {
105+ logInButton.isEnabled = true
106+ logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(1), for: .normal)
107+ }
108+ }
109+
110+ @objc func handleKeyboardNotifications(notification: NSNotification){
111+ if let userInfo = notification.userInfo{
112+ // UIKeyboardFrameEndUserInfoKey
113+ let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
114+ bottomConstraint?.constant = notification.name == UIResponder.keyboardWillShowNotification ? -keyBoardFrame.height+view.safeAreaInsets.bottom : 0
115+
116+ UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
117+ self.view.layoutIfNeeded()
118+ }) { (completed) in
119+
120+ }
121+ }
122+ }
123+
124+ func setUpBarComponents(){
125+ keyboardBar.addSubview(logInButton)
126+ keyboardBar.addConstraintsWithFormat(format: "H:[v0(60)]-16-|", views: logInButton)
127+ keyboardBar.addConstraintsWithFormat(format: "V:|[v0]|", views: logInButton)
128+ }
129+}
130+
131+
132+extension LogInViewController: UITextFieldDelegate{
133+ func textFieldShouldReturn(_ textField: UITextField) -> Bool
134+ {
135+ textField.resignFirstResponder()
136+ return true
137+ }
138+}
GDproject/Controller/BasicInfoCell.swift → GDproject/Controller/Profile/BasicInfoCell.swiftrenamed

The content is the same.

GDproject/Controller/BasicInfoController.swift → GDproject/Controller/Profile/BasicInfoController.swiftrenamed

The content is the same.

GDproject/Controller/InfoCell.swift → GDproject/Controller/Profile/InfoCell.swiftrenamed

The content is the same.

GDproject/Controller/InviteViewController.swift → GDproject/Controller/Profile/InviteViewController.swiftrenamed

The content is the same.

GDproject/Controller/ProfileViewController.swift → GDproject/Controller/Profile/ProfileViewController.swiftrenamed

The content is the same.

GDproject/Controller/SettingsViewController.swift → GDproject/Controller/Profile/SettingsViewController.swiftrenamed

The content is the same.

GDproject/DataStorage.swiftnew file+45
@@ -0,0 +1,45 @@
1+//
2+// DataStorage.swift
3+// GDproject
4+//
5+// Created by cstore on 21/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+
11+/**
12+ _DataStorage_ class is aimed to store user private settings
13+ to display correct data after user leaving the app
14+ */
15+class DataStorage{
16+
17+ private init(){}
18+
19+ static let standard = DataStorage()
20+
21+ // add channel
22+
23+ // delete channel
24+
25+ /**
26+ Function for setting log in status of user
27+ */
28+ func setIsLoggedIn(value: Bool){
29+ UserDefaults.standard.set(value, forKey: UserDefaultsKeys.loggedIn.rawValue)
30+ }
31+
32+ /**
33+ Function to determine is user logged in already or not
34+ */
35+ func isLoggedIn() -> Bool {
36+ return UserDefaults.standard.bool(forKey: UserDefaultsKeys.loggedIn.rawValue)
37+ }
38+}
39+
40+/**
41+ Enum to store UserDefaults keys for getting and setting values
42+ */
43+enum UserDefaultsKeys: String{
44+ case loggedIn
45+}
GDproject/MainController.swiftnew file+44
@@ -0,0 +1,44 @@
1+//
2+// MainController.swift
3+// GDproject
4+//
5+// Created by cstore on 21/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class MainController: UINavigationController {
12+
13+ override func viewDidLoad() {
14+ super.viewDidLoad()
15+
16+// if false {
17+// perform(#selector(showLogInController), with: nil, afterDelay: 0.01)
18+// } else {
19+// perform(#selector(fhfh), with: nil, afterDelay: 0.01)
20+//
21+// }
22+ }
23+
24+// @objc func showLogInController(){
25+// let vc = storyboard!.instantiateViewController(withIdentifier: logInController) as! LogInViewController
26+// present(vc, animated: true) {
27+// print("opportunity to log in")
28+// }
29+// }
30+
31+// @objc func fhfh(){
32+//
33+// let newsController = NC()
34+// viewControllers = [newsController]
35+// }
36+// override func viewDidAppear(_ animated: Bool) {
37+// super.viewDidAppear(animated)
38+//
39+//
40+// }
41+}
42+
43+
44+
GDproject/Supporting files/AppDelegate.swift+3−2
@@ -16,6 +16,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1616
1717 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818 // Override point for customization after application launch.
19+// window = UIWindow(frame: UIScreen.main.bounds)
20+// window?.makeKeyAndVisible()
21+// window?.rootViewController = MainController()
1922 return true
2023 }
2124
@@ -40,7 +43,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4043 func applicationWillTerminate(_ application: UIApplication) {
4144 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4245 }
43−
44−
4546}
4647
GDproject/Supporting files/Base.lproj/LaunchScreen.storyboard+7−3
@@ -1,7 +1,11 @@
1−<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
1+<?xml version="1.0" encoding="UTF-8"?>
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+ <device id="retina4_7" orientation="portrait">
4+ <adaptation id="fullscreen"/>
5+ </device>
36 <dependencies>
4− <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
7+ <deployment identifier="iOS"/>
8+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
59 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
610 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
711 </dependencies>