Skip to content
This repository was archived by the owner on Feb 27, 2019. It is now read-only.

Commit ed3fd23

Browse files
committed
More features
- favorite - user's theme color - Touch ID - etc.
1 parent b94cbc6 commit ed3fd23

File tree

83 files changed

+4349
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4349
-858
lines changed

Podfile.lock

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,68 @@
11
PODS:
2+
- AFNetworking (2.6.3):
3+
- AFNetworking/NSURLConnection (= 2.6.3)
4+
- AFNetworking/NSURLSession (= 2.6.3)
5+
- AFNetworking/Reachability (= 2.6.3)
6+
- AFNetworking/Security (= 2.6.3)
7+
- AFNetworking/Serialization (= 2.6.3)
8+
- AFNetworking/UIKit (= 2.6.3)
9+
- AFNetworking/NSURLConnection (2.6.3):
10+
- AFNetworking/Reachability
11+
- AFNetworking/Security
12+
- AFNetworking/Serialization
13+
- AFNetworking/NSURLSession (2.6.3):
14+
- AFNetworking/Reachability
15+
- AFNetworking/Security
16+
- AFNetworking/Serialization
17+
- AFNetworking/Reachability (2.6.3)
18+
- AFNetworking/Security (2.6.3)
19+
- AFNetworking/Serialization (2.6.3)
20+
- AFNetworking/UIKit (2.6.3):
21+
- AFNetworking/NSURLConnection
22+
- AFNetworking/NSURLSession
223
- Alamofire (3.3.1)
324
- GearRefreshControl (0.3.0)
25+
- HappyDNS (0.2.3)
426
- Kingfisher (1.9.3)
27+
- KYNavigationProgress (1.0.0)
28+
- Qiniu (7.0.17):
29+
- AFNetworking (~> 2.0)
30+
- HappyDNS (~> 0.2)
531
- SnapKit (0.20.0)
32+
- SwiftColorPicker (0.0.5)
633
- SwiftyJSON (2.3.2)
734

835
DEPENDENCIES:
936
- Alamofire (~> 3.3)
1037
- GearRefreshControl (~> 0.3)
1138
- Kingfisher (~> 1.6)
39+
- KYNavigationProgress
40+
- Qiniu (~> 7.0)
1241
- SnapKit
13-
- SwiftyJSON (from `https://github.com/SwiftyJSON/SwiftyJSON.git`)
42+
- SwiftColorPicker (from `https://github.com/MrMatthias/SwiftColorPicker`, commit
43+
`47611ac2adf323a3f92c875fb2f8f7feb459f80c`)
44+
- SwiftyJSON
1445

1546
EXTERNAL SOURCES:
16-
SwiftyJSON:
17-
:git: https://github.com/SwiftyJSON/SwiftyJSON.git
47+
SwiftColorPicker:
48+
:commit: 47611ac2adf323a3f92c875fb2f8f7feb459f80c
49+
:git: https://github.com/MrMatthias/SwiftColorPicker
1850

1951
CHECKOUT OPTIONS:
20-
SwiftyJSON:
21-
:commit: 2a5b70f06001316d4fb54501edc70b4084705da0
22-
:git: https://github.com/SwiftyJSON/SwiftyJSON.git
52+
SwiftColorPicker:
53+
:commit: 47611ac2adf323a3f92c875fb2f8f7feb459f80c
54+
:git: https://github.com/MrMatthias/SwiftColorPicker
2355

2456
SPEC CHECKSUMS:
57+
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
2558
Alamofire: 369bc67b6f5ac33ded3648d7bd21c5bfb91c2ecc
2659
GearRefreshControl: c7b1abac8a298f180df48c1bc450469e98840c46
60+
HappyDNS: 6d85942e64c28b4fa61f8c76580398f52d6d1d11
2761
Kingfisher: 9e37d2a78a082dc123bfe8a16de65de85518daae
62+
KYNavigationProgress: 98df05cf12545f7c2a74570b2b23770dac4551a6
63+
Qiniu: 2c05af1f9d580c036b18faf832cc98e98bfb21bc
2864
SnapKit: 5fce3c1bbbf1fbd31de9aa92f33eb9fa03f15650
65+
SwiftColorPicker: aee0bb6991feb70f675c6ee5c91a55164ed128d7
2966
SwiftyJSON: 04ccea08915aa0109039157c7974cf0298da292a
3067

3168
COCOAPODS: 0.39.0

iBBS.xcodeproj/project.pbxproj

Lines changed: 202 additions & 25 deletions
Large diffs are not rendered by default.
Binary file not shown.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
//
2+
// AlertController.swift
3+
//
4+
// Created by Augus on 2/3/16.
5+
// Copyright © 2016 iAugus. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
11+
class AlertController {
12+
13+
private static let ok = NSLocalizedString("OK", comment: "")
14+
private static let cancel = NSLocalizedString("Cancel", comment: "")
15+
16+
class func alert(title title: String = "", message: String = "", actionTitle: String = ok, completionHandler: (() -> Void)?) {
17+
AlertController.alert(title: title, message: message, actionTitle: actionTitle, addCancelAction: (false, nil), completionHandler: completionHandler, canceledHandler: nil)
18+
}
19+
20+
class func alertWithCancelAction(title title: String = "", message: String = "", actionTitle: String = ok, cancelTitle: String = cancel, completionHandler: (() -> Void)?, canceledHandler: (() -> Void)?) {
21+
AlertController.alert(title: title, message: message, actionTitle: actionTitle, addCancelAction: (true, cancelTitle), completionHandler: completionHandler, canceledHandler: canceledHandler)
22+
}
23+
24+
class func multiAlertsWithOptions(multiItemsOfInfo: [String], completionHandler: (() -> Void)?) {
25+
alertWithOptions(multiItemsOfInfo, completionHandler: completionHandler)
26+
}
27+
28+
private class func alert(title title: String = "", message: String = "", actionTitle: String = ok, addCancelAction: (add: Bool, title: String?), completionHandler: (() -> Void)?, canceledHandler: (() -> Void)?) {
29+
let okAction = UIAlertAction(title: actionTitle, style: .Default) { (_) -> Void in
30+
if let completion = completionHandler {
31+
completion()
32+
}
33+
}
34+
35+
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
36+
37+
if addCancelAction.add {
38+
let cancelAction = UIAlertAction(title: addCancelAction.title, style: .Cancel) { (_) -> Void in
39+
if let handler = canceledHandler {
40+
handler()
41+
}
42+
}
43+
44+
alertController.addAction(cancelAction)
45+
}
46+
47+
alertController.addAction(okAction)
48+
49+
UIApplication.topMostViewController?.presentViewController(alertController, animated: true, completion: nil)
50+
}
51+
52+
private class func alertWithOptions(multiItemsOfInfo: [String], completionHandler: (() -> Void)?) {
53+
dispatch_async(dispatch_get_main_queue()) { () -> Void in
54+
55+
var tempInfoArray = multiItemsOfInfo
56+
57+
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: { (_) -> Void in
58+
tempInfoArray.removeAll()
59+
})
60+
61+
let okAction = UIAlertAction(title: "OK", style: .Default, handler: { (_) -> Void in
62+
63+
tempInfoArray.removeFirst()
64+
65+
if tempInfoArray.count == 0 {
66+
if let completion = completionHandler {
67+
completion()
68+
}
69+
}
70+
71+
self.alertWithOptions(tempInfoArray, completionHandler: {
72+
if let completion = completionHandler {
73+
completion()
74+
}
75+
})
76+
77+
})
78+
guard tempInfoArray.count > 0 else { return }
79+
80+
let alertController = UIAlertController(title: nil, message: tempInfoArray.first, preferredStyle: .Alert)
81+
alertController.addAction(cancelAction)
82+
alertController.addAction(okAction)
83+
UIApplication.topMostViewController?.presentViewController(alertController, animated: true, completion: nil)
84+
}
85+
}
86+
87+
88+
}
89+
90+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
//
2+
// NSUserDefaults+Extension.swift
3+
//
4+
// Created by Augus on 2/15/16.
5+
// Copyright © 2016 iAugus. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
11+
extension NSUserDefaults {
12+
13+
func getBool(key: String, defaultKeyValue: Bool) -> Bool {
14+
if valueForKey(key) == nil {
15+
setBool(defaultKeyValue, forKey: key)
16+
synchronize()
17+
}
18+
return boolForKey(key)
19+
}
20+
}
21+
22+
extension NSUserDefaults {
23+
24+
func getInteger(key: String, defaultKeyValue: Int) -> Int {
25+
if valueForKey(key) == nil {
26+
setInteger(defaultKeyValue, forKey: key)
27+
synchronize()
28+
}
29+
return integerForKey(key)
30+
}
31+
}
32+
33+
extension NSUserDefaults {
34+
35+
func getDouble(key: String, defaultKeyValue: Double) -> Double {
36+
if valueForKey(key) == nil {
37+
setDouble(defaultKeyValue, forKey: key)
38+
synchronize()
39+
}
40+
return doubleForKey(key)
41+
}
42+
}
43+
44+
extension NSUserDefaults {
45+
46+
func getObject(key: String, defaultkeyValue: AnyObject) -> AnyObject? {
47+
if objectForKey(key) == nil {
48+
setObject(defaultkeyValue, forKey: key)
49+
synchronize()
50+
}
51+
return objectForKey(key)
52+
}
53+
}
54+
55+
56+
// MARK: -
57+
58+
extension NSUserDefaults {
59+
60+
func colorForKey(key: String) -> UIColor? {
61+
var color: UIColor?
62+
if let colorData = dataForKey(key) {
63+
color = NSKeyedUnarchiver.unarchiveObjectWithData(colorData) as? UIColor
64+
}
65+
return color
66+
}
67+
68+
func setColor(color: UIColor?, forKey key: String) {
69+
var colorData: NSData?
70+
if let color = color {
71+
colorData = NSKeyedArchiver.archivedDataWithRootObject(color)
72+
}
73+
setObject(colorData, forKey: key)
74+
}
75+
}
76+
77+
extension NSUserDefaults {
78+
79+
func setArchivedData(object: AnyObject?, forKey key: String) {
80+
var data: NSData?
81+
if let object = object {
82+
data = NSKeyedArchiver.archivedDataWithRootObject(object)
83+
}
84+
setObject(data, forKey: key)
85+
}
86+
87+
func unarchiveObjectWithDataForKey(key: String) -> AnyObject? {
88+
guard let object = objectForKey(key) else { return nil }
89+
guard let data = object as? NSData else { return nil }
90+
return NSKeyedUnarchiver.unarchiveObjectWithData(data)
91+
}
92+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// UIButton+Extension.swift
3+
//
4+
// Created by Augus on 2/6/16.
5+
// Copyright © 2016 iAugus. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
11+
12+
extension UIButton {
13+
14+
15+
override public func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
16+
17+
let minimalWidthAndHeight: CGFloat = 60
18+
19+
let buttonSize = frame.size
20+
let widthToAdd = (minimalWidthAndHeight - buttonSize.width > 0) ? minimalWidthAndHeight - buttonSize.width : 0
21+
let heightToAdd = (minimalWidthAndHeight - buttonSize.height > 0) ? minimalWidthAndHeight - buttonSize.height : 0
22+
let largerFrame = CGRect(x: 0-(widthToAdd / 2), y: 0-(heightToAdd / 2), width: buttonSize.width + widthToAdd, height: buttonSize.height + heightToAdd)
23+
return CGRectContainsPoint(largerFrame, point) ? self : nil
24+
}
25+
26+
}

iBBS/Additions/UIImageView+Additions.swift

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// UIImageView+Extension.swift
3+
//
4+
// Created by Augus on 10/11/15.
5+
// Copyright © 2015 iAugus. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
11+
extension UIImageView {
12+
13+
func changeImageColor(tintColor: UIColor) {
14+
self.image = self.image?.imageWithRenderingMode(.AlwaysTemplate)
15+
self.tintColor = tintColor
16+
}
17+
18+
func changeImageWithAnimation(name: String, duration: NSTimeInterval = 1.0, animation: Bool = true) {
19+
20+
let img = UIImage(named: name)
21+
_changeImageWithAnimation(img, duration: duration, animation: animation)
22+
}
23+
24+
func _changeImageWithAnimation(img: UIImage?, duration: NSTimeInterval = 1.0, animation: Bool = true) {
25+
26+
if animation {
27+
let transition = CATransition()
28+
transition.duration = duration
29+
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
30+
transition.type = kCATransitionFade
31+
layer.addAnimation(transition, forKey: nil)
32+
}
33+
34+
// change image now
35+
image = img
36+
}
37+
38+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// UIStoryboard+Extension.swift
3+
//
4+
// Created by Augus on 4/30/16.
5+
// Copyright © 2016 iAugus. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
11+
extension UIStoryboard {
12+
13+
static var Main: UIStoryboard {
14+
return UIStoryboard(name: "Main", bundle: nil)
15+
}
16+
17+
class var SlidePanel: UIStoryboard {
18+
return UIStoryboard(name: "SlidePanel", bundle: nil)
19+
}
20+
21+
class var User: UIStoryboard {
22+
return UIStoryboard(name: "User", bundle: nil)
23+
}
24+
}

iBBS/Additions/Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public typealias CompletionHandler = () -> ()
1414

1515
class Utils {
1616

17-
class func documentPath() -> String {
17+
class var documentPath: String {
1818
return NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first!
1919
}
2020

0 commit comments

Comments
 (0)