Skip to content

Commit a0fb2f8

Browse files
committed
added Rambafiles + Classes
1 parent 5a12311 commit a0fb2f8

26 files changed

+1370
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
5+
</dependencies>
6+
<scenes/>
7+
</document>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// CoinsCoinsViewController.swift
3+
// MinterWallet
4+
//
5+
// Created by Alexey Sidorov on 02/04/2018.
6+
// Copyright © 2018 Minter. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class CoinsViewController: UIViewController {
12+
13+
var viewModel = CoinsViewModel()
14+
15+
// MARK: Life cycle
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
}
19+
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// CoinsCoinsViewModel.swift
3+
// MinterWallet
4+
//
5+
// Created by Alexey Sidorov on 02/04/2018.
6+
// Copyright © 2018 Minter. All rights reserved.
7+
//
8+
9+
import RxSwift
10+
11+
class CoinsViewModel: BaseViewModel {
12+
13+
var title: String {
14+
get {
15+
return "Coins".localized()
16+
}
17+
}
18+
19+
override init() {
20+
super.init()
21+
22+
}
23+
}
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
//
2+
// Autogenerated by Natalie - Storyboard Generator
3+
// by Marcin Krzyzanowski http://krzyzanowskim.com
4+
//
5+
import UIKit
6+
7+
// MARK: - Storyboards
8+
9+
extension UIStoryboard {
10+
func instantiateViewController<T: UIViewController>(ofType type: T.Type) -> T? where T: IdentifiableProtocol {
11+
let instance = type.init()
12+
if let identifier = instance.storyboardIdentifier {
13+
return self.instantiateViewController(withIdentifier: identifier) as? T
14+
}
15+
return nil
16+
}
17+
18+
}
19+
20+
protocol Storyboard {
21+
static var storyboard: UIStoryboard { get }
22+
static var identifier: String { get }
23+
}
24+
25+
struct Storyboards {
26+
27+
struct Login: Storyboard {
28+
29+
static let identifier = "Login"
30+
31+
static var storyboard: UIStoryboard {
32+
return UIStoryboard(name: self.identifier, bundle: nil)
33+
}
34+
35+
static func instantiateViewController(withIdentifier identifier: String) -> UIViewController {
36+
return self.storyboard.instantiateViewController(withIdentifier: identifier)
37+
}
38+
39+
static func instantiateViewController<T: UIViewController>(ofType type: T.Type) -> T? where T: IdentifiableProtocol {
40+
return self.storyboard.instantiateViewController(ofType: type)
41+
}
42+
43+
static func instantiateLoginViewController() -> LoginViewController {
44+
return self.storyboard.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController
45+
}
46+
}
47+
48+
struct LaunchScreen: Storyboard {
49+
50+
static let identifier = "LaunchScreen"
51+
52+
static var storyboard: UIStoryboard {
53+
return UIStoryboard(name: self.identifier, bundle: nil)
54+
}
55+
56+
static func instantiateInitialViewController() -> UIViewController {
57+
return self.storyboard.instantiateInitialViewController()!
58+
}
59+
60+
static func instantiateViewController(withIdentifier identifier: String) -> UIViewController {
61+
return self.storyboard.instantiateViewController(withIdentifier: identifier)
62+
}
63+
64+
static func instantiateViewController<T: UIViewController>(ofType type: T.Type) -> T? where T: IdentifiableProtocol {
65+
return self.storyboard.instantiateViewController(ofType: type)
66+
}
67+
}
68+
69+
struct Main: Storyboard {
70+
71+
static let identifier = "Main"
72+
73+
static var storyboard: UIStoryboard {
74+
return UIStoryboard(name: self.identifier, bundle: nil)
75+
}
76+
77+
static func instantiateInitialViewController() -> UITabBarController {
78+
return self.storyboard.instantiateInitialViewController() as! UITabBarController
79+
}
80+
81+
static func instantiateViewController(withIdentifier identifier: String) -> UIViewController {
82+
return self.storyboard.instantiateViewController(withIdentifier: identifier)
83+
}
84+
85+
static func instantiateViewController<T: UIViewController>(ofType type: T.Type) -> T? where T: IdentifiableProtocol {
86+
return self.storyboard.instantiateViewController(ofType: type)
87+
}
88+
}
89+
}
90+
91+
// MARK: - ReusableKind
92+
enum ReusableKind: String, CustomStringConvertible {
93+
case tableViewCell = "tableViewCell"
94+
case collectionViewCell = "collectionViewCell"
95+
96+
var description: String { return self.rawValue }
97+
}
98+
99+
// MARK: - SegueKind
100+
enum SegueKind: String, CustomStringConvertible {
101+
case relationship = "relationship"
102+
case show = "show"
103+
case presentation = "presentation"
104+
case embed = "embed"
105+
case unwind = "unwind"
106+
case push = "push"
107+
case modal = "modal"
108+
case popover = "popover"
109+
case replace = "replace"
110+
case custom = "custom"
111+
112+
var description: String { return self.rawValue }
113+
}
114+
115+
// MARK: - IdentifiableProtocol
116+
117+
public protocol IdentifiableProtocol: Equatable {
118+
var storyboardIdentifier: String? { get }
119+
}
120+
121+
// MARK: - SegueProtocol
122+
123+
public protocol SegueProtocol {
124+
var identifier: String? { get }
125+
}
126+
127+
public func ==<T: SegueProtocol, U: SegueProtocol>(lhs: T, rhs: U) -> Bool {
128+
return lhs.identifier == rhs.identifier
129+
}
130+
131+
public func ~=<T: SegueProtocol, U: SegueProtocol>(lhs: T, rhs: U) -> Bool {
132+
return lhs.identifier == rhs.identifier
133+
}
134+
135+
public func ==<T: SegueProtocol>(lhs: T, rhs: String) -> Bool {
136+
return lhs.identifier == rhs
137+
}
138+
139+
public func ~=<T: SegueProtocol>(lhs: T, rhs: String) -> Bool {
140+
return lhs.identifier == rhs
141+
}
142+
143+
public func ==<T: SegueProtocol>(lhs: String, rhs: T) -> Bool {
144+
return lhs == rhs.identifier
145+
}
146+
147+
public func ~=<T: SegueProtocol>(lhs: String, rhs: T) -> Bool {
148+
return lhs == rhs.identifier
149+
}
150+
151+
// MARK: - ReusableViewProtocol
152+
public protocol ReusableViewProtocol: IdentifiableProtocol {
153+
var viewType: UIView.Type? { get }
154+
}
155+
156+
public func ==<T: ReusableViewProtocol, U: ReusableViewProtocol>(lhs: T, rhs: U) -> Bool {
157+
return lhs.storyboardIdentifier == rhs.storyboardIdentifier
158+
}
159+
160+
// MARK: - Protocol Implementation
161+
extension UIStoryboardSegue: SegueProtocol {
162+
}
163+
164+
extension UICollectionReusableView: ReusableViewProtocol {
165+
public var viewType: UIView.Type? { return type(of: self) }
166+
public var storyboardIdentifier: String? { return self.reuseIdentifier }
167+
}
168+
169+
extension UITableViewCell: ReusableViewProtocol {
170+
public var viewType: UIView.Type? { return type(of: self) }
171+
public var storyboardIdentifier: String? { return self.reuseIdentifier }
172+
}
173+
174+
// MARK: - UIViewController extension
175+
extension UIViewController {
176+
func perform<T: SegueProtocol>(segue: T, sender: Any?) {
177+
if let identifier = segue.identifier {
178+
performSegue(withIdentifier: identifier, sender: sender)
179+
}
180+
}
181+
182+
func perform<T: SegueProtocol>(segue: T) {
183+
perform(segue: segue, sender: nil)
184+
}
185+
}
186+
// MARK: - UICollectionView
187+
188+
extension UICollectionView {
189+
190+
func dequeue<T: ReusableViewProtocol>(reusable: T, for: IndexPath) -> UICollectionViewCell? {
191+
if let identifier = reusable.storyboardIdentifier {
192+
return dequeueReusableCell(withReuseIdentifier: identifier, for: `for`)
193+
}
194+
return nil
195+
}
196+
197+
func register<T: ReusableViewProtocol>(reusable: T) {
198+
if let type = reusable.viewType, let identifier = reusable.storyboardIdentifier {
199+
register(type, forCellWithReuseIdentifier: identifier)
200+
}
201+
}
202+
203+
func dequeueReusableSupplementaryViewOfKind<T: ReusableViewProtocol>(elementKind: String, withReusable reusable: T, for: IndexPath) -> UICollectionReusableView? {
204+
if let identifier = reusable.storyboardIdentifier {
205+
return dequeueReusableSupplementaryView(ofKind: elementKind, withReuseIdentifier: identifier, for: `for`)
206+
}
207+
return nil
208+
}
209+
210+
func register<T: ReusableViewProtocol>(reusable: T, forSupplementaryViewOfKind elementKind: String) {
211+
if let type = reusable.viewType, let identifier = reusable.storyboardIdentifier {
212+
register(type, forSupplementaryViewOfKind: elementKind, withReuseIdentifier: identifier)
213+
}
214+
}
215+
}
216+
// MARK: - UITableView
217+
218+
extension UITableView {
219+
220+
func dequeue<T: ReusableViewProtocol>(reusable: T, for: IndexPath) -> UITableViewCell? {
221+
if let identifier = reusable.storyboardIdentifier {
222+
return dequeueReusableCell(withIdentifier: identifier, for: `for`)
223+
}
224+
return nil
225+
}
226+
227+
func register<T: ReusableViewProtocol>(reusable: T) {
228+
if let type = reusable.viewType, let identifier = reusable.storyboardIdentifier {
229+
register(type, forCellReuseIdentifier: identifier)
230+
}
231+
}
232+
233+
func dequeueReusableHeaderFooter<T: ReusableViewProtocol>(_ reusable: T) -> UITableViewHeaderFooterView? {
234+
if let identifier = reusable.storyboardIdentifier {
235+
return dequeueReusableHeaderFooterView(withIdentifier: identifier)
236+
}
237+
return nil
238+
}
239+
240+
func registerReusableHeaderFooter<T: ReusableViewProtocol>(_ reusable: T) {
241+
if let type = reusable.viewType, let identifier = reusable.storyboardIdentifier {
242+
register(type, forHeaderFooterViewReuseIdentifier: identifier)
243+
}
244+
}
245+
}
246+
247+
// MARK: - LoginViewController
248+
protocol LoginViewControllerIdentifiableProtocol: IdentifiableProtocol { }
249+
250+
extension LoginViewController: LoginViewControllerIdentifiableProtocol { }
251+
252+
extension IdentifiableProtocol where Self: LoginViewController {
253+
var storyboardIdentifier: String? { return "LoginViewController" }
254+
static var storyboardIdentifier: String? { return "LoginViewController" }
255+
}
256+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// String+Localized.swift
3+
// MinterWallet
4+
//
5+
// Created by Alexey Sidorov on 02/04/2018.
6+
// Copyright © 2018 Minter. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension String {
12+
func localized(_ comment: String = "") -> String {
13+
return NSLocalizedString(self, comment: comment)
14+
}
15+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// UIColor+HEX.swift
3+
// MinterWallet
4+
//
5+
// Created by Alexey Sidorov on 02/04/2018.
6+
// Copyright © 2018 Minter. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
extension UIColor {
12+
13+
convenience init?(hex: UInt) {
14+
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
15+
let green = CGFloat((hex & 0x00FF00) >> 8) / 255.0
16+
let blue = CGFloat(hex & 0x0000FF) / 255.0
17+
18+
self.init(red: red, green: green, blue: blue, alpha: 1)
19+
}
20+
21+
convenience init?(hex: UInt, alpha: CGFloat) {
22+
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
23+
let green = CGFloat((hex & 0x00FF00) >> 8) / 255.0
24+
let blue = CGFloat(hex & 0x0000FF) / 255.0
25+
26+
self.init(red: red, green: green, blue: blue, alpha: alpha)
27+
}
28+
29+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// UIFont+Default.swift
3+
// MinterWallet
4+
//
5+
// Created by Alexey Sidorov on 02/04/2018.
6+
// Copyright © 2018 Minter. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
12+
let defaultFontNameRegular = "Ubuntu-R"
13+
let defaultFontNameMedium = "Ubuntu-M"
14+
let defaultFontNameBold = "Ubuntu-B"
15+
let defaultFontNameCoursive = "Ubuntu-C"
16+
let defaultFontNameLight = "Ubuntu-L"
17+
18+
19+
extension UIFont {
20+
21+
static func defaultFont(of size: CGFloat) -> UIFont {
22+
return UIFont(name: defaultFontNameRegular, size: size)!
23+
}
24+
25+
static func boldFont(of size: CGFloat) -> UIFont {
26+
return UIFont(name: defaultFontNameBold, size: size)!
27+
}
28+
29+
static func mediumFont(of size: CGFloat) -> UIFont {
30+
return UIFont(name: defaultFontNameMedium, size: size)!
31+
}
32+
33+
static func lightFont(of size: CGFloat) -> UIFont {
34+
return UIFont(name: defaultFontNameLight, size: size)!
35+
}
36+
37+
static func coursiveFont(of size: CGFloat) -> UIFont {
38+
return UIFont(name: defaultFontNameCoursive, size: size)!
39+
}
40+
41+
}

0 commit comments

Comments
 (0)