Manos Chorianopoulos

xib bundle issue fix

...@@ -243,6 +243,387 @@ You should see: ...@@ -243,6 +243,387 @@ You should see:
243 243
244 --- 244 ---
245 245
246 +## 📱 **View Controller Integration**
247 +
248 +### **Using Framework View Controllers**
249 +
250 +The SwiftWarplyFramework provides ready-to-use view controllers that you can integrate into your app's navigation flow.
251 +
252 +#### **Available View Controllers**
253 +
254 +| View Controller | Purpose | Description |
255 +|----------------|---------|-------------|
256 +| `MyRewardsViewController` | Main rewards screen | Displays campaigns, offers, and banners |
257 +| `ProfileViewController` | User profile & coupons | Shows user profile and coupon management |
258 +| `CouponViewController` | Individual coupon details | Displays detailed coupon information |
259 +
260 +#### **Basic Integration Example**
261 +
262 +```swift
263 +import SwiftWarplyFramework
264 +
265 +class MainViewController: UIViewController {
266 +
267 + @IBAction func showRewardsButtonTapped(_ sender: UIButton) {
268 + // Create the rewards view controller
269 + let rewardsVC = MyRewardsViewController()
270 +
271 + // Push onto navigation stack
272 + navigationController?.pushViewController(rewardsVC, animated: true)
273 + }
274 +
275 + @IBAction func showProfileButtonTapped(_ sender: UIButton) {
276 + // Create the profile view controller
277 + let profileVC = ProfileViewController()
278 +
279 + // Push onto navigation stack
280 + navigationController?.pushViewController(profileVC, animated: true)
281 + }
282 +}
283 +```
284 +
285 +#### **Modal Presentation**
286 +
287 +```swift
288 +class MainViewController: UIViewController {
289 +
290 + @IBAction func showRewardsModal(_ sender: UIButton) {
291 + let rewardsVC = MyRewardsViewController()
292 +
293 + // Wrap in navigation controller for modal presentation
294 + let navController = UINavigationController(rootViewController: rewardsVC)
295 + navController.modalPresentationStyle = .fullScreen
296 +
297 + present(navController, animated: true)
298 + }
299 +}
300 +```
301 +
302 +#### **Tab Bar Integration**
303 +
304 +```swift
305 +class TabBarController: UITabBarController {
306 +
307 + override func viewDidLoad() {
308 + super.viewDidLoad()
309 + setupTabs()
310 + }
311 +
312 + private func setupTabs() {
313 + // Main app tab
314 + let homeVC = HomeViewController()
315 + let homeNav = UINavigationController(rootViewController: homeVC)
316 + homeNav.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0)
317 +
318 + // Warply rewards tab
319 + let rewardsVC = MyRewardsViewController()
320 + let rewardsNav = UINavigationController(rootViewController: rewardsVC)
321 + rewardsNav.tabBarItem = UITabBarItem(title: "Rewards", image: UIImage(systemName: "gift"), tag: 1)
322 +
323 + // Profile tab
324 + let profileVC = ProfileViewController()
325 + let profileNav = UINavigationController(rootViewController: profileVC)
326 + profileNav.tabBarItem = UITabBarItem(title: "Profile", image: UIImage(systemName: "person"), tag: 2)
327 +
328 + viewControllers = [homeNav, rewardsNav, profileNav]
329 + }
330 +}
331 +```
332 +
333 +#### **Custom Navigation Setup**
334 +
335 +```swift
336 +class CustomNavigationController: UINavigationController {
337 +
338 + override func viewDidLoad() {
339 + super.viewDidLoad()
340 + setupNavigationAppearance()
341 + }
342 +
343 + private func setupNavigationAppearance() {
344 + // Customize navigation bar for framework view controllers
345 + navigationBar.prefersLargeTitles = false
346 + navigationBar.tintColor = .systemBlue
347 +
348 + // Set up navigation bar appearance
349 + let appearance = UINavigationBarAppearance()
350 + appearance.configureWithOpaqueBackground()
351 + appearance.backgroundColor = .systemBackground
352 +
353 + navigationBar.standardAppearance = appearance
354 + navigationBar.scrollEdgeAppearance = appearance
355 + }
356 +
357 + func showWarplyRewards() {
358 + let rewardsVC = MyRewardsViewController()
359 + pushViewController(rewardsVC, animated: true)
360 + }
361 +
362 + func showWarplyProfile() {
363 + let profileVC = ProfileViewController()
364 + pushViewController(profileVC, animated: true)
365 + }
366 +}
367 +```
368 +
369 +#### **Programmatic Navigation Flow**
370 +
371 +```swift
372 +class WarplyFlowCoordinator {
373 + private weak var navigationController: UINavigationController?
374 +
375 + init(navigationController: UINavigationController) {
376 + self.navigationController = navigationController
377 + }
378 +
379 + func startRewardsFlow() {
380 + let rewardsVC = MyRewardsViewController()
381 + navigationController?.pushViewController(rewardsVC, animated: true)
382 + }
383 +
384 + func showProfile() {
385 + let profileVC = ProfileViewController()
386 + navigationController?.pushViewController(profileVC, animated: true)
387 + }
388 +
389 + func showCouponDetails(with offer: OfferModel) {
390 + let couponVC = CouponViewController()
391 + couponVC.coupon = offer
392 + navigationController?.pushViewController(couponVC, animated: true)
393 + }
394 +
395 + func dismissToRoot() {
396 + navigationController?.popToRootViewController(animated: true)
397 + }
398 +}
399 +```
400 +
401 +#### **SwiftUI Integration**
402 +
403 +```swift
404 +import SwiftUI
405 +import SwiftWarplyFramework
406 +
407 +struct WarplyRewardsView: UIViewControllerRepresentable {
408 +
409 + func makeUIViewController(context: Context) -> MyRewardsViewController {
410 + return MyRewardsViewController()
411 + }
412 +
413 + func updateUIViewController(_ uiViewController: MyRewardsViewController, context: Context) {
414 + // Update if needed
415 + }
416 +}
417 +
418 +struct ContentView: View {
419 + var body: some View {
420 + NavigationView {
421 + VStack {
422 + NavigationLink("Show Rewards") {
423 + WarplyRewardsView()
424 + .navigationBarTitleDisplayMode(.inline)
425 + }
426 + .padding()
427 +
428 + NavigationLink("Show Profile") {
429 + WarplyProfileView()
430 + .navigationBarTitleDisplayMode(.inline)
431 + }
432 + .padding()
433 + }
434 + .navigationTitle("Main Menu")
435 + }
436 + }
437 +}
438 +
439 +struct WarplyProfileView: UIViewControllerRepresentable {
440 + func makeUIViewController(context: Context) -> ProfileViewController {
441 + return ProfileViewController()
442 + }
443 +
444 + func updateUIViewController(_ uiViewController: ProfileViewController, context: Context) {
445 + // Update if needed
446 + }
447 +}
448 +```
449 +
450 +#### **Handling Navigation Events**
451 +
452 +```swift
453 +class MainViewController: UIViewController {
454 +
455 + override func viewDidLoad() {
456 + super.viewDidLoad()
457 + setupWarplyEventListeners()
458 + }
459 +
460 + private func setupWarplyEventListeners() {
461 + // Listen for navigation events from framework
462 + let subscription = WarplySDK.shared.subscribe(to: "navigation_requested") { [weak self] data in
463 + DispatchQueue.main.async {
464 + self?.handleWarplyNavigation(data)
465 + }
466 + }
467 + }
468 +
469 + private func handleWarplyNavigation(_ data: Any) {
470 + // Handle navigation requests from framework view controllers
471 + if let navigationData = data as? [String: Any],
472 + let destination = navigationData["destination"] as? String {
473 +
474 + switch destination {
475 + case "profile":
476 + showProfile()
477 + case "coupon_details":
478 + if let couponId = navigationData["coupon_id"] as? String {
479 + showCouponDetails(couponId: couponId)
480 + }
481 + default:
482 + break
483 + }
484 + }
485 + }
486 +
487 + private func showProfile() {
488 + let profileVC = ProfileViewController()
489 + navigationController?.pushViewController(profileVC, animated: true)
490 + }
491 +
492 + private func showCouponDetails(couponId: String) {
493 + let couponVC = CouponViewController()
494 + // Configure with coupon ID
495 + navigationController?.pushViewController(couponVC, animated: true)
496 + }
497 +}
498 +```
499 +
500 +#### **Best Practices for View Controller Integration**
501 +
502 +```swift
503 +class BestPracticesExample: UIViewController {
504 +
505 + // ✅ Good: Keep reference to avoid memory issues
506 + private var currentWarplyVC: UIViewController?
507 +
508 + func showRewardsViewController() {
509 + // ✅ Good: Check if already presented
510 + guard currentWarplyVC == nil else { return }
511 +
512 + let rewardsVC = MyRewardsViewController()
513 + currentWarplyVC = rewardsVC
514 +
515 + // ✅ Good: Proper navigation setup
516 + if let navigationController = navigationController {
517 + navigationController.pushViewController(rewardsVC, animated: true)
518 + } else {
519 + // ✅ Good: Fallback for modal presentation
520 + let navController = UINavigationController(rootViewController: rewardsVC)
521 + present(navController, animated: true)
522 + }
523 + }
524 +
525 + override func viewWillAppear(_ animated: Bool) {
526 + super.viewWillAppear(animated)
527 +
528 + // ✅ Good: Clean up reference when returning
529 + if currentWarplyVC != nil && !children.contains(where: { $0 is MyRewardsViewController }) {
530 + currentWarplyVC = nil
531 + }
532 + }
533 +
534 + // ✅ Good: Provide easy access methods
535 + func showWarplyRewards() {
536 + let rewardsVC = MyRewardsViewController()
537 + navigationController?.pushViewController(rewardsVC, animated: true)
538 + }
539 +
540 + func showWarplyProfile() {
541 + let profileVC = ProfileViewController()
542 + navigationController?.pushViewController(profileVC, animated: true)
543 + }
544 +
545 + // ✅ Good: Handle authentication state
546 + func showWarplyContentIfAuthenticated() {
547 + // Check authentication first
548 + WarplySDK.shared.verifyTicket(guid: "user-guid", ticket: "user-ticket") { [weak self] response in
549 + DispatchQueue.main.async {
550 + if response?.getStatus == 1 {
551 + self?.showWarplyRewards()
552 + } else {
553 + self?.showLoginRequired()
554 + }
555 + }
556 + }
557 + }
558 +
559 + private func showLoginRequired() {
560 + let alert = UIAlertController(
561 + title: "Login Required",
562 + message: "Please log in to access rewards",
563 + preferredStyle: .alert
564 + )
565 + alert.addAction(UIAlertAction(title: "OK", style: .default))
566 + present(alert, animated: true)
567 + }
568 +}
569 +```
570 +
571 +#### **Common Integration Patterns**
572 +
573 +```swift
574 +// Pattern 1: Direct navigation
575 +@IBAction func showRewards(_ sender: Any) {
576 + let rewardsVC = MyRewardsViewController()
577 + navigationController?.pushViewController(rewardsVC, animated: true)
578 +}
579 +
580 +// Pattern 2: Conditional navigation
581 +func showRewardsIfReady() {
582 + guard WarplySDK.shared.getNetworkStatus() == 1 else {
583 + showNetworkError()
584 + return
585 + }
586 +
587 + let rewardsVC = MyRewardsViewController()
588 + navigationController?.pushViewController(rewardsVC, animated: true)
589 +}
590 +
591 +// Pattern 3: Coordinator pattern
592 +class AppCoordinator {
593 + private let navigationController: UINavigationController
594 +
595 + init(navigationController: UINavigationController) {
596 + self.navigationController = navigationController
597 + }
598 +
599 + func showWarplyFlow() {
600 + let rewardsVC = MyRewardsViewController()
601 + navigationController.pushViewController(rewardsVC, animated: true)
602 + }
603 +}
604 +
605 +// Pattern 4: Delegate pattern
606 +protocol WarplyNavigationDelegate: AnyObject {
607 + func didRequestShowProfile()
608 + func didRequestShowCoupon(_ coupon: OfferModel)
609 +}
610 +
611 +class MainViewController: UIViewController, WarplyNavigationDelegate {
612 + func didRequestShowProfile() {
613 + let profileVC = ProfileViewController()
614 + navigationController?.pushViewController(profileVC, animated: true)
615 + }
616 +
617 + func didRequestShowCoupon(_ coupon: OfferModel) {
618 + let couponVC = CouponViewController()
619 + couponVC.coupon = coupon
620 + navigationController?.pushViewController(couponVC, animated: true)
621 + }
622 +}
623 +```
624 +
625 +---
626 +
246 ## 📚 **Complete Documentation** 627 ## 📚 **Complete Documentation**
247 628
248 *The sections below provide detailed information for advanced usage* 629 *The sections below provide detailed information for advanced usage*
......
1 -# NIB Loading Fix Summary
2 -
3 -## Problem Identified
4 -Your demo client was crashing with the error:
5 -```
6 -Could not load NIB in bundle: 'NSBundle .../SwiftWarplyFramework.framework' with name 'MyRewardsViewController'
7 -```
8 -
9 -## Root Cause
10 -The issue was that view controllers in the SwiftWarplyFramework were not properly specifying the NIB name and bundle when being instantiated. When your demo client tried to create these view controllers, iOS couldn't find the XIB files because it was looking in the wrong bundle.
11 -
12 -## Solution Applied
13 -Added proper initializers to all XIB-based view controllers in the framework:
14 -
15 -### Fixed View Controllers:
16 -1. **MyRewardsViewController**
17 -2. **ProfileViewController**
18 -3. **CouponViewController**
19 -
20 -### What Was Added:
21 -Each view controller now has these initializers:
22 -
23 -```swift
24 -// MARK: - Initializers
25 -public convenience init() {
26 - self.init(nibName: "ViewControllerName", bundle: Bundle(for: MyEmptyClass.self))
27 -}
28 -
29 -public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
30 - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
31 -}
32 -
33 -required init?(coder: NSCoder) {
34 - super.init(coder: coder)
35 -}
36 -```
37 -
38 -## How to Use in Your Demo Client
39 -
40 -### ✅ Correct Usage (Now Works):
41 -```swift
42 -// Simple instantiation - uses convenience initializer
43 -let vc = MyRewardsViewController()
44 -navigationController?.pushViewController(vc, animated: true)
45 -
46 -// Or explicit instantiation
47 -let vc = MyRewardsViewController(nibName: "MyRewardsViewController", bundle: Bundle(for: MyEmptyClass.self))
48 -navigationController?.pushViewController(vc, animated: true)
49 -```
50 -
51 -### ❌ Previous Issue:
52 -Before the fix, when you tried to instantiate view controllers without specifying the bundle, iOS couldn't locate the XIB files in the framework bundle.
53 -
54 -## View Controllers That Don't Need This Fix:
55 -- **CampaignViewController** - Uses storyboard instantiation, not XIB files
56 -
57 -## Framework Structure:
58 -```
59 -SwiftWarplyFramework/
60 -├── SwiftWarplyFramework/
61 -│ ├── screens/
62 -│ │ ├── MyRewardsViewController/
63 -│ │ │ ├── MyRewardsViewController.swift ✅ Fixed
64 -│ │ │ └── MyRewardsViewController.xib
65 -│ │ ├── ProfileViewController/
66 -│ │ │ ├── ProfileViewController.swift ✅ Fixed
67 -│ │ │ └── ProfileViewController.xib
68 -│ │ ├── CouponViewController/
69 -│ │ │ ├── CouponViewController.swift ✅ Fixed
70 -│ │ │ └── CouponViewController.xib
71 -│ │ └── CampaignViewController.swift (Storyboard-based)
72 -│ └── Main.storyboard
73 -```
74 -
75 -## Testing Your Demo Client
76 -After updating your framework dependency, your demo client should now be able to:
77 -
78 -1. ✅ Build successfully (previous podspec fix)
79 -2. ✅ Run without crashing (this NIB loading fix)
80 -3. ✅ Instantiate and display all view controllers properly
81 -
82 -## Example Demo Client Code:
83 -```swift
84 -import SwiftWarplyFramework
85 -
86 -class ViewController: UIViewController {
87 -
88 - @IBAction func showMyRewards(_ sender: Any) {
89 - let vc = MyRewardsViewController()
90 - navigationController?.pushViewController(vc, animated: true)
91 - }
92 -
93 - @IBAction func showProfile(_ sender: Any) {
94 - let vc = ProfileViewController()
95 - navigationController?.pushViewController(vc, animated: true)
96 - }
97 -}
98 -```
99 -
100 -## Next Steps:
101 -1. Update your framework dependency to get these fixes
102 -2. Test your demo client to ensure it works properly
103 -3. All view controllers should now load and display correctly
104 -
105 -The framework is now properly configured for CocoaPods distribution with correct bundle references for all XIB-based view controllers.
...@@ -1405,6 +1405,7 @@ public final class WarplySDK { ...@@ -1405,6 +1405,7 @@ public final class WarplySDK {
1405 showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") 1405 showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
1406 } else { 1406 } else {
1407 let tempCampaign = CampaignItemModel() 1407 let tempCampaign = CampaignItemModel()
1408 + // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
1408 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 1409 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
1409 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 1410 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
1410 let url = getMarketPassMapUrl() 1411 let url = getMarketPassMapUrl()
...@@ -1431,6 +1432,7 @@ public final class WarplySDK { ...@@ -1431,6 +1432,7 @@ public final class WarplySDK {
1431 showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") 1432 showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
1432 } else { 1433 } else {
1433 if let superMarketCampaign = getSupermarketCampaign() { 1434 if let superMarketCampaign = getSupermarketCampaign() {
1435 + // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
1434 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 1436 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
1435 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController 1437 let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
1436 let url = constructCampaignUrl(superMarketCampaign) 1438 let url = constructCampaignUrl(superMarketCampaign)
......
...@@ -45,7 +45,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { ...@@ -45,7 +45,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
45 45
46 46
47 // Register XIBs for collection view cells 47 // Register XIBs for collection view cells
48 - collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell") 48 + collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell")
49 49
50 // Fix background colors 50 // Fix background colors
51 collectionView.backgroundColor = UIColor.clear 51 collectionView.backgroundColor = UIColor.clear
......
...@@ -37,7 +37,7 @@ protocol MyRewardsOffersScrollTableViewCellDelegate: AnyObject { ...@@ -37,7 +37,7 @@ protocol MyRewardsOffersScrollTableViewCellDelegate: AnyObject {
37 allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height 37 allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height
38 38
39 // Register XIBs for collection view cells 39 // Register XIBs for collection view cells
40 - collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell") 40 + collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell")
41 41
42 // Fix background colors 42 // Fix background colors
43 collectionView.backgroundColor = UIColor.clear 43 collectionView.backgroundColor = UIColor.clear
......
...@@ -28,7 +28,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { ...@@ -28,7 +28,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject {
28 titleLabel.text = "Τα κουπόνια μου" 28 titleLabel.text = "Τα κουπόνια μου"
29 29
30 // Register XIBs for collection view cells 30 // Register XIBs for collection view cells
31 - collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell") 31 + collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell")
32 32
33 // Fix background colors 33 // Fix background colors
34 // collectionView.backgroundColor = UIColor.clear 34 // collectionView.backgroundColor = UIColor.clear
......
...@@ -12,7 +12,7 @@ import UIKit ...@@ -12,7 +12,7 @@ import UIKit
12 12
13 // MARK: - Initializers 13 // MARK: - Initializers
14 public convenience init() { 14 public convenience init() {
15 - self.init(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) 15 + self.init(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
16 } 16 }
17 17
18 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 18 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
......
...@@ -13,7 +13,7 @@ import UIKit ...@@ -13,7 +13,7 @@ import UIKit
13 13
14 // MARK: - Initializers 14 // MARK: - Initializers
15 public convenience init() { 15 public convenience init() {
16 - self.init(nibName: "MyRewardsViewController", bundle: Bundle(for: MyEmptyClass.self)) 16 + self.init(nibName: "MyRewardsViewController", bundle: MyEmptyClass.resourceBundle())
17 } 17 }
18 18
19 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 19 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
...@@ -310,8 +310,8 @@ import UIKit ...@@ -310,8 +310,8 @@ import UIKit
310 // self.navigationController?.setNavigationBarHidden(true, animated: false) 310 // self.navigationController?.setNavigationBarHidden(true, animated: false)
311 311
312 // Register XIBs for table view cells 312 // Register XIBs for table view cells
313 - tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell") 313 + tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell")
314 - tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") 314 + tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
315 315
316 // Set up table view 316 // Set up table view
317 tableView.delegate = self 317 tableView.delegate = self
...@@ -417,6 +417,7 @@ import UIKit ...@@ -417,6 +417,7 @@ import UIKit
417 417
418 private func openCampaignViewController(with index: Int) { 418 private func openCampaignViewController(with index: Int) {
419 419
420 + // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
420 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 421 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
421 if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController { 422 if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController {
422 // vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html" 423 // vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html"
...@@ -428,14 +429,14 @@ import UIKit ...@@ -428,14 +429,14 @@ import UIKit
428 } 429 }
429 430
430 private func openCouponViewController(with offer: OfferModel) { 431 private func openCouponViewController(with offer: OfferModel) {
431 - let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) 432 + let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
432 vc.coupon = offer 433 vc.coupon = offer
433 434
434 self.navigationController?.pushViewController(vc, animated: true) 435 self.navigationController?.pushViewController(vc, animated: true)
435 } 436 }
436 437
437 private func openProfileViewController() { 438 private func openProfileViewController() {
438 - let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self)) 439 + let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle())
439 440
440 self.navigationController?.pushViewController(vc, animated: true) 441 self.navigationController?.pushViewController(vc, animated: true)
441 } 442 }
......
...@@ -12,7 +12,7 @@ import UIKit ...@@ -12,7 +12,7 @@ import UIKit
12 12
13 // MARK: - Initializers 13 // MARK: - Initializers
14 public convenience init() { 14 public convenience init() {
15 - self.init(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self)) 15 + self.init(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle())
16 } 16 }
17 17
18 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 18 public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
...@@ -208,11 +208,11 @@ import UIKit ...@@ -208,11 +208,11 @@ import UIKit
208 setNavigationTitle("Το προφίλ μου") 208 setNavigationTitle("Το προφίλ μου")
209 209
210 // Register XIBs for table view cells 210 // Register XIBs for table view cells
211 - tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileHeaderTableViewCell") 211 + tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileHeaderTableViewCell")
212 - tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell") 212 + tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell")
213 - tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") 213 + tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
214 - tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell") 214 + tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell")
215 - tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponTableViewCell") 215 + tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponTableViewCell")
216 216
217 // Set up table view 217 // Set up table view
218 tableView.delegate = self 218 tableView.delegate = self
...@@ -264,7 +264,7 @@ import UIKit ...@@ -264,7 +264,7 @@ import UIKit
264 } 264 }
265 265
266 private func openCouponViewController(with offer: OfferModel) { 266 private func openCouponViewController(with offer: OfferModel) {
267 - let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) 267 + let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
268 vc.coupon = offer 268 vc.coupon = offer
269 269
270 self.navigationController?.pushViewController(vc, animated: true) 270 self.navigationController?.pushViewController(vc, animated: true)
......