Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Feature development
Browse files Browse the repository at this point in the history
Side menu added to search page.
  • Loading branch information
Thornaci committed Feb 18, 2018
1 parent dbf24c7 commit 98b7564
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 48 deletions.
20 changes: 20 additions & 0 deletions SteemitApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
8F0D2DA319ADFBAC93253D59 /* Pods_SteemitAppWidget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 852814DD7BACC71EFCEBA815 /* Pods_SteemitAppWidget.framework */; };
ABFFC2526324D20A127D4979 /* Pods_SteemitApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CEC947916BFFF1BA92135A0 /* Pods_SteemitApp.framework */; };
C00B710E202E45DE00219433 /* PostHistoryWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C00B710D202E45DE00219433 /* PostHistoryWebViewController.swift */; };
C034A08A2039964600C9C805 /* SideMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0892039964600C9C805 /* SideMenuViewController.swift */; };
C034A08D20399DBD00C9C805 /* CategoryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */; };
C034A08E20399DBD00C9C805 /* CategoryTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */; };
C03D22C02032180B0077F1F5 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C03D22BF2032180A0077F1F5 /* Info.plist */; };
C03D22C2203218A50077F1F5 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C03D22C1203218A50077F1F5 /* GoogleService-Info.plist */; };
C0420037201E04A700311654 /* FollowersViewControllerTableViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0420036201E04A700311654 /* FollowersViewControllerTableViewExtension.swift */; };
Expand Down Expand Up @@ -117,6 +120,9 @@
852814DD7BACC71EFCEBA815 /* Pods_SteemitAppWidget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SteemitAppWidget.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C0007AF82013A40700C533F7 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C00B710D202E45DE00219433 /* PostHistoryWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHistoryWebViewController.swift; sourceTree = "<group>"; };
C034A0892039964600C9C805 /* SideMenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenuViewController.swift; sourceTree = "<group>"; };
C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryTableViewCell.swift; sourceTree = "<group>"; };
C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CategoryTableViewCell.xib; sourceTree = "<group>"; };
C03D22BF2032180A0077F1F5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C03D22C1203218A50077F1F5 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
C0420036201E04A700311654 /* FollowersViewControllerTableViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersViewControllerTableViewExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -232,6 +238,14 @@
name = Pods;
sourceTree = "<group>";
};
C034A0882039961E00C9C805 /* Custom View Controllers */ = {
isa = PBXGroup;
children = (
C034A0892039964600C9C805 /* SideMenuViewController.swift */,
);
path = "Custom View Controllers";
sourceTree = "<group>";
};
C048DE582031B13E0070C5D5 /* SteemitAppTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -430,6 +444,8 @@
C0420039201E0F2000311654 /* FollowerTableViewCell.xib */,
C0656513202CC08C005F9089 /* PostContentTableViewCell.swift */,
C0656514202CC08C005F9089 /* PostContentTableViewCell.xib */,
C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */,
C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */,
);
path = "Custom Cells";
sourceTree = "<group>";
Expand Down Expand Up @@ -489,6 +505,7 @@
C062EF572003967100B9C3D2 /* Constants */,
C0B899E62014C13300A45554 /* Custom Cells */,
C0BD90412023A30F009B58E7 /* Custom Components */,
C034A0882039961E00C9C805 /* Custom View Controllers */,
C062EF5420038FD400B9C3D2 /* Utils */,
C062EF512003682600B9C3D2 /* Models */,
C062EF4C200364D700B9C3D2 /* Base */,
Expand Down Expand Up @@ -667,6 +684,7 @@
C0ADEB7C2020F7B80053C3BF /* History.storyboard in Resources */,
C0B899EA2014C15100A45554 /* FavoriteTableViewCell.xib in Resources */,
C0656516202CC08C005F9089 /* PostContentTableViewCell.xib in Resources */,
C034A08E20399DBD00C9C805 /* CategoryTableViewCell.xib in Resources */,
C091EE372019DA120010209F /* Follower.storyboard in Resources */,
C0ADEB712020E85B0053C3BF /* Information.storyboard in Resources */,
C042003B201E0F2000311654 /* FollowerTableViewCell.xib in Resources */,
Expand Down Expand Up @@ -874,6 +892,8 @@
C062EF592003968500B9C3D2 /* CoinTypes.swift in Sources */,
C0B899EC2014D21600A45554 /* Helpers.swift in Sources */,
C073B1802022F26E00598305 /* TagHistoryModel.swift in Sources */,
C034A08A2039964600C9C805 /* SideMenuViewController.swift in Sources */,
C034A08D20399DBD00C9C805 /* CategoryTableViewCell.swift in Sources */,
C07C623D202A21AB004A5378 /* PostHistoryContentsViewController.swift in Sources */,
C0B899E92014C15100A45554 /* FavoriteTableViewCell.swift in Sources */,
C0ADEB792020EBDE0053C3BF /* OptionModel.swift in Sources */,
Expand Down
Binary file not shown.
23 changes: 23 additions & 0 deletions SteemitApp/Assets.xcassets/menuImage.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "menuImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "menuImage-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "menuImage-2.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.
35 changes: 32 additions & 3 deletions SteemitApp/Controllers/Home/Search/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,56 @@ import UIKit
class SearchViewController: BaseViewController {

@IBOutlet weak var usernameTextField: UITextField!
@IBOutlet weak var homeView: UIView!
@IBOutlet weak var menuViewLeading: NSLayoutConstraint!

override func viewDidLoad() {
super.viewDidLoad()
let dismissGesture = UITapGestureRecognizer.init(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(dismissGesture)
homeView.addGestureRecognizer(dismissGesture)
}

override func viewDidAppear(_ animated: Bool) {
usernameTextField.becomeFirstResponder()
}

@IBAction func toggleMenu(_ sender: Any) {
dismissKeyboard()
if menuViewLeading.constant < 0 {
self.menuViewLeading.constant += 200
UIView.animate(withDuration: 0.5, animations: {
self.view.layoutIfNeeded()
})
} else {
self.menuViewLeading.constant -= 200
UIView.animate(withDuration: 0.5, animations: {
self.view.layoutIfNeeded()
})
}
}

@IBAction func showInfo(_ sender: Any) {
performSegue(withIdentifier: "chooseAction", sender: nil)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let OptionVC = segue.destination as! OptionsViewController
OptionVC.username = usernameTextField.text!
if segue.identifier == "chooseAction" {
let optionVC = segue.destination as! OptionsViewController
optionVC.username = usernameTextField.text!
} else if segue.identifier == "leftSideMenu" {
let menuVC = segue.destination as! SideMenuViewController
menuVC.categoryList = ["Home", "Utopian-io"]
menuVC.delegate = self
}
}

@objc private func dismissKeyboard() {
view.endEditing(true)
}
}

extension SearchViewController: SideMenuViewControllerDelegate {
func changePage(_ category: String) {
print(category)
}
}
14 changes: 14 additions & 0 deletions SteemitApp/Custom Cells/CategoryTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// CategoryTableViewCell.swift
// SteemitApp
//
// Created by Burak Tayfun on 2/18/18.
// Copyright © 2018 Burak Tayfun. All rights reserved.
//

import UIKit

class CategoryTableViewCell: UITableViewCell {

@IBOutlet weak var headerLabel: UILabel!
}
60 changes: 60 additions & 0 deletions SteemitApp/Custom Cells/CategoryTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="Kefa.ttf">
<string>Kefa-Regular</string>
</array>
</customFonts>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="CategoryTableViewCell" id="KGk-i7-Jjw" customClass="CategoryTableViewCell" customModule="SteemitApp" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mb2-FJ-nUB">
<rect key="frame" x="16" y="0.0" width="288" height="43"/>
<fontDescription key="fontDescription" name="Kefa-Regular" family="Kefa" pointSize="17"/>
<color key="textColor" red="0.1450980392" green="0.83529411760000005" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DeP-wh-wez">
<rect key="frame" x="0.0" y="43" width="320" height="1"/>
<color key="backgroundColor" red="0.19215686269999999" green="0.19215686269999999" blue="0.19215686269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="1M5-Kz-Dbv"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="mb2-FJ-nUB" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="2OU-63-coh"/>
<constraint firstItem="mb2-FJ-nUB" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="66d-BA-L3U"/>
<constraint firstAttribute="trailing" secondItem="mb2-FJ-nUB" secondAttribute="trailing" constant="16" id="Csd-VQ-VUX"/>
<constraint firstItem="DeP-wh-wez" firstAttribute="top" secondItem="mb2-FJ-nUB" secondAttribute="bottom" id="MBT-7a-OKL"/>
<constraint firstAttribute="bottom" secondItem="DeP-wh-wez" secondAttribute="bottom" id="VAI-4A-kMj"/>
<constraint firstAttribute="trailing" secondItem="DeP-wh-wez" secondAttribute="trailing" id="arf-Nj-XHI"/>
<constraint firstItem="DeP-wh-wez" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="gBG-RM-0rR"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="headerLabel" destination="mb2-FJ-nUB" id="xK3-j5-cz9"/>
</connections>
</tableViewCell>
</objects>
</document>
50 changes: 50 additions & 0 deletions SteemitApp/Custom View Controllers/SideMenuViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// SideMenuViewController.swift
// SteemitApp
//
// Created by Burak Tayfun on 2/18/18.
// Copyright © 2018 Burak Tayfun. All rights reserved.
//

import UIKit

protocol SideMenuViewControllerDelegate: class {
func changePage(_ category: String)
}

class SideMenuViewController: UIViewController {

@IBOutlet weak var categoriesTableView: UITableView!

var categoryList = [String]()
let categoryTableViewCellIdentifier = "CategoryTableViewCell"
weak var delegate: SideMenuViewControllerDelegate?

override func viewDidLoad() {
super.viewDidLoad()
categoriesTableView.register(UINib.init(nibName: categoryTableViewCellIdentifier, bundle: nil), forCellReuseIdentifier: categoryTableViewCellIdentifier)
}
}

extension SideMenuViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return categoryList.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: categoryTableViewCellIdentifier, for: indexPath) as! CategoryTableViewCell
cell.headerLabel.text = categoryList[indexPath.row]

return cell
}
}

extension SideMenuViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
delegate?.changePage(categoryList[indexPath.row])
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
}
Loading

0 comments on commit 98b7564

Please sign in to comment.