Skip to content

Commit

Permalink
Merge branch 'iOS/feature/#27/IssueList'
Browse files Browse the repository at this point in the history
Conflicts:
	iOS/issue-tracker/issue-tracker.xcodeproj/project.pbxproj
zekexros committed Jun 14, 2021
2 parents 6c620f7 + 46e4494 commit ae818e3
Showing 17 changed files with 764 additions and 145 deletions.
43 changes: 43 additions & 0 deletions iOS/issue-tracker/LabelsCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// LabelsCollectionViewCell.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/13.
//

import UIKit
import SnapKit

class LabelsCollectionViewCell: UICollectionViewCell {
static var identifiers = "LabelsCollectionViewCell"

let label: PaddingLabel = {
var label = PaddingLabel(withInsets: 0, 0, 10, 10)
label.textAlignment = .center
label.textColor = .white
label.layer.masksToBounds = true
label.layer.cornerRadius = 15
return label
}()

override init(frame: CGRect) {
super.init(frame: frame)
addSubview(label)
setAutolayout()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
}

func setAutolayout() {
label.snp.makeConstraints { label in
label.edges.equalToSuperview()
}
}

func configure(title: String, color: String) {
label.text = title
label.backgroundColor = UIColor.hexStringToUIColor(hex: color)
}
}
64 changes: 56 additions & 8 deletions iOS/issue-tracker/issue-tracker.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

81 changes: 67 additions & 14 deletions iOS/issue-tracker/issue-tracker/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ztH-lY-X3Y">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ztH-lY-X3Y">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -37,23 +37,38 @@
</objects>
<point key="canvasLocation" x="-632" y="238"/>
</scene>
<!--이슈-->
<!--Issue List View Controller-->
<scene sceneID="f3p-9R-hjs">
<objects>
<viewController id="oTI-da-eDR" sceneMemberID="viewController">
<viewController id="oTI-da-eDR" customClass="IssueListViewController" customModule="issue_tracker" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="e9G-As-1Ly">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="300" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="oU9-yx-qTd">
<rect key="frame" x="0.0" y="88" width="414" height="725"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="y9l-Qc-QqU"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="oU9-yx-qTd" firstAttribute="leading" secondItem="y9l-Qc-QqU" secondAttribute="leading" id="5GG-x3-eF8"/>
<constraint firstItem="oU9-yx-qTd" firstAttribute="top" secondItem="y9l-Qc-QqU" secondAttribute="top" id="68q-pE-jgZ"/>
<constraint firstItem="y9l-Qc-QqU" firstAttribute="trailing" secondItem="oU9-yx-qTd" secondAttribute="trailing" id="FKS-7O-uGe"/>
<constraint firstItem="y9l-Qc-QqU" firstAttribute="bottom" secondItem="oU9-yx-qTd" secondAttribute="bottom" id="gAn-Xe-pob"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="이슈" image="exclamationmark.circle" catalog="system" id="goh-EH-LxE"/>
<navigationItem key="navigationItem" id="U4K-1F-xyh"/>
<connections>
<outlet property="issueTableView" destination="oU9-yx-qTd" id="eMI-5k-3kH"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="elB-mf-Nih" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="249" y="793"/>
<point key="canvasLocation" x="228.98550724637684" y="1516.7410714285713"/>
</scene>
<!--레이블-->
<!--Label View Controller-->
<scene sceneID="SuD-oH-C9C">
<objects>
<viewController id="dsf-nF-ec5" customClass="LabelViewController" customModule="issue_tracker" customModuleProvider="target" sceneMemberID="viewController">
@@ -75,14 +90,14 @@
<constraint firstItem="HEu-i9-bYg" firstAttribute="top" secondItem="aEd-FN-64U" secondAttribute="top" id="vxU-Vr-Fwg"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="레이블" image="tag" catalog="system" id="icm-rA-6fv"/>
<navigationItem key="navigationItem" id="yVl-u9-CF2"/>
<connections>
<outlet property="labelTableView" destination="HEu-i9-bYg" id="R20-IQ-0Wm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IGg-E4-hvo" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1019" y="793"/>
<point key="canvasLocation" x="1109" y="1517"/>
</scene>
<!--내게정-->
<scene sceneID="CPO-fU-AJO">
@@ -98,7 +113,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vTy-kJ-ZF8" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3072" y="793"/>
<point key="canvasLocation" x="2901" y="793"/>
</scene>
<!--Milestone View Controller-->
<scene sceneID="f18-5Z-nm8">
@@ -114,7 +129,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1rW-Zv-Ixr" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2417" y="793"/>
<point key="canvasLocation" x="2003" y="1517"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="pYl-ZN-vsk">
@@ -127,8 +142,8 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="oTI-da-eDR" kind="relationship" relationship="viewControllers" id="Fb5-vw-YJJ"/>
<segue destination="dsf-nF-ec5" kind="relationship" relationship="viewControllers" id="U3N-hc-L3l"/>
<segue destination="Qvp-6m-CSb" kind="relationship" relationship="viewControllers" id="Fb5-vw-YJJ"/>
<segue destination="eWZ-ol-nCj" kind="relationship" relationship="viewControllers" id="U3N-hc-L3l"/>
<segue destination="g0q-18-mPP" kind="relationship" relationship="viewControllers" id="DK5-w3-R3k"/>
<segue destination="cxD-Kl-bEy" kind="relationship" relationship="viewControllers" id="HpJ-9s-VRl"/>
</connections>
@@ -154,7 +169,45 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="f25-i6-ILh" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1737.68115942029" y="792.85714285714278"/>
<point key="canvasLocation" x="2003" y="793"/>
</scene>
<!--이슈-->
<scene sceneID="MEh-c2-Sua">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Qvp-6m-CSb" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="이슈" image="exclamationmark.circle" catalog="system" id="goh-EH-LxE"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="xdp-e7-356">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="oTI-da-eDR" kind="relationship" relationship="rootViewController" id="zCG-iI-jnM"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="QwI-Yz-8CA" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="228.98550724637684" y="792.85714285714278"/>
</scene>
<!--레이블-->
<scene sceneID="8Wg-oP-tNJ">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="eWZ-ol-nCj" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="레이블" image="tag" catalog="system" id="icm-rA-6fv"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="S0T-lX-QCh">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="dsf-nF-ec5" kind="relationship" relationship="rootViewController" id="h5I-2M-chU"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IGN-HS-gnx" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1108.6956521739132" y="792.85714285714278"/>
</scene>
</scenes>
<resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// IssueTableFooterView.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/10.
//

import UIKit
import SnapKit

class IssueTableFooterView: UIView {

var label: UILabel = {
var label = UILabel()
label.text = "아래로 당기면 검색바가 보여요!👀"
label.textColor = .lightGray
return label
}()

override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = #colorLiteral(red: 0.9489405751, green: 0.9490727782, blue: 0.9685038924, alpha: 1)
addSubview(label)
setAutolayout()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
backgroundColor = #colorLiteral(red: 0.9489405751, green: 0.9490727782, blue: 0.9685038924, alpha: 1)
addSubview(label)
setAutolayout()
}

func setAutolayout() {
label.snp.makeConstraints { label in
label.centerX.equalToSuperview()
label.top.equalTo(39)
}
}

}
64 changes: 64 additions & 0 deletions iOS/issue-tracker/issue-tracker/Controller/IssueToolbar.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// IssueToolbar.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/11.
//

import UIKit

class IssueToolbar: UIToolbar {

let checkBoxBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.image = UIImage(systemName: "checkmark.circle")

return item
}()

let closeIssueBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.image = UIImage(systemName: "archivebox")
return item
}()

let labelBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem()
item.title = "이슈를 선택하세요"
item.isEnabled = false
return item
}()

let flexibleBarButtonItem: UIBarButtonItem = {
var item = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
return item
}()

override init(frame: CGRect) {
super.init(frame: frame)
setToolbar()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
setToolbar()
}

func setToolbar() {
let items = [checkBoxBarButtonItem, flexibleBarButtonItem, labelBarButtonItem, flexibleBarButtonItem, closeIssueBarButtonItem]
setItems(items, animated: false)

}

func setCheckMode(count: Int) {
checkBoxBarButtonItem.image = UIImage(systemName: "checkmark.circle")
labelBarButtonItem.title = "\(count)개의 이슈가 선택됨"
labelBarButtonItem.tintColor = .black
}

func setUncheckMode() {
checkBoxBarButtonItem.image = UIImage(systemName: "checkmark.circle.fill")
labelBarButtonItem.title = "이슈를 선택하세요"
labelBarButtonItem.tintColor = .lightGray
}
}
Original file line number Diff line number Diff line change
@@ -17,14 +17,26 @@ class LabelViewController: UIViewController {

@IBOutlet weak var labelTableView: UITableView!

lazy var tableHeaderView = LabelTabelHeaderView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 140))
var addLabelButton = AddLabelButton()

let fakeData = [Label(title: "hidsfadsfsafasfdfadsf", description: "hello", color: "#B1CAE5"), Label(title: "wow", description: "amazing", color: "#DFCD85")]

override func viewDidLoad() {
super.viewDidLoad()
setNavigationBar()
labelTableView.register(LabelTableViewCell.self, forCellReuseIdentifier: LabelTableViewCell.identifier)
labelTableView.dataSource = self
labelTableView.tableHeaderView = tableHeaderView
addLabelButton.addTarget(self, action: #selector(addLabelButtonTapped), for: .touchUpInside)
}

@objc func addLabelButtonTapped() {

}

func setNavigationBar() {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "레이블"
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: addLabelButton)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// AddIssueButton.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/11.
//

import UIKit

class AddIssueButton: UIView {

override init(frame: CGRect) {
super.init(frame: frame)
setButton()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
}

override func draw(_ rect: CGRect) {
let path = UIBezierPath()

path.move(to: CGPoint(x: self.bounds.width * 0.25, y: self.bounds.height * 0.5))
path.addLine(to: CGPoint(x: self.bounds.width * 0.75, y: self.bounds.height * 0.5))
path.move(to: CGPoint(x: self.bounds.width * 0.5, y: self.bounds.height * 0.25))
path.addLine(to: CGPoint(x: self.bounds.width * 0.5, y: self.bounds.height * 0.75))
UIColor.white.set()
path.stroke()
}

func setButton() {
clipsToBounds = true
layer.cornerRadius = self.bounds.size.width * 0.5
backgroundColor = .systemBlue

}
}
20 changes: 20 additions & 0 deletions iOS/issue-tracker/issue-tracker/View/IssueList/CancelButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// CancelButton.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/11.
//

import UIKit

class CancelButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
setTitle("취소", for: .normal)
setTitleColor(.systemBlue, for: .normal)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// FilterBarButtonView.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/10.
//

import UIKit

class FilterBarButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
setImage(UIImage(systemName: "doc.text.magnifyingglass"), for: .normal)
setTitle("필터", for: .normal)
setTitleColor(.systemBlue, for: .normal)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//
// LabelTableViewCell.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/09.
//

import UIKit
import SnapKit

class IssueTableViewCell: UITableViewCell {

static var identifier = "IssueTableViewCell"

var fakeData = [IssueLabel(title: "gdsfaewqeqwrqw2ewqweq", color: "#DFCD85"), IssueLabel(title: "gdsfa", color: "#DFCD85"), IssueLabel(title: "gdsfa", color: "#DFCD85"), IssueLabel(title: "gdsfaewqeqwrqw2ewqweq", color: "#DFCD85"), IssueLabel(title: "gdsfaewqeqwrqw2ewqweq", color: "#DFCD85")]

var largeTitle: UILabel = {
var label = UILabel()
label.font = UIFont.boldSystemFont(ofSize: 22)
return label
}()

var labelDescription: UILabel = {
var label = UILabel()
label.textColor = .lightGray
return label
}()

var milestoneView: MilestoneView = {
var milestone = MilestoneView()
return milestone
}()

var labelsCollectionView: LabelsCollectionView = {
var collectionView = LabelsCollectionView()
return collectionView
}()

var checkBoxImageView: UIImageView = {
var imageView = UIImageView()
imageView.image = UIImage(systemName: "checkmark.circle.fill")
return imageView
}()

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
labelsCollectionView.dataSource = self
addSubviews()
setAutolayout()
checkBoxImageView.isHidden = true
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func addSubviews() {
addSubview(labelsCollectionView)
addSubview(labelDescription)
addSubview(milestoneView)
addSubview(largeTitle)
addSubview(checkBoxImageView)
}

func setAutolayout() {
largeTitle.snp.makeConstraints { title in
title.top.equalTo(24)
title.leading.trailing.equalTo(16)
title.height.equalTo(28)
}

labelDescription.snp.makeConstraints { label in
label.top.equalTo(largeTitle.snp.bottom).offset(16)
label.leading.trailing.equalToSuperview().offset(16)
label.height.equalTo(22)
}

milestoneView.snp.makeConstraints { view in
view.top.equalTo(labelDescription.snp.bottom).offset(16)
view.leading.trailing.equalTo(16)
view.height.equalTo(22)
}

labelsCollectionView.snp.makeConstraints { view in
view.top.equalTo(milestoneView.snp.bottom).offset(16)
view.leading.trailing.equalToSuperview().inset(16)
view.bottom.equalToSuperview()
}

checkBoxImageView.snp.makeConstraints { image in
image.top.equalToSuperview().inset(24)
image.trailing.equalToSuperview().inset(16)
image.width.height.equalTo(30)
}


}

func setIssueCell(title: String, description: String, milestoneTitle: String, color: String) {
self.largeTitle.text = title
self.labelDescription.text = description
self.milestoneView.setMilestoneTitle(title: milestoneTitle)
}

func check() {
checkBoxImageView.isHidden = false
}

func uncheck() {
checkBoxImageView.isHidden = true
}
}

extension IssueTableViewCell: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return fakeData.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: LabelsCollectionViewCell.identifiers, for: indexPath) as? LabelsCollectionViewCell else { return UICollectionViewCell() }
cell.configure(title: fakeData[indexPath.item].title, color: fakeData[indexPath.item].color)
return cell
}


}

struct IssueLabel {
var title: String
var color: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// LabelsCollectionView.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/13.
//

import UIKit

class LabelsCollectionView: UICollectionView {

var labelsLayout: UICollectionViewFlowLayout = {
var layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.estimatedItemSize = CGSize(width: 84, height: 22)
layout.minimumLineSpacing = 10
layout.minimumInteritemSpacing = 10
return layout
}()

override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
super.init(frame: frame, collectionViewLayout: labelsLayout)
register(LabelsCollectionViewCell.self, forCellWithReuseIdentifier: LabelsCollectionViewCell.identifiers)
isScrollEnabled = false
backgroundColor = .white
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

}
56 changes: 56 additions & 0 deletions iOS/issue-tracker/issue-tracker/View/IssueList/MilestoneView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// MilestoneView.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/10.
//

import UIKit
import SnapKit

class MilestoneView: UIView {
var sfsymbolImageView: UIImageView = {
var imageView = UIImageView()
imageView.image = UIImage(named: "vector")
return imageView
}()

var milestoneTitle: UILabel = {
var label = UILabel()
label.textColor = .lightGray
return label
}()

override init(frame: CGRect) {
super.init(frame: frame)
addSubviews()
setAutolayout()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
addSubviews()
setAutolayout()
}

func addSubviews() {
addSubview(sfsymbolImageView)
addSubview(milestoneTitle)
}

func setAutolayout() {
sfsymbolImageView.snp.makeConstraints { imageView in
imageView.top.leading.bottom.equalToSuperview()
imageView.width.equalTo(sfsymbolImageView.snp.height).multipliedBy(1)
}
milestoneTitle.snp.makeConstraints { label in
label.top.bottom.equalToSuperview()
label.leading.equalTo(sfsymbolImageView.snp.trailing).offset(4)
label.width.greaterThanOrEqualTo(30)
}
}

func setMilestoneTitle(title: String) {
self.milestoneTitle.text = title
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// SelectBarButton.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/10.
//

import UIKit

class SelectBarButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
setImage(UIImage(systemName: "checkmark.circle"), for: .normal)
setTitle("선택", for: .normal)
setTitleColor(.systemBlue, for: .normal)
semanticContentAttribute = .forceRightToLeft
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
137 changes: 137 additions & 0 deletions iOS/issue-tracker/issue-tracker/View/IssueListViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
//
// IssueListViewController.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/10.
//

import UIKit
import SnapKit

class IssueListViewController: UIViewController {

@IBOutlet weak var issueTableView: UITableView!

let addIssueButton = AddIssueButton(frame: CGRect(x: 0, y: 0, width: 64, height: 64))
let filterBarButton = FilterBarButton()
let selectBarButton = SelectBarButton()
let cancelButton = CancelButton()
let issueToolbar = IssueToolbar(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
let searchController: UISearchController = {
var searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.setImage(UIImage(systemName: "mic.fill"), for: .bookmark, state: .normal)
searchController.searchBar.showsBookmarkButton = true
return searchController
}()

override func viewDidLoad() {
super.viewDidLoad()
setNavigationItem()
setIssueTableView()
setAddIssueButtonAutolayout()
filterBarButton.addTarget(self, action: #selector(filterButtonTapped), for: .touchUpInside)
selectBarButton.addTarget(self, action: #selector(selectButtonTapped), for: .touchUpInside)
addIssueButton.addGestureRecognizer(UIGestureRecognizer(target: self, action: #selector(addIssueButtonTapped)))
cancelButton.addTarget(self, action: #selector(cancelButtonTapped), for: .touchUpInside)
}

@objc func filterButtonTapped() {

}

@objc func selectButtonTapped() {
navigationItem.leftBarButtonItem = nil
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: cancelButton)
navigationItem.title = "이슈 선택"
navigationItem.searchController = nil
tabBarController?.tabBar.isHidden = true
view.addSubview(issueToolbar)
setToolbarAutoulayout()
}

@objc func addIssueButtonTapped() {


}

@objc func cancelButtonTapped() {
setNavigationItem()
tabBarController?.tabBar.isHidden = false
issueToolbar.removeFromSuperview()
}

func setAddIssueButtonAutolayout() {
view.addSubview(addIssueButton)
addIssueButton.snp.makeConstraints { button in
button.width.height.equalTo(64)
button.trailing.equalToSuperview().offset(-16)
button.bottom.equalToSuperview().offset(-100)
}
}

func setToolbarAutoulayout() {
issueToolbar.snp.makeConstraints { toolbar in
toolbar.leading.trailing.equalToSuperview()
toolbar.bottom.equalTo(view.safeAreaLayoutGuide)
toolbar.height.equalTo(44)
}
}

func setNavigationItem() {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "이슈"
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: filterBarButton)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: selectBarButton)
navigationItem.searchController = searchController
}

func setIssueTableView() {
issueTableView.register(IssueTableViewCell.self, forCellReuseIdentifier: IssueTableViewCell.identifier)
issueTableView.allowsMultipleSelection = true
issueTableView.dataSource = self
issueTableView.delegate = self
issueTableView.tableFooterView = IssueTableFooterView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 300))
}
}

extension IssueListViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: IssueTableViewCell.identifier) as? IssueTableViewCell else { return UITableViewCell() }
cell.setIssueCell(title: "제목", description: "이슈에 대한 설명", milestoneTitle: "마일스톤 이름", color: "#DFCD85")
return cell
}
}

extension IssueListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let cell = tableView.cellForRow(at: indexPath) as? IssueTableViewCell else { return }
cell.selectionStyle = .none
cell.check()

}

func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
guard let cell = tableView.cellForRow(at: indexPath) as? IssueTableViewCell else { return }
cell.uncheck()
}

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .destructive, title: "삭제") { ac, view, success in
success(true)
}

let shareAction = UIContextualAction(style: .normal, title: "닫기") { ac, view, success in
success(true)
}

deleteAction.image = UIImage(systemName: "trash")
shareAction.image = UIImage(systemName: "archivebox")
shareAction.backgroundColor = #colorLiteral(red: 0.7988751531, green: 0.8300203681, blue: 0.9990373254, alpha: 1)

return UISwipeActionsConfiguration(actions: [shareAction, deleteAction])
}
}
56 changes: 0 additions & 56 deletions iOS/issue-tracker/issue-tracker/View/Label/AddButton.swift

This file was deleted.

22 changes: 22 additions & 0 deletions iOS/issue-tracker/issue-tracker/View/Label/AddLabelButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// AddLabelButton.swift
// issue-tracker
//
// Created by 양준혁 on 2021/06/13.
//

import UIKit

class AddLabelButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
setImage(UIImage(systemName: "plus"), for: .normal)
setTitle("추가", for: .normal)
setTitleColor(.systemBlue, for: .normal)
semanticContentAttribute = .forceRightToLeft
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

This file was deleted.

0 comments on commit ae818e3

Please sign in to comment.