Skip to content

Commit

Permalink
add UserRegistration
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaKupradze committed Jun 5, 2017
1 parent e1b6a1f commit 0ad33e5
Show file tree
Hide file tree
Showing 14 changed files with 442 additions and 18 deletions.
10 changes: 9 additions & 1 deletion Instagram.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
932F43A01EDEA1C10027452F /* Billabong.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 932F439F1EDEA1B80027452F /* Billabong.ttf */; };
932F43A51EDEB8960027452F /* IstagramTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932F43A41EDEB8960027452F /* IstagramTableViewCell.swift */; };
932F43AC1EDEBB260027452F /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 932F43AB1EDEBB260027452F /* UserInfo.swift */; };
9334D1A31EE33232003B78C7 /* RegistrationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9334D1A21EE33232003B78C7 /* RegistrationVC.swift */; };
9356C4BB1EE1DA1900F7D34D /* LogInVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9356C4BA1EE1DA1900F7D34D /* LogInVC.swift */; };
937FE2FE1EE324C70060EFFE /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 937FE2FD1EE324C70060EFFE /* TabBarController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -29,7 +31,9 @@
932F439F1EDEA1B80027452F /* Billabong.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Billabong.ttf; sourceTree = "<group>"; };
932F43A41EDEB8960027452F /* IstagramTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IstagramTableViewCell.swift; sourceTree = "<group>"; };
932F43AB1EDEBB260027452F /* UserInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = "<group>"; };
9334D1A21EE33232003B78C7 /* RegistrationVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegistrationVC.swift; sourceTree = "<group>"; };
9356C4BA1EE1DA1900F7D34D /* LogInVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogInVC.swift; sourceTree = "<group>"; };
937FE2FD1EE324C70060EFFE /* TabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -63,8 +67,8 @@
isa = PBXGroup;
children = (
932F438A1EDEA0B90027452F /* AppDelegate.swift */,
932F43A81EDEBA650027452F /* Model */,
932F43A31EDEB80A0027452F /* Controller */,
932F43A81EDEBA650027452F /* Model */,
932F43A21EDEB7F90027452F /* View */,
932F439C1EDEA14D0027452F /* Resource */,
932F43961EDEA0B90027452F /* Info.plist */,
Expand Down Expand Up @@ -112,6 +116,8 @@
932F438C1EDEA0B90027452F /* ViewController.swift */,
932F43A41EDEB8960027452F /* IstagramTableViewCell.swift */,
9356C4BA1EE1DA1900F7D34D /* LogInVC.swift */,
937FE2FD1EE324C70060EFFE /* TabBarController.swift */,
9334D1A21EE33232003B78C7 /* RegistrationVC.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -201,7 +207,9 @@
932F43AC1EDEBB260027452F /* UserInfo.swift in Sources */,
932F43A51EDEB8960027452F /* IstagramTableViewCell.swift in Sources */,
932F438D1EDEA0B90027452F /* ViewController.swift in Sources */,
937FE2FE1EE324C70060EFFE /* TabBarController.swift in Sources */,
9356C4BB1EE1DA1900F7D34D /* LogInVC.swift in Sources */,
9334D1A31EE33232003B78C7 /* RegistrationVC.swift in Sources */,
932F438B1EDEA0B90027452F /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file not shown.
64 changes: 58 additions & 6 deletions Instagram/Controller/LogInVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,70 @@ class LogInVC: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
username.text = loadName()
password.text = loadPassword()

// Do any additional setup after loading the view.
}


//IBAction LogIn Button
@IBAction func LogInBtn(_ sender: Any) {
func saveData (userName : String , password : String){
let defaults = UserDefaults.standard
defaults.set(userName, forKey: "rrrUserName")
defaults.set(password, forKey: "rrrPassword")

}


func loadName() -> String {
let defaults = UserDefaults.standard
if let currentName = defaults.value(forKey: "rrrUserName"){
return (currentName as? String)!

}
else {
return " "
}
}

func loadPassword () -> String{
let defaults = UserDefaults.standard
if let currrentPassword = defaults.value(forKey: "rrrPassword"){
return (currrentPassword as? String)!
}
else {
return " "
}
}


@IBAction func backBtn(_ sender: Any) {
dismiss(animated: true, completion: nil)
dismiss(animated: true, completion: nil)
}

}

@IBAction func logInBtn(_ sender: Any) {

if username.text == loadName() && password.text == loadPassword() {

let nextController = self.storyboard?.instantiateViewController(withIdentifier: "TabBarIdentity") as! TabBarController
self.navigationController?.pushViewController(nextController, animated: true)

username.text = " "
password.text = " "
}
else {
print("ar sheiqmna contoleri")

}

}


@IBAction func registrationBtn(_ sender: Any) {


}

}



73 changes: 73 additions & 0 deletions Instagram/Controller/RegistrationVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// RegistrationVC.swift
// Instagram
//
// Created by Tea Kupradze on 6/3/17.
// Copyright © 2017 Lemondo. All rights reserved.
//

import UIKit

class RegistrationVC: UIViewController {


@IBOutlet weak var name: UITextField!
@IBOutlet weak var fullName: UITextField!
@IBOutlet weak var mail: UITextField!
@IBOutlet weak var userName: UITextField!
@IBOutlet weak var password: UITextField!
@IBOutlet weak var resultLbl: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
userName.text = loadName()
password.text = loadPassword()
// Do any additional setup after loading the view.
}


func saveData (userName : String , password : String){
let defaults = UserDefaults.standard
defaults.set(userName, forKey: "rrrUserName")
defaults.set(password, forKey: "rrrPassword")

}

func loadName() -> String {
let defaults = UserDefaults.standard
if let currentName = defaults.value(forKey: "rrrUserName"){
return (currentName as? String)!

}
else {
return " "
}
}

func loadPassword () -> String{
let defaults = UserDefaults.standard
if let currrentPassword = defaults.value(forKey: "rrrPassword"){
return (currrentPassword as? String)!
}
else {
return " "
}
}



@IBAction func userRegister(_ sender: Any) {

if ((userName.text?.characters.count)! > 0 && (password.text?.characters.count)! > 0){
saveData(userName: userName.text!, password: password.text!)
userName.text = " "
password.text = " "
resultLbl.text = "რეგისტრაცია წარმატებით დასრულდა"
dismiss(animated: true, completion: nil)
}
else {
resultLbl.text = "ვერ დარეგისტრირდა"
}
}

}
23 changes: 23 additions & 0 deletions Instagram/Controller/TabBarController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// TabBarController.swift
// Instagram
//
// Created by Tea Kupradze on 6/3/17.
// Copyright © 2017 Lemondo. All rights reserved.
//

import UIKit

class TabBarController: UITabBarController {




override func viewDidLoad() {
super.viewDidLoad()
selectedIndex = 2

// Do any additional setup after loading the view.
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "contacts.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "contacts@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "contacts@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "searchIcon@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "searchIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0ad33e5

Please sign in to comment.