Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
69 changes: 69 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
included:
- ${TARGET_NAME}

analyzer_rules:
- unused_import
- unused_private_declaration

disabled_rules:
- identifier_name
- todo
- force_cast
- literal_expression_end_indentation
- closure_end_indentation
- file_header
- empty_count
- line_length
- trailing_whitespace
- private_outlet

opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- contains_over_first_not_nil
- empty_count
- empty_string
- empty_xctest_method
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- file_name
- first_where
- identical_operands
- joined_default_parameter
- let_var_whitespace
- literal_expression_end_indentation
- lower_acl_than_parent
- nimble_operator
- number_separator
- object_literal
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prohibited_interface_builder
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- sorted_imports
- unavailable_function
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- yoda_condition

excluded:
- Carthage
- Pods
- Generated/
113 changes: 87 additions & 26 deletions DanBee_iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>DanBee_iOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion DanBee_iOS/Extension/UIButton+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import Foundation
import UIKit

extension UIButton {
// Review: [Refactroing] extension UIButton awakeFromNib() 는 xib 에서만 적용됩니다.
// BackgroundColor 를 적용하는 것이 좋습니다.
// https://github.com/kimtaesu/MediaSearch/blob/master/MediaSearch/ViewStyle%2BUILabel.swift
override open func awakeFromNib() {
self.layer.cornerRadius = 8

//일반 텍스트버튼은 적용안함
if self.tag == 10 {
if self.tag != 10 {
self.backgroundColor = UIColor.danbeeColor1
}
}
Expand Down
2 changes: 2 additions & 0 deletions DanBee_iOS/Extension/UIViewController+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import UIKit

extension UIViewController {
func simpleAlert(title: String, msg: String) {
// Review: [Refactoring] UIAlertController 코드의 중복이 보입니다.
// UIAlertController 객체를 만들어주는 Factory 로 제공하는 것이 좋아보입니다!
let alert = UIAlertController(title: title, message: msg, preferredStyle: .alert)
let okAction = UIAlertAction(title: "확인",style: .cancel, handler: nil)
alert.addAction(okAction)
Expand Down
96 changes: 47 additions & 49 deletions DanBee_iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>QR코드인식을위해 권한이필요합니다</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
<dict>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>거부할 시 앱사용에 지장이 있을 수 있습니다.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
1 change: 0 additions & 1 deletion DanBee_iOS/Model/DanBeeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ struct DanBeeAPI {
static let historyURL = homeURL + "history/user/"
static let noticeURL = homeURL + "notice/list"
static let questionURL = homeURL + "question/list"
static let lendURL = homeURL + "kick/lend/"
}
2 changes: 2 additions & 0 deletions DanBee_iOS/Model/History.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct History {

//사용시간 연산
mutating func useTimeFormatter() -> String {
// Review: [Refactoring] DateFormatter의 코드에 중복이 보입니다.
// 별도의 Util class로 만들어서 날짜 데이터를 제공하는 것이 좋을 것 같습니다!
let format = DateFormatter()
format.dateFormat = "yyyy-MM-dd HH:mm:ss"

Expand Down
1 change: 1 addition & 0 deletions DanBee_iOS/Model/Notice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct Notice{
let content: String
var open = false

// Review: [Refactoring] mutating 키워드는 불필요 보입니다!
mutating func dateFormat() -> String{
guard let s = self.date.split(separator: " ").first else {return "??"}

Expand Down
9 changes: 9 additions & 0 deletions DanBee_iOS/Model/UserInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Foundation
class UserInfo{
static let shared = UserInfo()

// Review: [Refactoring] UserDefaults로 부터 값을 가져오는 것이 좋지 않을까요?
// class 는 Call By Reference 이기 때문에 thread safe 하지 않습니다.
var userid = String()
var name: String?
var phone: String?
Expand All @@ -20,8 +22,15 @@ class UserInfo{
var time: String?

func logout(){
// Review: [Refactoring] UserDefaults 내에 값을 Clear 해야 한다면...
/*
for key in UserDefaults.standard.dictionaryRepresentation().keys {
UserDefaults.standard.removeObject(forKey: key)
}
*/
UserDefaults.standard.removeObject(forKey: "id")
UserDefaults.standard.removeObject(forKey: "pw")

self.userid = ""
self.name = ""
self.phone = ""
Expand Down
18 changes: 15 additions & 3 deletions DanBee_iOS/Service/SignUpService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ import Alamofire
import SwiftyJSON

struct SignUpService {
// Review: [Refactoring] Static 이면서 일반 객체로 생성이 가능합니다.
// private init() {}
static let shared = SignUpService()

let header: HTTPHeaders = [
"Content-Type" : "application/json"
]


// Review: [Refactroing] Parameter 가 너무 많습니다.
// struct 으로 request 객체를 만드는 것이 좋습니다.
// http://minsone.github.io/mac/ios/how-to-make-json-data-using-mirror-in-swift2
// Swift의 Mirror를 활용하면 객체 -> Dictionary 형태로 만들 수 있습니다.
func getSignUpResult(userid: String, pw: String, phone: String, gender: Int, birth: String, name: String, completion: @escaping (_ b: Bool) -> Void) {

let body: Parameters = [
"userid": userid,
"pw": pw,
Expand All @@ -35,12 +40,19 @@ struct SignUpService {
case .success(let value):
let json = JSON(value)
let result = json["result"].intValue
// Review: [Refactoring] result 777 상수의 의미는...??
// Type을 갖는 형태로 관리하는 것이 Refactoring 에 좋아보입니다.
/*
enum ResultCode: Int {
case tripleSeven = 777
}
*/
if result == 777 {
completion(true)
}else {
completion(false)
}
// Review: [사용성] 실패했을 때 처리가 없습니다.
default:
return
}
Expand Down
Loading