Skip to content

Commit

Permalink
be able to build Swift4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
marty-suzuki committed Oct 1, 2018
1 parent a2b1737 commit 4200e3e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Example/PrexSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = PrexSample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -530,6 +531,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = PrexSample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -550,6 +552,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = PrexSampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -572,6 +575,7 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = PrexSampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
6 changes: 4 additions & 2 deletions Example/PrexSample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if swift(>=4.2)
typealias UIApplicationLaunchOptionsKey = UIApplication.LaunchOptionsKey
#endif
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

guard let navigationController = window?.rootViewController as? UINavigationController else {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ struct DetailMutation: Mutation {

final class DetailPresenter: Presenter<DetailAction, DetailState> {

convenience init<View: Prex.View>(view: View) where View.State == DetailState {
self.init(view: view, state: .init(), mutation: DetailMutation())
init<View: Prex.View>(view: View, dispatcher: Dispatcher<DetailAction> = .init()) where View.State == DetailState {
super.init(view: view, state: DetailState(), mutation: DetailMutation(), dispatcher: dispatcher)
}

func progressUpdateParams(from progress: Double) -> ProgressUpdateParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ extension Presenter where Action == SearchAction, State == SearchState {
fetchRepositories(query: query, page: next, session: session)
}

func selectedIndexPath(_ indexPath: IndexPath) {
let repository = state.repositories[indexPath.row]
func selectedIndexPath(_ indexPath: IndexPath?) {
let repository = indexPath.map { state.repositories[$0.row] }
dispatch(.setSelectedRepository(repository))
}

Expand Down
6 changes: 6 additions & 0 deletions Example/PrexSample/View/Search/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ final class SearchViewController: UIViewController {
navigationItem.titleView = searchBar
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

presenter.selectedIndexPath(nil)
}

private func refrectEditing() {
UIView.animate(withDuration: 0.3) {
if self.presenter.state.isEditing {
Expand Down

0 comments on commit 4200e3e

Please sign in to comment.