Skip to content

Commit

Permalink
feat(core): begin router automation ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBrisorgueil committed Oct 25, 2019
1 parent 49692b0 commit 539bf54
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions waosSwift.xcodeproj/project.pbxproj
Expand Up @@ -31,6 +31,7 @@
BF425490221EBB9800395AE6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF42548E221EBB9800395AE6 /* LaunchScreen.storyboard */; };
BF42549B221EBB9800395AE6 /* waosSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF42549A221EBB9800395AE6 /* waosSwiftTests.swift */; };
BF4254A6221EBB9800395AE6 /* waosSwiftUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF4254A5221EBB9800395AE6 /* waosSwiftUITests.swift */; };
BF49EA0D2362CC2D00FF06E9 /* L10n.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF49EA0C2362CC2D00FF06E9 /* L10n.swift */; };
BF4A2F37225B4F7F0001B4CE /* RxFlow.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4A2F31225B4F7F0001B4CE /* RxFlow.framework */; };
BF4A2F3A225B4F7F0001B4CE /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4A2F34225B4F7F0001B4CE /* RxCocoa.framework */; };
BF4A2F45225B751F0001B4CE /* AppFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF4A2F44225B751F0001B4CE /* AppFlow.swift */; };
Expand Down Expand Up @@ -181,6 +182,7 @@
BF4254A1221EBB9800395AE6 /* waosSwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = waosSwiftUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BF4254A5221EBB9800395AE6 /* waosSwiftUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = waosSwiftUITests.swift; sourceTree = "<group>"; };
BF4254A7221EBB9800395AE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BF49EA0C2362CC2D00FF06E9 /* L10n.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = L10n.swift; sourceTree = "<group>"; };
BF4A2F31225B4F7F0001B4CE /* RxFlow.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxFlow.framework; path = Carthage/Build/iOS/RxFlow.framework; sourceTree = "<group>"; };
BF4A2F32225B4F7F0001B4CE /* RxBlocking.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxBlocking.framework; path = Carthage/Build/iOS/RxBlocking.framework; sourceTree = "<group>"; };
BF4A2F34225B4F7F0001B4CE /* RxCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxCocoa.framework; path = Carthage/Build/iOS/RxCocoa.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -648,6 +650,7 @@
BF4A2FD32265F4020001B4CE /* UserDefaults.swift */,
BF8BD5F6235F30660083B912 /* KeyboardConstraints.swift */,
BF3B775B2360C35D00ECD30A /* UIColor.swift */,
BF49EA0C2362CC2D00FF06E9 /* L10n.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -1086,6 +1089,7 @@
BF78B624229949740057157A /* AuthSignupReactor.swift in Sources */,
BF8C67332280222A0012B5A8 /* UITableView+RxReusableKit.swift in Sources */,
BF425484221EBB9700395AE6 /* AppDelegate.swift in Sources */,
BF49EA0D2362CC2D00FF06E9 /* L10n.swift in Sources */,
BF19509622B7CEEB00C593E5 /* Url.swift in Sources */,
BFDE2600227B053D008CBD30 /* UIViewController+Rx.swift in Sources */,
BF794D3A22671CD8000B19F3 /* TasksModel.swift in Sources */,
Expand Down
17 changes: 17 additions & 0 deletions waosSwift/config/default/development.json
Expand Up @@ -26,6 +26,23 @@
"unknown": "☠️ UNKNOWN"
}
},
"router": [
{
"name": "task_title",
"meta": {
"icon": "tasks",
"width": 30,
"height": 30
}
}, {
"name": "second_title",
"meta": {
"icon": "sun",
"width": 30,
"height": 30
}
}
],
"theme": {
"colorTabBar": "false",
"themes": {
Expand Down
7 changes: 7 additions & 0 deletions waosSwift/lib/helpers/Extensions/L10n.swift
@@ -0,0 +1,7 @@
extension L10n {
static func get(_ table: String, _ key: String) -> String {
// swiftlint:disable:next nslocalizedstring_key
let format = NSLocalizedString(key, tableName: table, comment: "")
return String(format: format, locale: Locale.current)
}
}
9 changes: 3 additions & 6 deletions waosSwift/modules/core/flows/CoreFlow.swift
Expand Up @@ -32,13 +32,10 @@ final class CoreFlow: Flow {
let secondFlow = SecondFlow(withServices: self.services)

Flows.whenReady(flow1: tasksFlow, flow2: secondFlow) { [unowned self] (root1: UINavigationController, root2: UINavigationController) in
let tabBarItem1 = UITabBarItem(title: L10n.taskTitle, image: UIImage.fontAwesomeIcon(code: "fa-tasks", style: .solid, textColor: .blue, size: CGSize(width: 30, height: 30)), selectedImage: nil)
let tabBarItem2 = UITabBarItem(title: L10n.taskTitle, image: UIImage.fontAwesomeIcon(code: "fa-sun", style: .solid, textColor: .blue, size: CGSize(width: 30, height: 30)), selectedImage: nil)

root1.tabBarItem = tabBarItem1
root1.title = L10n.taskTitle
root2.tabBarItem = tabBarItem2
root2.title = L10n.secondTitle
root1.tabBarItem = UITabBarItem(title: L10n.get("Localizable", config["router"][0]["name"].string ?? ""), image: UIImage.fontAwesomeIcon(code: "fa-" + (config["router"][0]["meta"]["icon"].string ?? ""), style: .solid, textColor: .blue, size: CGSize(width: config["router"][0]["meta"]["width"].int ?? 0, height: config["router"][0]["meta"]["height"].int ?? 0)), selectedImage: nil)

root2.tabBarItem = UITabBarItem(title: L10n.get("Localizable", config["router"][1]["name"].string ?? ""), image: UIImage.fontAwesomeIcon(code: "fa-" + (config["router"][1]["meta"]["icon"].string ?? ""), style: .solid, textColor: .blue, size: CGSize(width: config["router"][1]["meta"]["width"].int ?? 0, height: config["router"][1]["meta"]["height"].int ?? 0)), selectedImage: nil)

self.rootViewController.setViewControllers([root1, root2], animated: false)
}
Expand Down

0 comments on commit 539bf54

Please sign in to comment.