Skip to content

Commit

Permalink
Merge pull request #10 from GO-SOPT-iOS-Part/3rdWeek
Browse files Browse the repository at this point in the history
3주차 세미나
  • Loading branch information
ena-isme authored Aug 1, 2023
2 parents 38a0e03 + 61dd95a commit 370e578
Show file tree
Hide file tree
Showing 15 changed files with 587 additions and 0 deletions.
36 changes: 36 additions & 0 deletions 3rdWeek/Seminar/Seminar/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions 3rdWeek/Seminar/Seminar/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "스크린샷 2023-08-01 오후 2.53.09.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions 3rdWeek/Seminar/Seminar/BaseView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// BaseView.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit

class BaseView: UIView {

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

setStyle()
setLayout()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setStyle() {}
func setLayout() {}
}
58 changes: 58 additions & 0 deletions 3rdWeek/Seminar/Seminar/BaseViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// BaseViewController.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit

class BaseViewController: UIViewController {

// MARK: Properties

lazy private(set) var className: String = {
return type(of: self).description().components(separatedBy: ".").last ?? ""
}()

// MARK: Initializing

override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nil, bundle: nil)
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

deinit {
print("DEINIT: \(className)")
}

// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()

setStyle()
setLayout()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

navigationController?.setNavigationBarHidden(true, animated: true)
}

// MARK: UI

/// Attributes (속성) 설정 메서드
func setStyle() {

view.backgroundColor = .white
}

/// Hierarchy, Constraints (계층 및 제약조건) 설정 메서드
func setLayout() {}

}
64 changes: 64 additions & 0 deletions 3rdWeek/Seminar/Seminar/CarrotData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// CarrotData.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit

extension Carrot {

static func dummy() -> [Carrot] {
return [Carrot(image: .princess,
product: "에어팟 프로 2",
place: "하계 2동",
time: "일주일 전",
tradeStatus: .completed,
price: 200000),
Carrot(image: .princess,
product:
"아이폰 11 Pro",
place: "하계 3동",
time: "4월 2일",
tradeStatus: .reservation,
price: 100000),
Carrot(image: .princess,
product:
"에어팟 맥스",
place: "공릉 2동",
time: "1일 전",
tradeStatus: .shared,
price: 100000),
Carrot(image: .princess,
product:
"아이패드1",
place: "공릉 1동",
time: "6시간 전",
tradeStatus: .completed,
price: 100000),
Carrot(image: .princess,
product:
"아이패드 2",
place: "중계 2동",
time: "3시간 전",
tradeStatus: .clear,
price: 100000)
,
Carrot(image: .princess,
product:
"안팔아요",
place: "중계 2동",
time: "4월 3일",
tradeStatus: .completed,
price: 10000)
,
Carrot(image: .princess,
product:
"아이폰 14 Pro",
place: "중계 2동",
time: "3월 31일",
tradeStatus: .reservation,
price: 1000)]
}
}
51 changes: 51 additions & 0 deletions 3rdWeek/Seminar/Seminar/CarrotEnum.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// CarrotEnum.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit

struct Carrot {
let image: UIImage
let product: String
let place: String
let time: String
let tradeStatus: Trade
let price: Int
}

@frozen
enum Trade {
case reservation
case completed
case shared
case clear

var title: String {
switch self {
case .reservation:
return "예약중"
case .completed:
return "거래완료"
case .shared:
return "나눔완료"
case .clear:
return "거래중"
}
}

var backgroundColor: UIColor {
switch self {
case .reservation:
return .gray
case .completed:
return .black
case .shared:
return .black
case .clear:
return .systemGreen
}
}
}
14 changes: 14 additions & 0 deletions 3rdWeek/Seminar/Seminar/CarrotImage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// CarrotImage.swift
// Seminar
//
// Created by 신지원 on 2023/08/01.
//

import UIKit.UIImage

extension UIImage {

static var princess: UIImage { UIImage(named: "princess")! }

}
Loading

0 comments on commit 370e578

Please sign in to comment.