mvcgen 0.1.30 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/mvcgen/version.rb +1 -1
  4. data/lib/templates/default/podfile/Podfile +5 -5
  5. data/lib/templates/default/swift/AppDelegate.swift +2 -2
  6. data/lib/templates/default/swift/Controllers/Login/ForgetPasswordVC.swift +5 -4
  7. data/lib/templates/default/swift/Controllers/Login/LoginVC.swift +6 -6
  8. data/lib/templates/default/swift/Controllers/Login/RegisterVC.swift +14 -14
  9. data/lib/templates/default/swift/Controllers/Notifications/Cells/NotificationCell.swift +1 -1
  10. data/lib/templates/default/swift/Controllers/Notifications/NotificationsVC.swift +16 -14
  11. data/lib/templates/default/swift/Controllers/OtherLogin/ForgetPasswordTVC.swift +1 -1
  12. data/lib/templates/default/swift/Controllers/OtherLogin/LoginTVC.swift +5 -5
  13. data/lib/templates/default/swift/Controllers/OtherLogin/OtherRegisterVC.swift +6 -6
  14. data/lib/templates/default/swift/Controllers/OtherLogin/SelectLanguageVC.swift +1 -1
  15. data/lib/templates/default/swift/Controllers/OtherLogin/TermsAndConditionsVC.swift +4 -4
  16. data/lib/templates/default/swift/Controllers/Profile/AboutUsVC.swift +2 -2
  17. data/lib/templates/default/swift/Controllers/Profile/Cells/DestinationCell.swift +11 -3
  18. data/lib/templates/default/swift/Controllers/Profile/ProfileContainerVC.swift +5 -5
  19. data/lib/templates/default/swift/Controllers/Profile/ProfileTVC.swift +9 -19
  20. data/lib/templates/default/swift/Controllers/Tutorial/TutorialVC.swift +6 -6
  21. data/lib/templates/default/swift/Extensions/CustomCamera.swift +22 -29
  22. data/lib/templates/default/swift/Extensions/UnderlinedWithIconTextField.swift +1 -1
  23. data/lib/templates/default/swift/Extensions/Utils+String.swift +1 -0
  24. data/lib/templates/default/swift/Extensions/Utils+UITextField.swift +4 -3
  25. data/lib/templates/default/swift/Extensions/Utils+UIView.swift +1 -1
  26. data/lib/templates/default/swift/Extensions/Utils+UIViewController.swift +1 -1
  27. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d1defbd5440c2691e08dac9aa88b4aa90dbc96d
4
- data.tar.gz: ae4b13241fff1e868c38d847b8c5578d6f0595c1
3
+ metadata.gz: e84dfa06db18c8f66e8a3a141a2f1113e39a210c
4
+ data.tar.gz: d42eeea17daebd4b1bce5054b4d3826cb91fbca7
5
5
  SHA512:
6
- metadata.gz: 9bce821f676efbd9b3fad0e5e9e6a135c8b84f76ede75834c2ec3c731f02a5f6ed58b316c1e5ae7791e5db8de88e7eafa5421ffb872f44a5a8fe818ede1fe3c5
7
- data.tar.gz: f2ab620744e0783d42f08361a9e2e30f4e05a4064863d6e2c265a63c653e767e4c9e6d8404dcfd5565139c714d985423e35c8b7e6d0e0b4bb085bb3a25ab258e
6
+ metadata.gz: 40c4e90948754c239cc18971c99a05c49393f403f9598182c4bcc59d152fbcf516dd010407c7641aa6d4bd86fe3b8db3bb6bea7258143466e697ba814d731c96
7
+ data.tar.gz: e744dab0f208fa848c44ba2c96a1ff5e8beaadab51a34c33030a6a40f6ba35944b1eea6fabf19a2c18ea7dc5db13077efe4854f1cceee8f301af997e3b90d221
data/README.md CHANGED
@@ -131,6 +131,10 @@ gem push mvcgen-0.1.gem
131
131
  ```
132
132
  Then you'll be asked for your credentials in order to make the update in the repo (http://guides.rubygems.org/publishing/)
133
133
 
134
+ To remove previous gem versions:
135
+ ```
136
+ gem cleanup mvcgen
137
+ ```
134
138
  ### Add a new template
135
139
  Are you interested in this project and you would like to contribute by adding new templates? Feel free to do it. It's pretty easy. You've just to:
136
140
  - Create a folder inside `templates` with the name of your template
@@ -1,4 +1,4 @@
1
1
  module MVCgen
2
2
  NAME = "mvcgen"
3
- VERSION = "0.1.30"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -11,15 +11,15 @@ def commom_pods
11
11
  pod 'TextFieldEffects'
12
12
  pod 'NotificationBannerSwift'
13
13
  pod 'RAMAnimatedTabBarController'
14
- pod 'ObjectMapper', '~> 3.1'
14
+ pod 'ObjectMapper'
15
15
  pod 'DKImagePickerController'
16
- pod 'SwiftDate', '~> 4.5.1'
16
+ pod 'SwiftDate'
17
17
  pod 'NVActivityIndicatorView'
18
- pod 'Kingfisher', '~> 4.0'
18
+ pod 'Kingfisher'
19
19
  pod 'PMAlertController'
20
20
  pod 'ActionSheetPicker-3.0', '~> 2.3.0'
21
- pod 'Kingfisher', '~> 4.0'
22
- pod 'paper-onboarding', '~> 4.0.2'
21
+ pod 'Kingfisher'
22
+ pod 'paper-onboarding'
23
23
  pod 'Pastel'
24
24
 
25
25
  # Alamofire
@@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
27
27
  private let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
28
28
  private let loginStoryboard = UIStoryboard(name: "Login", bundle: Bundle.main)
29
29
 
30
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
30
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
31
31
  // Override point for customization after application launch.
32
32
 
33
33
  UIApplication.shared.statusBarStyle = .lightContent
@@ -52,7 +52,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
52
52
  Fabric.with([Crashlytics.self])
53
53
  }
54
54
 
55
- func setupOneSignal(_ launchOptions: [UIApplicationLaunchOptionsKey: Any]?){
55
+ func setupOneSignal(_ launchOptions: [UIApplication.LaunchOptionsKey: Any]?){
56
56
  let onesignalInitSettings = [kOSSettingsKeyAutoPrompt: false]
57
57
  // Replace 'YOUR_APP_ID' with your OneSignal App ID.
58
58
  OneSignal.initWithLaunchOptions(launchOptions,
@@ -44,8 +44,8 @@ class ForgetPasswordVC: UIViewController, UIGestureRecognizerDelegate {
44
44
 
45
45
  self.backgroundView.addGestureRecognizer(tap)
46
46
 
47
- NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWasShown), name: .UIKeyboardWillShow, object: nil);
48
- NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWasHidden), name: .UIKeyboardWillHide, object: nil);
47
+ NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWasShown), name: UIResponder.keyboardWillShowNotification, object: nil);
48
+ NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWasHidden), name: UIResponder.keyboardWillHideNotification, object: nil);
49
49
 
50
50
  }
51
51
 
@@ -110,8 +110,9 @@ class ForgetPasswordVC: UIViewController, UIGestureRecognizerDelegate {
110
110
  APIHelper.sharedInstance.showSuccesMessage(with: "Email sent!", and: "")
111
111
  }
112
112
  })
113
- } else {
114
- APIHelper.sharedInstance.showErrorMessage(with: "Invalid email", and: "")
113
+ } else {
114
+ APIHelper.sharedInstance.showErrorMessage(with: "Invalid email", and: "")
115
+ }
115
116
  }
116
117
  }
117
118
 
@@ -37,7 +37,7 @@ class LoginVC: UITableViewController, UITextFieldDelegate, ForgetPasswordVCDeleg
37
37
 
38
38
  // MARK: - Properties
39
39
 
40
- private static let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
40
+ private let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
41
41
 
42
42
  private var pastelView: PastelView!
43
43
 
@@ -150,16 +150,16 @@ class LoginVC: UITableViewController, UITextFieldDelegate, ForgetPasswordVCDeleg
150
150
  private func configureText(){
151
151
 
152
152
  self.emailTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("Email", comment: ""),
153
- attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray, NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)])
153
+ attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)])
154
154
  self.passwordTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("Password", comment: ""),
155
- attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray, NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)])
155
+ attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)])
156
156
 
157
157
  let normalText = NSLocalizedString("Forget your password?", comment: "")
158
- let normalAttrs = [NSAttributedStringKey.font : Fonts.roboto(type: 0, fontSize: 15)]
158
+ let normalAttrs = [NSAttributedString.Key.font : Fonts.roboto(type: 0, fontSize: 15)]
159
159
  let normalString = NSMutableAttributedString(string:normalText,attributes: normalAttrs)
160
160
 
161
161
  let boldText = NSLocalizedString(" Restore", comment: "")
162
- let attrs = [NSAttributedStringKey.font : Fonts.roboto(type: 4, fontSize: 15)]
162
+ let attrs = [NSAttributedString.Key.font : Fonts.roboto(type: 4, fontSize: 15)]
163
163
  let attributedString = NSMutableAttributedString(string:boldText, attributes:attrs)
164
164
 
165
165
  normalString.append(attributedString)
@@ -179,7 +179,7 @@ class LoginVC: UITableViewController, UITextFieldDelegate, ForgetPasswordVCDeleg
179
179
  pastelView.animationDuration = 3.0
180
180
 
181
181
  // Custom Color
182
- pastelView.setColors([Colors.firstGradientColor, Colors.textColor, Colors.secondGradientColor, Colors.thirdGradientColor])
182
+ pastelView.setColors([ColorConstants.firstGradientColor, ColorConstants.textColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor])
183
183
 
184
184
  self.tableView.backgroundView = pastelView
185
185
 
@@ -102,7 +102,7 @@ class RegisterVC: UITableViewController, UITextFieldDelegate {
102
102
  sender.setImage(tintedImage, for: .normal)
103
103
  sender.tintColor = UIColor.init(red: 51/255, green: 125/255, blue: 173/255, alpha: 1.0)
104
104
  if let image = sender.imageView {
105
- sender.bringSubview(toFront: image)
105
+ sender.bringSubviewToFront(image)
106
106
  }
107
107
  termsAndConditionsAccepted = true
108
108
  } else {
@@ -139,38 +139,38 @@ class RegisterVC: UITableViewController, UITextFieldDelegate {
139
139
 
140
140
  self.emailTextField.attributedPlaceholder = NSAttributedString(string: "Email",
141
141
  attributes: [
142
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
143
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
142
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
143
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
144
144
  ])
145
145
 
146
146
  self.nameTextField.attributedPlaceholder = NSAttributedString(string: "Name",
147
147
  attributes: [
148
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
149
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
148
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
149
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
150
150
  ])
151
151
 
152
152
  self.lastnameTextField.attributedPlaceholder = NSAttributedString(string: "Lastname",
153
153
  attributes: [
154
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
155
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
154
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
155
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
156
156
  ])
157
157
 
158
158
  self.cellphoneTextField.attributedPlaceholder = NSAttributedString(string: "Cellphone (optional)",
159
159
  attributes: [
160
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
161
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
160
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
161
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
162
162
  ])
163
163
 
164
164
  self.passwordTextField.attributedPlaceholder = NSAttributedString(string: "Password",
165
165
  attributes: [
166
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
167
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
166
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
167
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
168
168
  ])
169
169
 
170
170
  self.confirmPasswordTextField.attributedPlaceholder = NSAttributedString(string: "Confirm password",
171
171
  attributes: [
172
- NSAttributedStringKey.foregroundColor: UIColor.lightGray,
173
- NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)
172
+ NSAttributedString.Key.foregroundColor: UIColor.lightGray,
173
+ NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)
174
174
  ])
175
175
  }
176
176
 
@@ -186,7 +186,7 @@ class RegisterVC: UITableViewController, UITextFieldDelegate {
186
186
  pastelView.animationDuration = 3.0
187
187
 
188
188
  // Custom Color
189
- pastelView.setColors([Colors.firstGradientColor, Colors.textColor, Colors.secondGradientColor, Colors.thirdGradientColor])
189
+ pastelView.setColors([ColorConstants.firstGradientColor, ColorConstants.textColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor])
190
190
 
191
191
  self.tableView.backgroundView = pastelView
192
192
 
@@ -48,7 +48,7 @@ class NotificationCell: UITableViewCell {
48
48
  override func prepareForReuse() {
49
49
  super.prepareForReuse()
50
50
 
51
- self.notificationImage.image = Asset.tick.notifications
51
+ self.notificationImage.image = Asset.notifications.image
52
52
 
53
53
  self.newNotificationView.isHidden = true
54
54
  }
@@ -52,12 +52,12 @@ class NotificationsVC: UIViewController, UITableViewDelegate, UITableViewDataSou
52
52
  override func viewDidLayoutSubviews() {
53
53
  super.viewDidLayoutSubviews()
54
54
 
55
- self.gradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.thirdGradientColor], locations: [0, 0.5])
55
+ self.gradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.5])
56
56
  }
57
57
 
58
58
  private func setup() {
59
59
 
60
- self.tableView.rowHeight = UITableViewAutomaticDimension
60
+ self.tableView.rowHeight = UITableView.automaticDimension
61
61
 
62
62
  let tintedImage = Asset.back.image.withRenderingMode(.alwaysTemplate)
63
63
  self.backButton.setImage(tintedImage, for: .normal)
@@ -73,7 +73,7 @@ class NotificationsVC: UIViewController, UITableViewDelegate, UITableViewDataSou
73
73
  super.viewWillDisappear(animated)
74
74
 
75
75
  // Mark all notifications as read
76
- if self.isMovingFromParentViewController{
76
+ if self.isMovingFromParent{
77
77
  delegate?.setAsRead(value: true)
78
78
  }
79
79
  }
@@ -131,17 +131,19 @@ class NotificationsVC: UIViewController, UITableViewDelegate, UITableViewDataSou
131
131
 
132
132
  self.selectedNotification = self.notifications[indexPath.row]
133
133
 
134
- switch selectedNotif.notifType {
135
- case .broadcast:
136
- self.tableView.isUserInteractionEnabled = true
137
- break
138
- case .generic:
139
- self.tableView.isUserInteractionEnabled = true
140
- //Perform segue to detail
141
- break
142
- default:
143
- self.tableView.isUserInteractionEnabled = true
144
- break
134
+ if let notifType = selectedNotification?.notifType {
135
+ switch notifType {
136
+ case .broadcast:
137
+ self.tableView.isUserInteractionEnabled = true
138
+ break
139
+ case .generic:
140
+ self.tableView.isUserInteractionEnabled = true
141
+ //Perform segue to detail
142
+ break
143
+ default:
144
+ self.tableView.isUserInteractionEnabled = true
145
+ break
146
+ }
145
147
  }
146
148
  }
147
149
 
@@ -42,7 +42,7 @@ class ForgetPasswordTVC: UITableViewController, UITextFieldDelegate {
42
42
 
43
43
  override func viewDidLayoutSubviews() {
44
44
  super.viewDidLayoutSubviews()
45
- self.backgroundGradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.secondGradientColor, Colors.thirdGradientColor], locations: [0, 0.2, 0.98])
45
+ self.backgroundGradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.2, 0.98])
46
46
  }
47
47
 
48
48
  func textFieldShouldReturn(_ textField: UITextField) -> Bool {
@@ -139,16 +139,16 @@ class LoginTVC: UITableViewController, UITextFieldDelegate, ForgetPasswordVCDele
139
139
  private func configureText(){
140
140
 
141
141
  self.emailTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("Email", comment: ""),
142
- attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray, NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)])
142
+ attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)])
143
143
  self.passwordTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("Password", comment: ""),
144
- attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray, NSAttributedStringKey.font: Fonts.roboto(type: 1, fontSize: 17)])
144
+ attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray, NSAttributedString.Key.font: Fonts.roboto(type: 1, fontSize: 17)])
145
145
 
146
146
  let normalText = NSLocalizedString("Forget your password?", comment: "")
147
- let normalAttrs = [NSAttributedStringKey.font : Fonts.roboto(type: 0, fontSize: 15)]
147
+ let normalAttrs = [NSAttributedString.Key.font : Fonts.roboto(type: 0, fontSize: 15)]
148
148
  let normalString = NSMutableAttributedString(string:normalText,attributes: normalAttrs)
149
149
 
150
150
  let boldText = NSLocalizedString(" Restore", comment: "")
151
- let attrs = [NSAttributedStringKey.font : Fonts.roboto(type: 4, fontSize: 15)]
151
+ let attrs = [NSAttributedString.Key.font : Fonts.roboto(type: 4, fontSize: 15)]
152
152
  let attributedString = NSMutableAttributedString(string:boldText, attributes:attrs)
153
153
 
154
154
  normalString.append(attributedString)
@@ -168,7 +168,7 @@ class LoginTVC: UITableViewController, UITextFieldDelegate, ForgetPasswordVCDele
168
168
  pastelView.animationDuration = 3.0
169
169
 
170
170
  // Custom Color
171
- pastelView.setColors([Colors.firstGradientColor, Colors.textColor, Colors.secondGradientColor, Colors.thirdGradientColor])
171
+ pastelView.setColors([ColorConstants.firstGradientColor, ColorConstants.textColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor])
172
172
 
173
173
  self.tableView.backgroundView = pastelView
174
174
 
@@ -59,7 +59,7 @@ class OtherRegisterVC: UITableViewController, UITextFieldDelegate {
59
59
  self.registerButton.layoutIfNeeded()
60
60
  self.registerButton.layer.cornerRadius = self.registerButton.frame.height/7
61
61
  self.registerButton.layer.masksToBounds = true
62
- self.registerButton.activityIndicatorColor = Colors.firstGradientColor
62
+ self.registerButton.activityIndicatorColor = ColorConstants.firstGradientColor
63
63
 
64
64
  emailTextField.underlined(color: UIColor.white, width: 1.0)
65
65
  nameTextField.underlined(color: UIColor.white, width: 1.0)
@@ -96,7 +96,7 @@ class OtherRegisterVC: UITableViewController, UITextFieldDelegate {
96
96
 
97
97
  override func viewDidLayoutSubviews() {
98
98
  super.viewDidLayoutSubviews()
99
- self.gradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.secondGradientColor, Colors.thirdGradientColor], locations: [0, 0.2, 0.98])
99
+ self.gradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.2, 0.98])
100
100
  }
101
101
 
102
102
  func textFieldShouldReturn(_ textField: UITextField) -> Bool {
@@ -138,8 +138,8 @@ class OtherRegisterVC: UITableViewController, UITextFieldDelegate {
138
138
 
139
139
  @IBAction func acceptTermsTapped(_ sender: UIButton) {
140
140
  if !termsAndConditionsAccepted {
141
- sender.setImage(UIImage(named: "Tick"), for: .normal)
142
- sender.bringSubview(toFront: sender.imageView!)
141
+ sender.setImage(Asset.tick.image, for: .normal)
142
+ sender.bringSubviewToFront(sender.imageView!)
143
143
  termsAndConditionsAccepted = true
144
144
  //registerButton.isEnabled = true
145
145
  } else {
@@ -287,10 +287,10 @@ class OtherRegisterVC: UITableViewController, UITextFieldDelegate {
287
287
  return
288
288
  }, origin: sender)
289
289
 
290
- acp?.setTextColor(Colors.firstGradientColor)
290
+ acp?.setTextColor(ColorConstants.firstGradientColor)
291
291
  acp?.pickerBackgroundColor = UIColor.white
292
292
  acp?.toolbarBackgroundColor = UIColor.white
293
- acp?.toolbarButtonsColor = Colors.firstGradientColor
293
+ acp?.toolbarButtonsColor = ColorConstants.firstGradientColor
294
294
  acp?.show()
295
295
  }
296
296
 
@@ -41,7 +41,7 @@ class SelectLanguageVC: UITableViewController {
41
41
  override func viewDidLayoutSubviews() {
42
42
  super.viewDidLayoutSubviews()
43
43
 
44
- self.gradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.secondGradientColor, Colors.thirdGradientColor], locations: [0, 0.2, 0.98])
44
+ self.gradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.2, 0.98])
45
45
  }
46
46
 
47
47
  @IBAction func registerTapped(_ sender: UIButton) {
@@ -14,7 +14,7 @@ class TermsAndConditionsVC: UIViewController {
14
14
  didSet{
15
15
  self.registerButtonOutlet.layer.cornerRadius = self.registerButtonOutlet.frame.height/7
16
16
  self.registerButtonOutlet.layer.masksToBounds = true
17
- self.registerButtonOutlet.activityIndicatorColor = Colors.firstGradientColor
17
+ self.registerButtonOutlet.activityIndicatorColor = ColorConstants.firstGradientColor
18
18
  }
19
19
  }
20
20
  @IBOutlet weak var termsAndConditions: UIButton!{
@@ -28,7 +28,7 @@ class TermsAndConditionsVC: UIViewController {
28
28
 
29
29
  override func viewDidLoad() {
30
30
  super.viewDidLoad()
31
- self.view.applyGradient(withColours: [Colors.firstGradientColor, Colors.secondGradientColor, Colors.thirdGradientColor], locations: [0, 0.2, 0.98])
31
+ self.view.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.secondGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.2, 0.98])
32
32
  // Do any additional setup after loading the view.
33
33
  }
34
34
 
@@ -39,8 +39,8 @@ class TermsAndConditionsVC: UIViewController {
39
39
 
40
40
  @IBAction func acceptTermsTapped(_ sender: UIButton) {
41
41
  if !acceptTermsAndConditions {
42
- sender.setImage(UIImage(named: "Tick"), for: .normal)
43
- sender.bringSubview(toFront: sender.imageView!)
42
+ sender.setImage(Asset.tick.image, for: .normal)
43
+ sender.bringSubviewToFront(sender.imageView!)
44
44
  self.acceptTermsAndConditions = true
45
45
  //registerButton.isEnabled = true
46
46
  } else {
@@ -55,7 +55,7 @@ class AboutUsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
55
55
  override func viewDidLayoutSubviews() {
56
56
  view.backgroundColor = UIColor.clear
57
57
 
58
- self.gradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.thirdGradientColor], locations: [0, 0.5])
58
+ self.gradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.5])
59
59
  }
60
60
 
61
61
  // MARK: - Actions
@@ -68,7 +68,7 @@ class AboutUsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
68
68
 
69
69
  private func setup() {
70
70
 
71
- self.tableView.rowHeight = UITableViewAutomaticDimension
71
+ self.tableView.rowHeight = UITableView.automaticDimension
72
72
  let tintedImage = Asset.back.image.withRenderingMode(.alwaysTemplate)
73
73
  self.backButton.setImage(tintedImage, for: .normal)
74
74
  self.backButton.tintColor = UIColor(red: 107.0/255.0, green: 255.0/255.0, blue: 192.0/255.0, alpha: 1)
@@ -7,6 +7,7 @@
7
7
  //
8
8
 
9
9
  import UIKit
10
+ import Kingfisher
10
11
 
11
12
  class DestinationCell: UICollectionViewCell {
12
13
 
@@ -26,15 +27,22 @@ class DestinationCell: UICollectionViewCell {
26
27
  super.awakeFromNib()
27
28
 
28
29
  // Initialization code
29
- self.blueGradientView.applyGradient(withColours: [Colors.firstGradientColor, UIColor.clear], alpha: 0.8, angle: 90)
30
+ self.blueGradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, UIColor.clear], alpha: 0.8, angle: 90)
30
31
  }
31
32
 
32
33
  override var isSelected: Bool {
33
34
  didSet {
34
35
  self.layer.borderWidth = 1.0
35
- self.layer.borderColor = isSelected ? Colors.firstGradientColor.cgColor : UIColor.clear.cgColor
36
- self.blueGradientView.backgroundColor = isSelected ? Colors.thirdGradientColor : UIColor.clear
36
+ self.layer.borderColor = isSelected ? ColorConstants.firstGradientColor.cgColor : UIColor.clear.cgColor
37
+ self.blueGradientView.backgroundColor = isSelected ? ColorConstants.thirdGradientColor : UIColor.clear
37
38
  self.tickImage.image = isSelected ? UIImage(named: "Tick") : nil
38
39
  }
39
40
  }
41
+
42
+ func configure(with userHistory: UserHistory) {
43
+
44
+ self.destinationLabel.text = userHistory.name.capitalized
45
+ self.destinationBackgroundImage.kf.indicatorType = .activity
46
+ self.destinationBackgroundImage.kf.setImage(with: URL(string: userHistory.thumbnailUrl), options: [.transition(.fade(0.2))])
47
+ }
40
48
  }
@@ -18,7 +18,7 @@ class ProfileContainerVC: UIViewController {
18
18
 
19
19
  // MARK: - Properties
20
20
 
21
- private static let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
21
+ private let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
22
22
 
23
23
  private lazy var profileTVC: ProfileTVC = {
24
24
  return self.homeStoryboard.instantiateViewController(withIdentifier: "ProfileTVC") as! ProfileTVC
@@ -37,7 +37,7 @@ class ProfileContainerVC: UIViewController {
37
37
  override func viewDidLayoutSubviews() {
38
38
  super.viewDidLayoutSubviews()
39
39
 
40
- self.gradientView.applyGradient(withColours: [Colors.firstGradientColor, Colors.thirdGradientColor], locations: [0, 0.5])
40
+ self.gradientView.applyGradient(withColours: [ColorConstants.firstGradientColor, ColorConstants.thirdGradientColor], locations: [0, 0.5])
41
41
  }
42
42
 
43
43
  // MARK: - Private
@@ -59,18 +59,18 @@ class ProfileContainerVC: UIViewController {
59
59
  viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
60
60
 
61
61
  // Notify Child View Controller
62
- viewController.didMove(toParentViewController: self)
62
+ viewController.didMove(toParent: self)
63
63
  }
64
64
 
65
65
  private func remove(asChildViewController viewController: UIViewController) {
66
66
 
67
67
  // Notify Child View Controller
68
- viewController.willMove(toParentViewController: nil)
68
+ viewController.willMove(toParent: nil)
69
69
 
70
70
  viewController.view.removeFromSuperview()
71
71
 
72
72
  // Notify Child View Controller
73
- viewController.removeFromParentViewController()
73
+ viewController.removeFromParent()
74
74
  }
75
75
 
76
76
  }
@@ -116,7 +116,7 @@ class ProfileTVC: UITableViewController, UITextFieldDelegate, NotificationReadPr
116
116
 
117
117
  // MARK: - Properties
118
118
 
119
- private static let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
119
+ private let homeStoryboard = UIStoryboard(name: "Home", bundle: Bundle.main)
120
120
 
121
121
  var profileImageChanged: Bool = false
122
122
 
@@ -348,13 +348,15 @@ class ProfileTVC: UITableViewController, UITextFieldDelegate, NotificationReadPr
348
348
  @IBAction func handleEditProfileImageButton(_ sender: Any) {
349
349
 
350
350
  let pickerController = DKImagePickerController()
351
- pickerController.UIDelegate = CustomUIDelegate()
351
+
352
+ DKImageExtensionController.registerExtension(extensionClass: CustomCamera.self, for: .camera)
353
+
352
354
  pickerController.assetType = .allPhotos
353
355
  pickerController.singleSelect = true
354
356
  pickerController.didSelectAssets = { (assets: [DKAsset]) in
355
357
  for asset in assets {
356
358
  //Gets a fullscreen image for the asset to show in the CollectionView
357
- asset.fetchFullScreenImageWithCompleteBlock({ (image, info) in
359
+ asset.fetchFullScreenImage(completeBlock: { (image, info) in
358
360
 
359
361
  self.profileImageChanged = true
360
362
  self.editProfileImageView.image = image
@@ -459,10 +461,10 @@ class ProfileTVC: UITableViewController, UITextFieldDelegate, NotificationReadPr
459
461
  self.phoneCountry = prevPhoneCountryValue
460
462
  return }, origin: sender)
461
463
 
462
- acp?.setTextColor(Colors.firstGradientColor)
464
+ acp?.setTextColor(ColorConstants.firstGradientColor)
463
465
  acp?.pickerBackgroundColor = UIColor.white
464
466
  acp?.toolbarBackgroundColor = UIColor.white
465
- acp?.toolbarButtonsColor = Colors.firstGradientColor
467
+ acp?.toolbarButtonsColor = ColorConstants.firstGradientColor
466
468
  acp?.show()
467
469
  }
468
470
 
@@ -486,18 +488,6 @@ class ProfileTVC: UITableViewController, UITextFieldDelegate, NotificationReadPr
486
488
 
487
489
  }
488
490
 
489
- open class CustomUIDelegate: DKImagePickerControllerDefaultUIDelegate {
490
-
491
- open override func imagePickerControllerCreateCamera(_ imagePickerController: DKImagePickerController) -> UIViewController {
492
-
493
- let picker = CustomCamera()
494
- picker.sourceType = .camera
495
- picker.mediaTypes = [kUTTypeImage as String]
496
- return picker
497
- }
498
-
499
- }
500
-
501
491
  extension ProfileTVC: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
502
492
 
503
493
  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
@@ -530,7 +520,7 @@ extension ProfileTVC: UICollectionViewDelegate, UICollectionViewDataSource, UICo
530
520
 
531
521
  let history = userHistory[indexPath.row]
532
522
 
533
- cell.configure(with: userHistory)
523
+ cell.configure(with: history)
534
524
 
535
525
  return cell
536
526
  }
@@ -550,7 +540,7 @@ extension ProfileTVC: UICollectionViewDelegate, UICollectionViewDataSource, UICo
550
540
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
551
541
 
552
542
  if collectionView == favoritesCollectionView {
553
- let size = (favorites[indexPath.row].name as NSString).size(withAttributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 16.0)])
543
+ let size = (favorites[indexPath.row].name as NSString).size(withAttributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16.0)])
554
544
  return CGSize(width: size.width + 65, height: 40)
555
545
  } else {
556
546
  return CGSize(width: 200, height: 100)
@@ -33,7 +33,7 @@ class TutorialVC: UIViewController {
33
33
  view.addSubview(onboarding)
34
34
 
35
35
  // Add constraints
36
- for attribute: NSLayoutAttribute in [.left, .right, .top, .bottom] {
36
+ for attribute: NSLayoutConstraint.Attribute in [.left, .right, .top, .bottom] {
37
37
  let constraint = NSLayoutConstraint(item: onboarding,
38
38
  attribute: attribute,
39
39
  relatedBy: .equal,
@@ -43,7 +43,7 @@ class TutorialVC: UIViewController {
43
43
  constant: 0)
44
44
  view.addConstraint(constraint)
45
45
  }
46
- self.view.bringSubview(toFront: skipButton);
46
+ self.view.bringSubviewToFront(skipButton);
47
47
  }
48
48
 
49
49
  }
@@ -92,25 +92,25 @@ extension TutorialVC: PaperOnboardingDataSource {
92
92
  title: welcomeLabel,
93
93
  description: "First tutorial message!",
94
94
  pageIcon: UIImage(named: "Tick")!,
95
- color: Colors.firstGradientColor,
95
+ color: ColorConstants.firstGradientColor,
96
96
  titleColor: UIColor.white, descriptionColor: UIColor.white, titleFont: titleFont, descriptionFont: descriptionFont),
97
97
  OnboardingItemInfo(informationImage: Asset.welcome_02.image,
98
98
  title: "",
99
99
  description: "Second tutorial message!",
100
100
  pageIcon: UIImage(named: "Tick")!,
101
- color: Colors.secondGradientColor,
101
+ color: ColorConstants.secondGradientColor,
102
102
  titleColor: UIColor.white, descriptionColor: UIColor.white, titleFont: titleFont, descriptionFont: descriptionFont),
103
103
  OnboardingItemInfo(informationImage: Asset.welcome_03.image,
104
104
  title: "",
105
105
  description: "Third tutorial message!",
106
106
  pageIcon: UIImage(named: "Tick")!,
107
- color: Colors.thirdGradientColor,
107
+ color: ColorConstants.thirdGradientColor,
108
108
  titleColor: UIColor.white, descriptionColor: UIColor.white, titleFont: titleFont, descriptionFont: descriptionFont),
109
109
  OnboardingItemInfo(informationImage: Asset.welcome_04.image,
110
110
  title: "",
111
111
  description: "Final tutorial message!",
112
112
  pageIcon: UIImage(named: "Tick")!,
113
- color: Colors.textColor,
113
+ color: ColorConstants.textColor,
114
114
  titleColor: UIColor.white, descriptionColor: UIColor.white, titleFont: titleFont, descriptionFont: descriptionFont),
115
115
  ]
116
116
  return list[index]
@@ -5,54 +5,49 @@
5
5
  // Created by Daniel Martinez on 23/7/18.
6
6
  // Copyright © 2018 Houlak. All rights reserved.
7
7
  //
8
-
9
8
  import UIKit
10
9
  import MobileCoreServices
11
10
  import DKImagePickerController
12
11
 
13
- open class CustomCamera: UIImagePickerController, DKImagePickerControllerCameraProtocol, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
12
+ open class CustomCamera: DKImageBaseExtension, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
14
13
 
15
14
  var didCancel: (() -> Void)?
16
15
  var didFinishCapturingImage: ((_ image: UIImage, _ metadata: [AnyHashable : Any]?) -> Void)?
17
16
  var didFinishCapturingVideo: ((_ videoURL: URL) -> Void)?
18
17
 
19
- open override func viewDidLoad() {
20
- super.viewDidLoad()
18
+ open override func perform(with extraInfo: [AnyHashable : Any]) {
19
+ guard let didFinishCapturingImage = extraInfo["didFinishCapturingImage"] as? ((UIImage, [AnyHashable : Any]?) -> Void)
20
+ , let didFinishCapturingVideo = extraInfo["didFinishCapturingVideo"] as? ((URL) -> Void)
21
+ , let didCancel = extraInfo["didCancel"] as? (() -> Void) else { return }
21
22
 
22
- self.delegate = self
23
- self.sourceType = .camera
24
- self.mediaTypes = [kUTTypeImage as String, kUTTypeMovie as String]
25
- }
26
-
27
- // MARK: - DKImagePickerControllerCameraProtocol
28
-
29
- public func setDidCancel(block: @escaping () -> Void) {
30
- self.didCancel = block
31
- }
32
-
33
- public func setDidFinishCapturingImage(block: @escaping (UIImage, [AnyHashable : Any]?) -> Void) {
34
- self.didFinishCapturingImage = block
23
+ self.didFinishCapturingImage = didFinishCapturingImage
24
+ self.didFinishCapturingVideo = didFinishCapturingVideo
25
+ self.didCancel = didCancel
26
+
27
+ let camera = UIImagePickerController()
28
+ camera.delegate = self
29
+ camera.sourceType = .camera
30
+ camera.mediaTypes = [kUTTypeImage as String, kUTTypeMovie as String]
31
+
32
+ self.context.imagePickerController.present(camera)
35
33
  }
36
34
 
37
- public func setDidFinishCapturingVideo(block: @escaping (URL) -> Void) {
38
- self.didFinishCapturingVideo = block
35
+ open override func finish() {
36
+ self.context.imagePickerController.dismiss(animated: true)
39
37
  }
40
38
 
41
39
  // MARK: - UIImagePickerControllerDelegate methods
42
40
 
43
- open func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
44
-
45
- let mediaType = info[UIImagePickerControllerMediaType] as! String
46
- let metadata = info[UIImagePickerControllerMediaMetadata] as! [AnyHashable : Any]
41
+ open func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
42
+ let mediaType = info[.mediaType] as! String
47
43
 
48
44
  if mediaType == kUTTypeImage as String {
45
+ let metadata = info[.mediaMetadata] as! [AnyHashable : Any]
49
46
 
50
- let image = info[UIImagePickerControllerOriginalImage] as! UIImage
47
+ let image = info[.originalImage] as! UIImage
51
48
  self.didFinishCapturingImage?(image, metadata)
52
-
53
49
  } else if mediaType == kUTTypeMovie as String {
54
-
55
- let videoURL = info[UIImagePickerControllerMediaURL] as! URL
50
+ let videoURL = info[.mediaURL] as! URL
56
51
  self.didFinishCapturingVideo?(videoURL)
57
52
  }
58
53
  }
@@ -60,6 +55,4 @@ open class CustomCamera: UIImagePickerController, DKImagePickerControllerCameraP
60
55
  open func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
61
56
  self.didCancel?()
62
57
  }
63
-
64
58
  }
65
-
@@ -49,7 +49,7 @@ class UnderlinedWithIconTextField: UITextField {
49
49
  imageView.bounds = imageView.frame.insetBy(dx: 15.0, dy: 0.0);
50
50
 
51
51
  self.leftView = leftView
52
- self.leftViewMode = UITextFieldViewMode.always
52
+ self.leftViewMode = UITextField.ViewMode.always
53
53
 
54
54
  }
55
55
  }
@@ -5,6 +5,7 @@
5
5
  // Created by Daniel Martinez on 23/7/18.
6
6
  // Copyright © 2018 Houlak. All rights reserved.
7
7
  //
8
+ import Foundation
8
9
 
9
10
  extension String {
10
11
 
@@ -5,18 +5,19 @@
5
5
  // Created by Daniel Martinez on 23/7/18.
6
6
  // Copyright © 2018 Houlak. All rights reserved.
7
7
  //
8
+ import UIKit
8
9
 
9
10
  extension UITextField {
10
11
 
11
12
  func isEmail() -> Bool {
12
- return self.text.isEmail()
13
+ return self.text?.isEmail() ?? false
13
14
  }
14
15
 
15
16
  func isName() -> Bool {
16
- return self.text.isName()
17
+ return self.text?.isName() ?? false
17
18
  }
18
19
 
19
20
  func isPhone() -> Bool {
20
- return self.text.isPhone()
21
+ return self.text?.isPhone() ?? false
21
22
  }
22
23
  }
@@ -29,7 +29,7 @@ extension UIView {
29
29
  shadowLayer.shadowOffset = CGSize(width: 0.0, height: 0.0)
30
30
  shadowLayer.shadowOpacity = shadowOpacity
31
31
  shadowLayer.shadowRadius = shadowSize
32
- shadowLayer.fillRule = kCAFillRuleEvenOdd
32
+ shadowLayer.fillRule = CAShapeLayerFillRule.evenOdd
33
33
 
34
34
  // define shadow path
35
35
  let shadowPath = CGMutablePath()
@@ -18,7 +18,7 @@ extension UIViewController {
18
18
  }
19
19
 
20
20
  func setSelectedColors(backgroundView: UIView, label: UILabel) {
21
- backgroundView.backgroundColor = Colors.firstGradientColor
21
+ backgroundView.backgroundColor = ColorConstants.firstGradientColor
22
22
  label.textColor = UIColor.white
23
23
  }
24
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvcgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martinez