Skip to content

Commit

Permalink
Refactor LocationVC presentation to popover
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcurylo committed Mar 13, 2019
1 parent c5d5943 commit 8bbe86c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
4 changes: 2 additions & 2 deletions MTP/interface/rankings/RankingsFilterVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ final class RankingsFilterVC: UITableViewController, ServiceProvider {
log.verbose("prepare for \(segue.name)")
switch segue.identifier {
case Segues.showCountry.identifier:
if let destination = Segues.showCountry(segue: segue)?.destination {
if let destination = Segues.showCountry(segue: segue)?.destination.topViewController as? LocationSearchVC {
destination.set(list: .countries,
styler: .standard,
delegate: self)
}
case Segues.showLocation.identifier:
if let destination = Segues.showLocation(segue: segue)?.destination {
if let destination = Segues.showLocation(segue: segue)?.destination.topViewController as? LocationSearchVC {
let country = current?.countryId
destination.set(list: .locations(country: country),
styler: .standard,
Expand Down
4 changes: 2 additions & 2 deletions MTP/interface/startup/SignupVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ final class SignupVC: UIViewController, KeyboardListener, ServiceProvider {
alert?.destination.errorMessage = errorMessage
hide(navBar: true)
case Segues.showCountry.identifier:
if let destination = Segues.showCountry(segue: segue)?.destination {
if let destination = Segues.showCountry(segue: segue)?.destination.topViewController as? LocationSearchVC {
destination.set(list: .country,
styler: .login,
delegate: self)
}
case Segues.showLocation.identifier:
if let destination = Segues.showLocation(segue: segue)?.destination {
if let destination = Segues.showLocation(segue: segue)?.destination.topViewController as? LocationSearchVC {
let countryId = country?.countryId
destination.set(list: .location(country: countryId),
styler: .login,
Expand Down
36 changes: 29 additions & 7 deletions MTP/resources/Base.lproj/LocationSearch.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="clk-57-GkD">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="WEt-w0-tN3">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.31"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -51,7 +51,13 @@
<outlet property="delegate" destination="clk-57-GkD" id="c5Q-Lv-EgM"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Select" id="bt1-6E-UmI"/>
<navigationItem key="navigationItem" title="Select" id="bt1-6E-UmI">
<barButtonItem key="leftBarButtonItem" title="Item" image="navClose" id="SDr-Ho-8iX">
<connections>
<segue destination="WEt-w0-tN3" kind="custom" identifier="pop" customClass="DismissSegue" customModule="MTP" customModuleProvider="target" id="8qZ-cu-MVK"/>
</connections>
</barButtonItem>
</navigationItem>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="entityName" value="Location"/>
<userDefinedRuntimeAttribute type="string" keyPath="searchPropertyKeyPath" value="locationName"/>
Expand All @@ -62,13 +68,29 @@
</userDefinedRuntimeAttributes>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5pI-5d-1VL" userLabel="First Responder" sceneMemberID="firstResponder"/>
<barButtonItem style="plain" systemItem="cancel" id="SDr-Ho-8iX">
</objects>
<point key="canvasLocation" x="4956" y="-472"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="saV-4g-Dou">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="WEt-w0-tN3" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="ddl-fF-sFB">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="clk-57-GkD" kind="custom" identifier="pop" customClass="PopSegue" customModule="MTP" customModuleProvider="target" id="8qZ-cu-MVK"/>
<segue destination="clk-57-GkD" kind="relationship" relationship="rootViewController" id="PZD-zZ-XRu"/>
</connections>
</barButtonItem>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="tN2-Dc-H4l" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3919" y="-454"/>
<point key="canvasLocation" x="3917.5999999999999" y="-454.72263868065971"/>
</scene>
</scenes>
<resources>
<image name="navClose" width="16" height="16"/>
</resources>
</document>
8 changes: 6 additions & 2 deletions MTP/resources/Base.lproj/RankingsFilter.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,16 @@
<exit id="uxq-Yu-xPh" userLabel="Exit" sceneMemberID="exit"/>
<tapGestureRecognizer id="rUm-jN-Jw5" userLabel="Tap Country">
<connections>
<segue destination="T4t-4J-rRI" kind="show" identifier="showCountry" id="5Vg-PH-PpB"/>
<segue destination="T4t-4J-rRI" kind="popoverPresentation" identifier="showCountry" popoverAnchorView="MxR-4w-2bq" id="5Vg-PH-PpB">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</tapGestureRecognizer>
<tapGestureRecognizer id="MNo-lH-faV" userLabel="Tap Location">
<connections>
<segue destination="T4t-4J-rRI" kind="show" identifier="showLocation" id="6kA-98-phq"/>
<segue destination="T4t-4J-rRI" kind="popoverPresentation" identifier="showLocation" popoverAnchorView="b15-Lc-sFx" id="6kA-98-phq">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</tapGestureRecognizer>
</objects>
Expand Down
8 changes: 6 additions & 2 deletions MTP/resources/Base.lproj/Signup.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="VZf-fG-PrW" id="76K-9t-IT6"/>
<segue destination="PfS-HC-PPO" kind="show" identifier="showCountry" id="a8e-iA-t1V"/>
<segue destination="PfS-HC-PPO" kind="popoverPresentation" identifier="showCountry" popoverAnchorView="of2-5v-sav" id="a8e-iA-t1V">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="State/Province" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="0wm-Do-yw1" customClass="InsetTextField" customModule="MTP" customModuleProvider="target">
Expand All @@ -230,7 +232,9 @@
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="VZf-fG-PrW" id="KyT-vj-3QI"/>
<segue destination="PfS-HC-PPO" kind="show" identifier="showLocation" id="hkf-mG-nci"/>
<segue destination="PfS-HC-PPO" kind="popoverPresentation" identifier="showLocation" popoverAnchorView="0wm-Do-yw1" id="hkf-mG-nci">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Birthday" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="TD2-H5-D6D" customClass="InsetTextField" customModule="MTP" customModuleProvider="target">
Expand Down

0 comments on commit 8bbe86c

Please sign in to comment.