Skip to content

Commit 13a85a2

Browse files
committed
feat(demo): add SemiViewController
1 parent 949e718 commit 13a85a2

4 files changed

Lines changed: 53 additions & 1 deletion

File tree

Demo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
8D4B7D561D853F1B0013459B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D4B7D4E1D853F1B0013459B /* Main.storyboard */; };
2121
8D4B7D571D853F1B0013459B /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4B7D501D853F1B0013459B /* FirstViewController.swift */; };
2222
8D4B7D591D853F1B0013459B /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4B7D521D853F1B0013459B /* SecondViewController.swift */; };
23+
8D76E7152150D0320019CC99 /* SemiViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D76E7142150D0320019CC99 /* SemiViewController.swift */; };
2324
/* End PBXBuildFile section */
2425

2526
/* Begin PBXFileReference section */
@@ -39,6 +40,7 @@
3940
8D4B7D511D853F1B0013459B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4041
8D4B7D521D853F1B0013459B /* SecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = "<group>"; };
4142
8D642E6E1D79758E00C45795 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
43+
8D76E7142150D0320019CC99 /* SemiViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SemiViewController.swift; sourceTree = "<group>"; };
4244
BF8C779DD9D1680FE694014C /* Pods-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig"; sourceTree = "<group>"; };
4345
D8742E3B9E9E66188D37018C /* Pods_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4446
EC450E88D8C6359EF36F028C /* Pods-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig"; sourceTree = "<group>"; };
@@ -72,6 +74,7 @@
7274
8D4B7D491D853F1B0013459B /* Demo */ = {
7375
isa = PBXGroup;
7476
children = (
77+
8D76E7142150D0320019CC99 /* SemiViewController.swift */,
7578
8D4B7D4A1D853F1B0013459B /* AppDelegate.swift */,
7679
8D4B7D4B1D853F1B0013459B /* Assets.xcassets */,
7780
8D4B7D4C1D853F1B0013459B /* LaunchScreen.storyboard */,
@@ -234,6 +237,7 @@
234237
isa = PBXSourcesBuildPhase;
235238
buildActionMask = 2147483647;
236239
files = (
240+
8D76E7152150D0320019CC99 /* SemiViewController.swift in Sources */,
237241
8D4B7D461D853DE80013459B /* UIView+SemiModalViewController.swift in Sources */,
238242
8D4B7D441D853DE80013459B /* UIDevice+SemiModalViewController.swift in Sources */,
239243
8D4B7D431D853DE80013459B /* ClosureWrapper.swift in Sources */,

Demo/Base.lproj/Main.storyboard

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,37 @@
7373
</objects>
7474
<point key="canvasLocation" x="750" y="360"/>
7575
</scene>
76+
<!--Semi View Controller-->
77+
<scene sceneID="gBQ-dE-y2o">
78+
<objects>
79+
<viewController storyboardIdentifier="SemiViewController" id="adr-16-RZd" customClass="SemiViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
80+
<layoutGuides>
81+
<viewControllerLayoutGuide type="top" id="Idh-iG-MRu"/>
82+
<viewControllerLayoutGuide type="bottom" id="OGV-wU-MU2"/>
83+
</layoutGuides>
84+
<view key="view" contentMode="scaleToFill" id="EIs-ZN-W3Y">
85+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
86+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
87+
<subviews>
88+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S6w-oO-MBj">
89+
<rect key="frame" x="160" y="318.5" width="54" height="30"/>
90+
<state key="normal" title="Dismiss"/>
91+
<connections>
92+
<action selector="dismiss:" destination="adr-16-RZd" eventType="touchUpInside" id="97s-yT-Vve"/>
93+
</connections>
94+
</button>
95+
</subviews>
96+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
97+
<constraints>
98+
<constraint firstItem="S6w-oO-MBj" firstAttribute="centerY" secondItem="EIs-ZN-W3Y" secondAttribute="centerY" id="R6C-X5-JBU"/>
99+
<constraint firstItem="S6w-oO-MBj" firstAttribute="centerX" secondItem="EIs-ZN-W3Y" secondAttribute="centerX" id="kqk-z9-aZF"/>
100+
</constraints>
101+
</view>
102+
</viewController>
103+
<placeholder placeholderIdentifier="IBFirstResponder" id="PoW-ah-VZl" userLabel="First Responder" sceneMemberID="firstResponder"/>
104+
</objects>
105+
<point key="canvasLocation" x="1569" y="359"/>
106+
</scene>
76107
<!--Tab Bar Controller-->
77108
<scene sceneID="yl2-sM-qoP">
78109
<objects>

Demo/SecondViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ class SecondViewController: UIViewController {
1212
SemiModalOption.pushParentBack: false
1313
]
1414

15-
let controller = UIViewController()
15+
let storyboard = UIStoryboard(name: "Main", bundle: nil)
16+
let identifier = String(describing: SemiViewController.self)
17+
let controller = storyboard.instantiateViewController(withIdentifier: identifier)
1618

1719
controller.view.height = 200
1820
controller.view.backgroundColor = UIColor.red

Demo/SemiViewController.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Foundation
2+
import UIKit
3+
4+
class SemiViewController: UIViewController {
5+
6+
override func awakeFromNib() {
7+
super.awakeFromNib()
8+
9+
}
10+
11+
@IBAction func dismiss(_ sender: AnyObject) {
12+
dismissSemiModalView()
13+
}
14+
15+
}

0 commit comments

Comments
 (0)