Commit 5cf48a7b authored by Grigor Aghabalyan's avatar Grigor Aghabalyan
Browse files

Feat: add wlcome page

parent 77264b45
......@@ -32,6 +32,9 @@
C5D6919A242AAD3F004268C3 /* FormCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D69198242AAD3F004268C3 /* FormCreateViewController.xib */; };
C5D691A1242AAE12004268C3 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D691A0242AAE12004268C3 /* MainViewController.swift */; };
C5D691A4242AAF13004268C3 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D691A3242AAF13004268C3 /* Extensions.swift */; };
C5D691AB242AC17D004268C3 /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D691AA242AC17D004268C3 /* UIView+Extensions.swift */; };
C5D691AF242AC607004268C3 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D691AD242AC607004268C3 /* WelcomeViewController.swift */; };
C5D691B0242AC607004268C3 /* WelcomeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D691AE242AC607004268C3 /* WelcomeViewController.xib */; };
DFF30959C2696CFA212F54E4 /* Pods_App16.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC947C811CE3C096F8981C77 /* Pods_App16.framework */; };
/* End PBXBuildFile section */
......@@ -66,6 +69,9 @@
C5D69198242AAD3F004268C3 /* FormCreateViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FormCreateViewController.xib; sourceTree = "<group>"; };
C5D691A0242AAE12004268C3 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
C5D691A3242AAF13004268C3 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
C5D691AA242AC17D004268C3 /* UIView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extensions.swift"; sourceTree = "<group>"; };
C5D691AD242AC607004268C3 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
C5D691AE242AC607004268C3 /* WelcomeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WelcomeViewController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -190,6 +196,7 @@
isa = PBXGroup;
children = (
C5D6919B242AADBD004268C3 /* Main */,
C5D691AC242AC5F3004268C3 /* Welcome */,
C5D69186242AABFA004268C3 /* Login */,
C5D69187242AAC05004268C3 /* Form */,
);
......@@ -265,6 +272,7 @@
isa = PBXGroup;
children = (
C5D691A3242AAF13004268C3 /* Extensions.swift */,
C5D691AA242AC17D004268C3 /* UIView+Extensions.swift */,
);
path = Extensions;
sourceTree = "<group>";
......@@ -276,6 +284,15 @@
path = Cells;
sourceTree = "<group>";
};
C5D691AC242AC5F3004268C3 /* Welcome */ = {
isa = PBXGroup;
children = (
C5D691AD242AC607004268C3 /* WelcomeViewController.swift */,
C5D691AE242AC607004268C3 /* WelcomeViewController.xib */,
);
path = Welcome;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -341,6 +358,7 @@
C5D6915A242AA094004268C3 /* LaunchScreen.storyboard in Resources */,
C5D6919A242AAD3F004268C3 /* FormCreateViewController.xib in Resources */,
C5D69190242AAC86004268C3 /* FormListViewController.xib in Resources */,
C5D691B0242AC607004268C3 /* WelcomeViewController.xib in Resources */,
C5D69157242AA094004268C3 /* Assets.xcassets in Resources */,
C5D69155242AA091004268C3 /* Main.storyboard in Resources */,
);
......@@ -396,6 +414,7 @@
buildActionMask = 2147483647;
files = (
C5D69184242AABD2004268C3 /* LoginViewController.swift in Sources */,
C5D691AF242AC607004268C3 /* WelcomeViewController.swift in Sources */,
C5D691A4242AAF13004268C3 /* Extensions.swift in Sources */,
C5D69179242AA58F004268C3 /* BaseResponse.swift in Sources */,
C5D69199242AAD3F004268C3 /* FormCreateViewController.swift in Sources */,
......@@ -407,6 +426,7 @@
C5D69194242AAD00004268C3 /* SingleFormViewController.swift in Sources */,
C5D69170242AA4E9004268C3 /* Config.swift in Sources */,
C5D6916E242AA4D2004268C3 /* Settings.swift in Sources */,
C5D691AB242AC17D004268C3 /* UIView+Extensions.swift in Sources */,
C5D69177242AA573004268C3 /* ValidationError.swift in Sources */,
C5D6917D242AA5BE004268C3 /* UserDefaultsHelper.swift in Sources */,
C5D69150242AA091004268C3 /* SceneDelegate.swift in Sources */,
......
......@@ -7,6 +7,7 @@
//
import UIKit
import IQKeyboardManagerSwift
@UIApplicationMain
......@@ -15,7 +16,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
IQKeyboardManager.shared.enable = true
return true
}
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "edit.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "logo_green.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "logo.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ import Foundation
struct Config {
static let ENVIRONMENT = "DEV"
static let HOST_NAME = "openweathermap.org"
static let HOST_NAME = "test"
static let BASE_URL = "https://api." + Config.HOST_NAME + "/data/2.5"
static let API_TOKEN = ""
static let API_VERSION = "v1"
......
//
// UIView+Extensions.swift
// App16
//
// Created by Grigor Aghabalyan on 3/25/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
extension UIView {
@IBInspectable var cornerRadius: CGFloat {
get {
return layer.cornerRadius
}
set {
layer.cornerRadius = newValue
layer.masksToBounds = newValue > 0
}
}
@IBInspectable var borderWidth: CGFloat {
get {
return layer.borderWidth
}
set {
layer.borderWidth = newValue
}
}
@IBInspectable var borderColor: UIColor? {
get {
return UIColor(cgColor: layer.borderColor!)
}
set {
layer.borderColor = newValue?.cgColor
}
}
func fixInView(_ container: UIView) -> Void {
self.translatesAutoresizingMaskIntoConstraints = false
self.frame = container.frame
container.addSubview(self)
NSLayoutConstraint(item: self, attribute: .leading, relatedBy: .equal, toItem: container, attribute: .leading, multiplier: 1.0, constant: 0).isActive = true
NSLayoutConstraint(item: self, attribute: .trailing, relatedBy: .equal, toItem: container, attribute: .trailing, multiplier: 1.0, constant: 0).isActive = true
NSLayoutConstraint(item: self, attribute: .top, relatedBy: .equal, toItem: container, attribute: .top, multiplier: 1.0, constant: 0).isActive = true
NSLayoutConstraint(item: self, attribute: .bottom, relatedBy: .equal, toItem: container, attribute: .bottom, multiplier: 1.0, constant: 0).isActive = true
}
func drawShadow(color: UIColor, opacity: Float = 0.5, offSet: CGSize = .zero, radius: CGFloat = 5, scale: Bool = true) {
layer.masksToBounds = false
layer.shadowColor = color.cgColor
layer.shadowOpacity = opacity
layer.shadowOffset = offSet
layer.shadowRadius = radius
layer.shadowPath = UIBezierPath(rect: self.bounds).cgPath
layer.shouldRasterize = true
layer.rasterizationScale = scale ? UIScreen.main.scale : 1
}
func bordered(lineWidth: CGFloat, strokeColor: UIColor = UIColor.white){
let path = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: self.frame.width/2)
let borderLayer = CAShapeLayer()
borderLayer.lineWidth = lineWidth
borderLayer.strokeColor = strokeColor.cgColor
borderLayer.fillColor = UIColor.clear.cgColor
borderLayer.frame = self.bounds
borderLayer.path = path.cgPath
self.layer.addSublayer(borderLayer)
}
func rounded(insets: UIEdgeInsets = .zero){
let path = UIBezierPath.init(roundedRect: self.bounds.inset(by: insets), cornerRadius: self.frame.width/2)
let maskLayer = CAShapeLayer()
maskLayer.frame = self.bounds
maskLayer.path = path.cgPath
self.layer.mask = maskLayer
}
}
......@@ -13,7 +13,7 @@ class AlertControllerHelper {
class func showAlert(title: String?, message: String?) -> UIAlertController {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
let okBt = UIAlertAction(title: "OK", style: UIAlertAction.Style.default) { (result : UIAlertAction) -> Void in}
let okBt = UIAlertAction(title: "Լավ", style: UIAlertAction.Style.default) { (result : UIAlertAction) -> Void in}
alert.addAction(okBt)
return alert
}
......
......@@ -9,6 +9,12 @@
import UIKit
class LoginViewController: UIViewController {
@IBOutlet weak var firstNameTextField: UITextField!
@IBOutlet weak var lastNameTextFiled: UITextField!
@IBOutlet weak var middleNameTextField: UITextField!
@IBOutlet weak var nextButton: UIButton!
// MARK: - LifeCycle
override func viewDidLoad() {
......@@ -16,10 +22,31 @@ class LoginViewController: UIViewController {
}
// MARK: - Navigation
private func openCreateFormViewController() {
let controller = FormCreateViewController()
let navController = UINavigationController(rootViewController: controller)
self.present(navController, animated: true, completion: nil)
}
private func openWelcomeController() {
let controller = WelcomeViewController()
changeRoot(UINavigationController(rootViewController: controller))
}
// MARK: - Actions
@IBAction func nextButtonAction(_ sender: Any) {
if firstNameTextField.text == ""
|| lastNameTextFiled.text == ""
|| middleNameTextField.text == "" {
let alertController = AlertControllerHelper.showAlert(title: nil, message: "Խնդում ենք լրացրեք բոլոր դաշտերը")
self.present(alertController, animated: true, completion: nil)
}else {
openWelcomeController()
}
}
}
This diff is collapsed.
......@@ -21,7 +21,7 @@ class MainViewController: UIViewController {
private func openLoginViewController() {
let controller = LoginViewController()
changeRoot(UINavigationController(rootViewController: controller))
changeRoot(controller)
}
private func openFormCreateController() {
......
//
// WelcomeViewController.swift
// App16
//
// Created by Grigor Aghabalyan on 3/25/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
class WelcomeViewController: UIViewController {
// MARK: - IBOutlets
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var createFormButton: UIButton!
@IBOutlet weak var historyButton: UIButton!
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
setRightBarButton()
}
private func setRightBarButton() {
let editButton = UIBarButtonItem.init(image: UIImage(named: "edit"),
style: .done,
target: self,
action: #selector(editActtions))
editButton.tintColor = UIColor(red: 0/255, green: 137/255, blue: 40/255, alpha: 1)
self.navigationItem.rightBarButtonItem = editButton
}
// MARK: - Actions
@objc private func editActtions() {
}
@IBAction func createButtonAction(_ sender: UIButton) {
}
@IBAction func historyButtonAction(_ sender: UIButton) {
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WelcomeViewController" customModule="App16" customModuleProvider="target">
<connections>
<outlet property="createFormButton" destination="Jmm-GA-Npp" id="waU-t8-FMw"/>
<outlet property="historyButton" destination="xKX-74-m44" id="MDj-66-ha9"/>
<outlet property="nameLabel" destination="RJu-c4-bw8" id="9gd-MT-hXb"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Բարի գալուստ" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tpq-Rn-PFH">
<rect key="frame" x="25" y="187" width="364" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Անուն Ազգանուն" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RJu-c4-bw8">
<rect key="frame" x="25" y="222" width="364" height="27"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jmm-GA-Npp">
<rect key="frame" x="40" y="351" width="334" height="50"/>
<color key="backgroundColor" red="0.0" green="0.53725490200000003" blue="0.15686274510000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="ofI-nA-vgf"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<state key="normal" title="Ստեղծել ձևաթուղթ">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="createButtonAction:" destination="-1" eventType="touchUpInside" id="hcX-99-N9Y"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xKX-74-m44">
<rect key="frame" x="40" y="423" width="334" height="50"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="SD9-Jp-OMB"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<state key="normal" title="Պատմություն">
<color key="titleColor" red="0.0" green="0.53725490200000003" blue="0.15686274510000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="2"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.0" green="0.53725490200000003" blue="0.15686274510000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="historyButtonAction:" destination="-1" eventType="touchUpInside" id="gYU-zc-tGC"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="tpq-Rn-PFH" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="143" id="0zG-8Y-1ak"/>
<constraint firstItem="xKX-74-m44" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="1EZ-9p-hsc"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="RJu-c4-bw8" secondAttribute="trailing" constant="25" id="Cng-7l-xT0"/>
<constraint firstItem="tpq-Rn-PFH" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="25" id="NGj-74-yUC"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="xKX-74-m44" secondAttribute="trailing" constant="40" id="UNL-Wy-Tsw"/>
<constraint firstItem="Jmm-GA-Npp" firstAttribute="top" secondItem="RJu-c4-bw8" secondAttribute="bottom" constant="102" id="XqL-Wa-gsg"/>
<constraint firstItem="Jmm-GA-Npp" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="fgw-Q6-lpD"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Jmm-GA-Npp" secondAttribute="trailing" constant="40" id="ga8-9n-BNj"/>
<constraint firstItem="RJu-c4-bw8" firstAttribute="top" secondItem="tpq-Rn-PFH" secondAttribute="bottom" constant="8" id="moi-cn-Z7J"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="tpq-Rn-PFH" secondAttribute="trailing" constant="25" id="oZA-6H-ryC"/>
<constraint firstItem="xKX-74-m44" firstAttribute="top" secondItem="Jmm-GA-Npp" secondAttribute="bottom" constant="22" id="u2Z-nO-Gex"/>
<constraint firstItem="RJu-c4-bw8" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="25" id="x5E-Jb-L3I"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="139" y="131"/>
</view>
</objects>
</document>
......@@ -12,6 +12,7 @@ target 'App16' do
pod 'Alamofire', '~> 4.3'
pod 'AlamofireObjectMapper', '~> 5.2'
pod 'AlamofireImage', '~> 3.5'
pod 'IQKeyboardManagerSwift'
# Pods for App16
......
......@@ -5,26 +5,30 @@ PODS:
- AlamofireObjectMapper (5.2.1):
- Alamofire (~> 4.7)
- ObjectMapper (~> 3.4)
- IQKeyboardManagerSwift (6.5.5)
- ObjectMapper (3.5.1)
DEPENDENCIES:
- Alamofire (~> 4.3)
- AlamofireImage (~> 3.5)
- AlamofireObjectMapper (~> 5.2)
- IQKeyboardManagerSwift
SPEC REPOS:
trunk:
- Alamofire
- AlamofireImage
- AlamofireObjectMapper
- IQKeyboardManagerSwift
- ObjectMapper
SPEC CHECKSUMS:
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
AlamofireImage: be9963c6582d68b39e89191f64c82a7d7bf40fdd
AlamofireObjectMapper: 1989f690e982b71921b9253f53a4f33a9bc00d88
IQKeyboardManagerSwift: 0fb93310284665245591f50f7a5e38de615960b7
ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0
PODFILE CHECKSUM: 25d5315e2b0d5690011ed1870c484fe32ea06350
PODFILE CHECKSUM: f7b2a4acba9f80a5f15cdb5a8f564ca06e0d8677
COCOAPODS: 1.8.4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment