segue_handler_plugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +30 -0
  3. data/Example/.ruby-version +1 -0
  4. data/Example/Gemfile +5 -0
  5. data/Example/Gemfile.lock +71 -0
  6. data/Example/Podfile +6 -0
  7. data/Example/Podfile.lock +14 -0
  8. data/Example/Pods/Headers/Private/WillowTreeSegueHandler/SegueHandler.h +19 -0
  9. data/Example/Pods/Local Podspecs/WillowTreeSegueHandler.podspec.json +25 -0
  10. data/Example/Pods/Manifest.lock +14 -0
  11. data/Example/Pods/Pods.xcodeproj/project.pbxproj +523 -0
  12. data/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/WillowTreeSegueHandler.xcscheme +60 -0
  13. data/Example/Pods/Target Support Files/Pods/Info.plist +26 -0
  14. data/Example/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown +26 -0
  15. data/Example/Pods/Target Support Files/Pods/Pods-acknowledgements.plist +56 -0
  16. data/Example/Pods/Target Support Files/Pods/Pods-dummy.m +5 -0
  17. data/Example/Pods/Target Support Files/Pods/Pods-frameworks.sh +91 -0
  18. data/Example/Pods/Target Support Files/Pods/Pods-resources.sh +95 -0
  19. data/Example/Pods/Target Support Files/Pods/Pods-umbrella.h +6 -0
  20. data/Example/Pods/Target Support Files/Pods/Pods.debug.xcconfig +8 -0
  21. data/Example/Pods/Target Support Files/Pods/Pods.modulemap +6 -0
  22. data/Example/Pods/Target Support Files/Pods/Pods.release.xcconfig +8 -0
  23. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/Info.plist +26 -0
  24. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/WillowTreeSegueHandler-dummy.m +5 -0
  25. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/WillowTreeSegueHandler-prefix.pch +4 -0
  26. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/WillowTreeSegueHandler-umbrella.h +7 -0
  27. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/WillowTreeSegueHandler.modulemap +6 -0
  28. data/Example/Pods/Target Support Files/WillowTreeSegueHandler/WillowTreeSegueHandler.xcconfig +5 -0
  29. data/Example/SegueBuilder.xcodeproj/project.pbxproj +390 -0
  30. data/Example/SegueBuilder.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  31. data/Example/SegueBuilder.xcworkspace/contents.xcworkspacedata +10 -0
  32. data/Example/SegueBuilder/AppDelegate.swift +49 -0
  33. data/Example/SegueBuilder/Assets.xcassets/AppIcon.appiconset/Contents.json +73 -0
  34. data/Example/SegueBuilder/Base.lproj/LaunchScreen.storyboard +27 -0
  35. data/Example/SegueBuilder/Base.lproj/Main.storyboard +151 -0
  36. data/Example/SegueBuilder/Info.plist +45 -0
  37. data/Example/SegueBuilder/SegueExtensions.swift +57 -0
  38. data/Example/SegueBuilder/ViewControllers.swift +77 -0
  39. data/Example/Storyboards.swift +0 -0
  40. data/Example/test.sh +20 -0
  41. data/LICENSE +19 -0
  42. data/README.md +75 -0
  43. data/WillowTreeSegueHandler.podspec +23 -0
  44. data/exe/segue-handler-generator +1107 -0
  45. data/exe/segue-handler-generator-build +30 -0
  46. data/lib/cocoapods_plugin.rb +1 -0
  47. data/lib/pod/command/generate_segue_handlers.rb +31 -0
  48. data/lib/segue_handler_plugin.rb +4 -0
  49. data/lib/segue_handler_plugin/version.rb +3 -0
  50. data/segue_handler_plugin.gemspec +20 -0
  51. metadata +95 -0
@@ -0,0 +1,73 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "iphone",
5
+ "size" : "29x29",
6
+ "scale" : "2x"
7
+ },
8
+ {
9
+ "idiom" : "iphone",
10
+ "size" : "29x29",
11
+ "scale" : "3x"
12
+ },
13
+ {
14
+ "idiom" : "iphone",
15
+ "size" : "40x40",
16
+ "scale" : "2x"
17
+ },
18
+ {
19
+ "idiom" : "iphone",
20
+ "size" : "40x40",
21
+ "scale" : "3x"
22
+ },
23
+ {
24
+ "idiom" : "iphone",
25
+ "size" : "60x60",
26
+ "scale" : "2x"
27
+ },
28
+ {
29
+ "idiom" : "iphone",
30
+ "size" : "60x60",
31
+ "scale" : "3x"
32
+ },
33
+ {
34
+ "idiom" : "ipad",
35
+ "size" : "29x29",
36
+ "scale" : "1x"
37
+ },
38
+ {
39
+ "idiom" : "ipad",
40
+ "size" : "29x29",
41
+ "scale" : "2x"
42
+ },
43
+ {
44
+ "idiom" : "ipad",
45
+ "size" : "40x40",
46
+ "scale" : "1x"
47
+ },
48
+ {
49
+ "idiom" : "ipad",
50
+ "size" : "40x40",
51
+ "scale" : "2x"
52
+ },
53
+ {
54
+ "idiom" : "ipad",
55
+ "size" : "76x76",
56
+ "scale" : "1x"
57
+ },
58
+ {
59
+ "idiom" : "ipad",
60
+ "size" : "76x76",
61
+ "scale" : "2x"
62
+ },
63
+ {
64
+ "idiom" : "ipad",
65
+ "size" : "83.5x83.5",
66
+ "scale" : "2x"
67
+ }
68
+ ],
69
+ "info" : {
70
+ "version" : 1,
71
+ "author" : "xcode"
72
+ }
73
+ }
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
5
+ </dependencies>
6
+ <scenes>
7
+ <!--View Controller-->
8
+ <scene sceneID="EHf-IW-A2E">
9
+ <objects>
10
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
11
+ <layoutGuides>
12
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
13
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
14
+ </layoutGuides>
15
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
17
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18
+ <animations/>
19
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
20
+ </view>
21
+ </viewController>
22
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
23
+ </objects>
24
+ <point key="canvasLocation" x="53" y="375"/>
25
+ </scene>
26
+ </scenes>
27
+ </document>
@@ -0,0 +1,151 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="cYr-SB-2cf">
3
+ <dependencies>
4
+ <deployment identifier="iOS"/>
5
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
6
+ </dependencies>
7
+ <scenes>
8
+ <!--Navigation Controller-->
9
+ <scene sceneID="jNb-uP-S5o">
10
+ <objects>
11
+ <navigationController id="cYr-SB-2cf" sceneMemberID="viewController">
12
+ <navigationBar key="navigationBar" contentMode="scaleToFill" id="2Ef-oE-0CC">
13
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
14
+ <autoresizingMask key="autoresizingMask"/>
15
+ </navigationBar>
16
+ <connections>
17
+ <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="d7t-VC-orW"/>
18
+ </connections>
19
+ </navigationController>
20
+ <placeholder placeholderIdentifier="IBFirstResponder" id="mfZ-bN-IMA" userLabel="First Responder" sceneMemberID="firstResponder"/>
21
+ </objects>
22
+ <point key="canvasLocation" x="-437" y="429"/>
23
+ </scene>
24
+ <!--A-->
25
+ <scene sceneID="tne-QT-ifu">
26
+ <objects>
27
+ <viewController storyboardIdentifier="InitialA" id="BYZ-38-t0r" customClass="A" customModule="SegueBuilder" customModuleProvider="target" sceneMemberID="viewController">
28
+ <layoutGuides>
29
+ <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
30
+ <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
31
+ </layoutGuides>
32
+ <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
33
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
34
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
35
+ <subviews>
36
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="llE-Kk-1Ae">
37
+ <rect key="frame" x="283" y="285" width="35" height="30"/>
38
+ <state key="normal" title="Push"/>
39
+ <connections>
40
+ <segue destination="DVX-0f-6fn" kind="show" identifier="ToB" id="Uyr-J8-xAZ"/>
41
+ </connections>
42
+ </button>
43
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="M3J-R5-7KX">
44
+ <rect key="frame" x="250" y="323" width="100" height="30"/>
45
+ <state key="normal" title="Push Manually"/>
46
+ <connections>
47
+ <action selector="pushManually" destination="BYZ-38-t0r" eventType="touchUpInside" id="e9O-SM-L2L"/>
48
+ </connections>
49
+ </button>
50
+ </subviews>
51
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
52
+ <constraints>
53
+ <constraint firstItem="llE-Kk-1Ae" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="Upg-gW-IsW"/>
54
+ <constraint firstItem="llE-Kk-1Ae" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="nCb-l6-nnj"/>
55
+ <constraint firstItem="M3J-R5-7KX" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="nfi-r1-cXa"/>
56
+ <constraint firstItem="M3J-R5-7KX" firstAttribute="top" secondItem="llE-Kk-1Ae" secondAttribute="bottom" constant="8" id="qgx-9Z-h3h"/>
57
+ </constraints>
58
+ </view>
59
+ <navigationItem key="navigationItem" title="A" id="nTT-ZW-ZfE"/>
60
+ </viewController>
61
+ <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
62
+ </objects>
63
+ <point key="canvasLocation" x="283" y="429"/>
64
+ </scene>
65
+ <!--B-->
66
+ <scene sceneID="nvg-K6-yaY">
67
+ <objects>
68
+ <viewController id="DVX-0f-6fn" customClass="B" customModule="SegueBuilder" customModuleProvider="target" sceneMemberID="viewController">
69
+ <layoutGuides>
70
+ <viewControllerLayoutGuide type="top" id="bmA-k0-nWx"/>
71
+ <viewControllerLayoutGuide type="bottom" id="bsU-hQ-MKP"/>
72
+ </layoutGuides>
73
+ <view key="view" contentMode="scaleToFill" id="XJQ-oq-wRw">
74
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
75
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
76
+ <subviews>
77
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vsk-la-vOg">
78
+ <rect key="frame" x="279" y="285" width="43" height="30"/>
79
+ <state key="normal" title="Modal"/>
80
+ <connections>
81
+ <segue destination="VgM-Fw-XvL" kind="presentation" identifier="ToCViaNav" id="6UN-lq-6mT"/>
82
+ </connections>
83
+ </button>
84
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rxQ-2e-c9f">
85
+ <rect key="frame" x="283" y="323" width="35" height="30"/>
86
+ <state key="normal" title="Push"/>
87
+ <connections>
88
+ <segue destination="B5I-ip-XTx" kind="show" identifier="CDirectly" id="MWd-7E-11v"/>
89
+ </connections>
90
+ </button>
91
+ </subviews>
92
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
93
+ <constraints>
94
+ <constraint firstItem="rxQ-2e-c9f" firstAttribute="centerX" secondItem="vsk-la-vOg" secondAttribute="centerX" id="K63-mc-RKh"/>
95
+ <constraint firstItem="vsk-la-vOg" firstAttribute="centerY" secondItem="XJQ-oq-wRw" secondAttribute="centerY" id="MRl-JW-LpV"/>
96
+ <constraint firstItem="rxQ-2e-c9f" firstAttribute="top" secondItem="vsk-la-vOg" secondAttribute="bottom" constant="8" id="OHl-Hu-JrR"/>
97
+ <constraint firstItem="vsk-la-vOg" firstAttribute="centerX" secondItem="XJQ-oq-wRw" secondAttribute="centerX" id="uFi-uX-bua"/>
98
+ </constraints>
99
+ </view>
100
+ <navigationItem key="navigationItem" title="B" id="N6S-8E-7l1" userLabel="B"/>
101
+ </viewController>
102
+ <placeholder placeholderIdentifier="IBFirstResponder" id="sZJ-vG-g8R" userLabel="First Responder" sceneMemberID="firstResponder"/>
103
+ </objects>
104
+ <point key="canvasLocation" x="987" y="429"/>
105
+ </scene>
106
+ <!--Navigation Controller-->
107
+ <scene sceneID="X0i-nv-g2V">
108
+ <objects>
109
+ <navigationController id="VgM-Fw-XvL" sceneMemberID="viewController">
110
+ <navigationBar key="navigationBar" contentMode="scaleToFill" id="t0w-SC-x4J">
111
+ <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
112
+ <autoresizingMask key="autoresizingMask"/>
113
+ </navigationBar>
114
+ <connections>
115
+ <segue destination="B5I-ip-XTx" kind="relationship" relationship="rootViewController" id="ziW-v4-iE6"/>
116
+ </connections>
117
+ </navigationController>
118
+ <placeholder placeholderIdentifier="IBFirstResponder" id="6vB-UY-Ymc" userLabel="First Responder" sceneMemberID="firstResponder"/>
119
+ </objects>
120
+ <point key="canvasLocation" x="987" y="1134"/>
121
+ </scene>
122
+ <!--C-->
123
+ <scene sceneID="d7h-Cv-9Mt">
124
+ <objects>
125
+ <viewController id="B5I-ip-XTx" customClass="C" customModule="SegueBuilder" customModuleProvider="target" sceneMemberID="viewController">
126
+ <layoutGuides>
127
+ <viewControllerLayoutGuide type="top" id="2yS-wz-WAq"/>
128
+ <viewControllerLayoutGuide type="bottom" id="lpY-jq-cwc"/>
129
+ </layoutGuides>
130
+ <view key="view" contentMode="scaleToFill" id="B02-1J-dq2">
131
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
132
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
133
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
134
+ </view>
135
+ <navigationItem key="navigationItem" title="C" id="kVh-L3-GXY">
136
+ <barButtonItem key="rightBarButtonItem" systemItem="done" id="z2Z-P9-pv3">
137
+ <connections>
138
+ <action selector="dismiss" destination="B5I-ip-XTx" id="tr5-KT-YRr"/>
139
+ </connections>
140
+ </barButtonItem>
141
+ </navigationItem>
142
+ </viewController>
143
+ <placeholder placeholderIdentifier="IBFirstResponder" id="zr1-hZ-FrT" userLabel="First Responder" sceneMemberID="firstResponder"/>
144
+ </objects>
145
+ <point key="canvasLocation" x="1698" y="1134"/>
146
+ </scene>
147
+ </scenes>
148
+ <inferredMetricsTieBreakers>
149
+ <segue reference="MWd-7E-11v"/>
150
+ </inferredMetricsTieBreakers>
151
+ </document>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>APPL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ <key>LSRequiresIPhoneOS</key>
24
+ <true/>
25
+ <key>UILaunchStoryboardName</key>
26
+ <string>LaunchScreen</string>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ <string>UIInterfaceOrientationLandscapeLeft</string>
35
+ <string>UIInterfaceOrientationLandscapeRight</string>
36
+ </array>
37
+ <key>UISupportedInterfaceOrientations~ipad</key>
38
+ <array>
39
+ <string>UIInterfaceOrientationPortrait</string>
40
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
41
+ <string>UIInterfaceOrientationLandscapeLeft</string>
42
+ <string>UIInterfaceOrientationLandscapeRight</string>
43
+ </array>
44
+ </dict>
45
+ </plist>
@@ -0,0 +1,57 @@
1
+ //
2
+ // Generated Code. Do not modify.
3
+ //
4
+ // Generated by a fork of Natalie:
5
+ // - https://github.com/ianterrell/Natalie
6
+ // - https://github.com/krzyzanowskim/Natalie
7
+ // - http://blog.krzyzanowskim.com
8
+ //
9
+
10
+ import UIKit
11
+ import WillowTreeSegueHandler
12
+
13
+ // MARK: - B
14
+
15
+ extension B: SegueHandler {
16
+ enum SegueIdentifier: String {
17
+ case ToCViaNav
18
+ case CDirectly
19
+ }
20
+
21
+ enum ToSegueDestination: SegueDestination {
22
+ case ToCViaNav(C)
23
+ case CDirectly(C)
24
+
25
+ init?(identifier: SegueIdentifier, destination: UIViewController) {
26
+ switch identifier {
27
+ case .ToCViaNav:
28
+ guard let nav = destination as? UINavigationController else { return nil }
29
+ guard let vc = nav.viewControllers.first as? C else { return nil }
30
+ self = ToCViaNav(vc)
31
+ case .CDirectly:
32
+ guard let vc = destination as? C else { return nil }
33
+ self = CDirectly(vc)
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ // MARK: - A
40
+
41
+ extension A: SegueHandler {
42
+ enum SegueIdentifier: String {
43
+ case ToB
44
+ }
45
+
46
+ enum ToSegueDestination: SegueDestination {
47
+ case ToB(B)
48
+
49
+ init?(identifier: SegueIdentifier, destination: UIViewController) {
50
+ switch identifier {
51
+ case .ToB:
52
+ guard let vc = destination as? B else { return nil }
53
+ self = ToB(vc)
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,77 @@
1
+ //
2
+ // ViewController.swift
3
+ // SegueBuilder
4
+ //
5
+ // Created by Ian Terrell on 2/18/16.
6
+ // Copyright © 2016 WillowTree. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+
11
+ final class A: UIViewController {
12
+ var dependency: String!
13
+
14
+ static func build(dependency dependency: String) -> A {
15
+ let storyboard = UIStoryboard(name: "Main", bundle: nil)
16
+ let controller = storyboard.instantiateViewControllerWithIdentifier("InitialA") as! A
17
+ controller.prepare(dependency: dependency)
18
+ return controller
19
+ }
20
+
21
+ func prepare(dependency dependency: String) {
22
+ self.dependency = dependency
23
+ }
24
+
25
+ @IBAction func pushManually() {
26
+ performSegue(.ToB, sender: self)
27
+ }
28
+
29
+ override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
30
+ switch segueFromStoryboardSegue(segue) {
31
+ case .ToB(let b):
32
+ b.prepare(dependency: "injected from a")
33
+ }
34
+ }
35
+
36
+ override func viewDidAppear(animated: Bool) {
37
+ print("\(self.dynamicType): \(dependency)")
38
+ }
39
+ }
40
+
41
+ final class B: UIViewController {
42
+ var dependency: String!
43
+
44
+ func prepare(dependency dependency: String) {
45
+ self.dependency = dependency
46
+ }
47
+
48
+ override func viewDidAppear(animated: Bool) {
49
+ print("\(self.dynamicType): \(dependency)")
50
+ }
51
+
52
+ override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
53
+ switch segueFromStoryboardSegue(segue) {
54
+ case .ToCViaNav(let c):
55
+ c.prepare(dependency: "injected from b through nav controller")
56
+ case .CDirectly(let c):
57
+ c.prepare(dependency: "injected directly from b")
58
+ }
59
+ }
60
+ }
61
+
62
+ final class C: UIViewController {
63
+ var dependency: String!
64
+
65
+ func prepare(dependency dependency: String) {
66
+ self.dependency = dependency
67
+ }
68
+
69
+ @IBAction func dismiss() {
70
+ dismissViewControllerAnimated(true, completion: nil)
71
+ }
72
+
73
+ override func viewDidAppear(animated: Bool) {
74
+ print("\(self.dynamicType): \(dependency)")
75
+ }
76
+ }
77
+
File without changes
data/Example/test.sh ADDED
@@ -0,0 +1,20 @@
1
+ echo "Segue Generator: Determining if generated Swift file is up-to-date."
2
+
3
+ GENERATOR_PATH="segue-handler-generator"
4
+
5
+ BASE_PATH="$PROJECT_DIR/$PROJECT_NAME"
6
+ OUTPUT_PATH="$BASE_PATH/SegueExtensions.swift"
7
+
8
+ if [ ! -e "$OUTPUT_PATH" ] || [ -n "$(find "$BASE_PATH" -type f -name "*.storyboard" -newer "$OUTPUT_PATH" -print -quit)" ]; then
9
+ echo "Segue Generator: Generated Swift is out-of-date; re-generating..."
10
+
11
+ if [ -f $OUTPUT_PATH ]; then
12
+ /usr/bin/chflags -f nouchg "$OUTPUT_PATH"
13
+ fi
14
+ "$GENERATOR_PATH" "$BASE_PATH" > "$OUTPUT_PATH"
15
+ /usr/bin/chflags uchg "$OUTPUT_PATH"
16
+
17
+ echo "Segue Generator: Done."
18
+ else
19
+ echo "Segue Generator: Generated Swift is up-to-date; skipping re-generation."
20
+ fi