Skip to content

Commit ca76b37

Browse files
committed
Show behind navigation and tab bars
1 parent e36e890 commit ca76b37

12 files changed

+263
-99
lines changed

SwiftMessages.xcodeproj/project.pbxproj

+16-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
864495561D4F7C390056EB2A /* Identifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 864495551D4F7C390056EB2A /* Identifiable.swift */; };
1111
864495591D4FA0AD0056EB2A /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 864495581D4FA0AD0056EB2A /* Manager.swift */; };
1212
8644955B1D4FA2690056EB2A /* Presentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8644955A1D4FA2690056EB2A /* Presentable.swift */; };
13-
8644955D1D4FAF7C0056EB2A /* OverWindowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8644955C1D4FAF7C0056EB2A /* OverWindowViewController.swift */; };
13+
8644955D1D4FAF7C0056EB2A /* WindowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8644955C1D4FAF7C0056EB2A /* WindowViewController.swift */; };
1414
867E21531D4D01D500594A41 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 867E21521D4D01D500594A41 /* AppDelegate.swift */; };
1515
867E21551D4D01D500594A41 /* GalleryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 867E21541D4D01D500594A41 /* GalleryTableViewController.swift */; };
1616
867E21581D4D01D500594A41 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 867E21561D4D01D500594A41 /* Main.storyboard */; };
@@ -24,6 +24,9 @@
2424
867E21891D4D06D900594A41 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 867E21881D4D06D900594A41 /* Images.xcassets */; };
2525
867E21901D4D3E5E00594A41 /* UIView+Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 867E218F1D4D3E5E00594A41 /* UIView+Message.swift */; };
2626
867E21941D4D50BB00594A41 /* Presenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 867E21931D4D50BB00594A41 /* Presenter.swift */; };
27+
86AAF8181D54F0650031EE32 /* PassthroughView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86AAF8171D54F0650031EE32 /* PassthroughView.swift */; };
28+
86AAF81A1D54F0850031EE32 /* PassthroughWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86AAF8191D54F0850031EE32 /* PassthroughWindow.swift */; };
29+
86AAF81C1D551FE70031EE32 /* UIViewController+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86AAF81B1D551FE60031EE32 /* UIViewController+Utils.swift */; };
2730
/* End PBXBuildFile section */
2831

2932
/* Begin PBXContainerItemProxy section */
@@ -47,7 +50,7 @@
4750
864495551D4F7C390056EB2A /* Identifiable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Identifiable.swift; sourceTree = "<group>"; };
4851
864495581D4FA0AD0056EB2A /* Manager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Manager.swift; sourceTree = "<group>"; };
4952
8644955A1D4FA2690056EB2A /* Presentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Presentable.swift; sourceTree = "<group>"; };
50-
8644955C1D4FAF7C0056EB2A /* OverWindowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverWindowViewController.swift; sourceTree = "<group>"; };
53+
8644955C1D4FAF7C0056EB2A /* WindowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowViewController.swift; sourceTree = "<group>"; };
5154
867E214F1D4D01D500594A41 /* SwiftMessages.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftMessages.app; sourceTree = BUILT_PRODUCTS_DIR; };
5255
867E21521D4D01D500594A41 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5356
867E21541D4D01D500594A41 /* GalleryTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryTableViewController.swift; sourceTree = "<group>"; };
@@ -67,6 +70,9 @@
6770
867E21881D4D06D900594A41 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
6871
867E218F1D4D3E5E00594A41 /* UIView+Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Message.swift"; sourceTree = "<group>"; };
6972
867E21931D4D50BB00594A41 /* Presenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Presenter.swift; sourceTree = "<group>"; };
73+
86AAF8171D54F0650031EE32 /* PassthroughView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassthroughView.swift; sourceTree = "<group>"; };
74+
86AAF8191D54F0850031EE32 /* PassthroughWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassthroughWindow.swift; sourceTree = "<group>"; };
75+
86AAF81B1D551FE60031EE32 /* UIViewController+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+Utils.swift"; sourceTree = "<group>"; };
7076
/* End PBXFileReference section */
7177

7278
/* Begin PBXFrameworksBuildPhase section */
@@ -189,8 +195,11 @@
189195
8644955A1D4FA2690056EB2A /* Presentable.swift */,
190196
867E21931D4D50BB00594A41 /* Presenter.swift */,
191197
864495581D4FA0AD0056EB2A /* Manager.swift */,
198+
86AAF8171D54F0650031EE32 /* PassthroughView.swift */,
199+
86AAF8191D54F0850031EE32 /* PassthroughWindow.swift */,
200+
8644955C1D4FAF7C0056EB2A /* WindowViewController.swift */,
192201
867E218F1D4D3E5E00594A41 /* UIView+Message.swift */,
193-
8644955C1D4FAF7C0056EB2A /* OverWindowViewController.swift */,
202+
86AAF81B1D551FE60031EE32 /* UIViewController+Utils.swift */,
194203
);
195204
name = Internal;
196205
sourceTree = "<group>";
@@ -330,13 +339,16 @@
330339
files = (
331340
864495561D4F7C390056EB2A /* Identifiable.swift in Sources */,
332341
867E21831D4D025200594A41 /* MessageView.swift in Sources */,
342+
86AAF81A1D54F0850031EE32 /* PassthroughWindow.swift in Sources */,
333343
867E21551D4D01D500594A41 /* GalleryTableViewController.swift in Sources */,
334344
864495591D4FA0AD0056EB2A /* Manager.swift in Sources */,
345+
86AAF8181D54F0650031EE32 /* PassthroughView.swift in Sources */,
335346
867E21851D4D044F00594A41 /* Configuration.swift in Sources */,
336347
867E21941D4D50BB00594A41 /* Presenter.swift in Sources */,
337-
8644955D1D4FAF7C0056EB2A /* OverWindowViewController.swift in Sources */,
348+
8644955D1D4FAF7C0056EB2A /* WindowViewController.swift in Sources */,
338349
867E21531D4D01D500594A41 /* AppDelegate.swift in Sources */,
339350
867E21901D4D3E5E00594A41 /* UIView+Message.swift in Sources */,
351+
86AAF81C1D551FE70031EE32 /* UIViewController+Utils.swift in Sources */,
340352
8644955B1D4FA2690056EB2A /* Presentable.swift in Sources */,
341353
);
342354
runOnlyForDeploymentPostprocessing = 0;

SwiftMessages/Base.lproj/LaunchScreen.storyboard

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?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">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
56
</dependencies>
67
<scenes>
78
<!--View Controller-->
@@ -15,7 +16,6 @@
1516
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
1617
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
1718
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18-
<animations/>
1919
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
2020
</view>
2121
</viewController>

SwiftMessages/Base.lproj/Main.storyboard

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="3Lg-nJ-PLl">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="rPg-qW-45i">
33
<dependencies>
44
<deployment identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
66
</dependencies>
77
<scenes>
8-
<!--Navigation Controller-->
8+
<!--Demo-->
99
<scene sceneID="OF9-KZ-s0J">
1010
<objects>
1111
<navigationController id="3Lg-nJ-PLl" sceneMemberID="viewController">
12+
<tabBarItem key="tabBarItem" title="Demo" id="hYe-sq-zOM"/>
1213
<navigationBar key="navigationBar" contentMode="scaleToFill" id="OK5-Xt-Agc">
1314
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
1415
<autoresizingMask key="autoresizingMask"/>
@@ -21,6 +22,23 @@
2122
</objects>
2223
<point key="canvasLocation" x="-414" y="-31"/>
2324
</scene>
25+
<!--Tab Bar Controller-->
26+
<scene sceneID="P4t-4a-80V">
27+
<objects>
28+
<tabBarController id="rPg-qW-45i" sceneMemberID="viewController">
29+
<tabBar key="tabBar" contentMode="scaleToFill" id="AKO-aM-x8F">
30+
<rect key="frame" x="0.0" y="0.0" width="320" height="49"/>
31+
<autoresizingMask key="autoresizingMask"/>
32+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
33+
</tabBar>
34+
<connections>
35+
<segue destination="3Lg-nJ-PLl" kind="relationship" relationship="viewControllers" id="kid-gr-5vZ"/>
36+
</connections>
37+
</tabBarController>
38+
<placeholder placeholderIdentifier="IBFirstResponder" id="6CF-2L-QAn" userLabel="First Responder" sceneMemberID="firstResponder"/>
39+
</objects>
40+
<point key="canvasLocation" x="-1194" y="-31"/>
41+
</scene>
2442
<!--SwiftMessages Demo-->
2543
<scene sceneID="eYi-9A-oPG">
2644
<objects>
@@ -53,15 +71,15 @@
5371
<rect key="frame" x="0.0" y="108" width="600" height="44"/>
5472
<autoresizingMask key="autoresizingMask"/>
5573
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mPH-Rg-nNZ" id="Ss1-lS-zUb">
56-
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
74+
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
5775
<autoresizingMask key="autoresizingMask"/>
5876
</tableViewCellContentView>
5977
</tableViewCell>
6078
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="yKs-Sh-qBq">
6179
<rect key="frame" x="0.0" y="152" width="600" height="44"/>
6280
<autoresizingMask key="autoresizingMask"/>
6381
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yKs-Sh-qBq" id="e7e-HL-xhs">
64-
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
82+
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
6583
<autoresizingMask key="autoresizingMask"/>
6684
</tableViewCellContentView>
6785
</tableViewCell>

SwiftMessages/Configuration.swift

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
import UIKit
1010

1111
public enum PresentationContext {
12-
case InKeyWindow
13-
case InWindow(_: UIWindow)
14-
case OverWindow(windowLevel: UIWindowLevel)
15-
case InViewController(_: UIViewController)
16-
case InTopViewController(_: UIWindow)
12+
case Automatic
13+
case Window(windowLevel: UIWindowLevel)
14+
case ViewController(_: UIViewController)
1715
}
1816

1917
public enum PresentationStyle {
@@ -82,7 +80,7 @@ public enum Icon {
8280

8381
enum Error: ErrorType {
8482
case CannotLoadViewFromNib(nibName: String)
85-
case CannotFindContainer
83+
case NoRootViewController
8684
}
8785

8886
public struct Configuration<V: UIView> {
@@ -124,7 +122,7 @@ public struct Configuration<V: UIView> {
124122

125123
public var presentationStyle = PresentationStyle.Top
126124

127-
public var presentationContext = PresentationContext.InKeyWindow
125+
public var presentationContext = PresentationContext.Automatic
128126

129127
/// Works with .OverWindow presentation context
130128
public var preferredStatusBarStyle = UIStatusBarStyle.Default

SwiftMessages/GalleryTableViewController.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class GalleryTableViewController: UITableViewController {
1414
let style = MessageView.errorConfiguration()
1515
let content = MessageView.contentConfiguration(title: "My Title", body: "This is my body message.")
1616
var config = Configuration<MessageView>(viewConfigurations: [style, content])
17-
config.presentationContext = .OverWindow(windowLevel: UIWindowLevelStatusBar)
17+
// config.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)
18+
config.presentationContext = .Automatic
19+
config.presentationStyle = .Top
1820
try! config.show()
1921
}
2022
}

SwiftMessages/MessageView.xib

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@
1212
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1313
<subviews>
1414
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="252" verticalHuggingPriority="251" image="errorIcon" translatesAutoresizingMaskIntoConstraints="NO" id="PbA-QP-XpA" userLabel="imageIcon">
15-
<rect key="frame" x="20" y="21" width="32" height="38.5"/>
15+
<rect key="frame" x="20" y="21" width="32" height="39"/>
1616
</imageView>
1717
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="😬" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Bu-DY-qZo" userLabel="iconLabel">
18-
<rect key="frame" x="20" y="21" width="32" height="38.5"/>
18+
<rect key="frame" x="20" y="21" width="32" height="39"/>
1919
<fontDescription key="fontDescription" type="system" pointSize="32"/>
2020
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
2121
<nil key="highlightedColor"/>
2222
</label>
2323
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="90y-Jf-WFn" userLabel="Text container">
24-
<rect key="frame" x="62" y="20.5" width="518" height="39"/>
24+
<rect key="frame" x="72" y="21" width="508" height="39"/>
2525
<subviews>
26-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8T6-4T-ytS">
27-
<rect key="frame" x="0.0" y="0.0" width="518" height="19.5"/>
26+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8T6-4T-ytS">
27+
<rect key="frame" x="0.0" y="0.0" width="518" height="20"/>
2828
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
2929
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
3030
<nil key="highlightedColor"/>
3131
</label>
32-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message Body" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dFP-4Z-N2a">
33-
<rect key="frame" x="0.0" y="19" width="518" height="19.5"/>
32+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Message Body" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dFP-4Z-N2a">
33+
<rect key="frame" x="0.0" y="19" width="518" height="20"/>
3434
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
3535
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
3636
<nil key="highlightedColor"/>
@@ -59,7 +59,7 @@
5959
<constraint firstAttribute="trailing" secondItem="90y-Jf-WFn" secondAttribute="trailing" constant="20" id="UI8-aO-lPt"/>
6060
<constraint firstItem="1Bu-DY-qZo" firstAttribute="height" secondItem="PbA-QP-XpA" secondAttribute="height" id="WsQ-Iu-9nL"/>
6161
<constraint firstItem="1Bu-DY-qZo" firstAttribute="centerX" secondItem="PbA-QP-XpA" secondAttribute="centerX" id="oLA-XN-Hma"/>
62-
<constraint firstItem="90y-Jf-WFn" firstAttribute="leading" secondItem="PbA-QP-XpA" secondAttribute="trailing" constant="10" id="rea-TG-jfC"/>
62+
<constraint firstItem="90y-Jf-WFn" firstAttribute="leading" secondItem="PbA-QP-XpA" secondAttribute="trailing" constant="20" id="rea-TG-jfC"/>
6363
<constraint firstItem="PbA-QP-XpA" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="ujI-Pi-Ewy"/>
6464
</constraints>
6565
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>

SwiftMessages/PassthroughView.swift

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// PassthroughView.swift
3+
// SwiftMessages
4+
//
5+
// Created by Tim Moose on 8/5/16.
6+
// Copyright © 2016 SwiftKick Mobile. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class PassthroughView: UIView {
12+
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
13+
let view = super.hitTest(point, withEvent: event)
14+
return view == self ? nil : view
15+
}
16+
}

SwiftMessages/PassthroughWindow.swift

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// PassthroughWindow.swift
3+
// SwiftMessages
4+
//
5+
// Created by Tim Moose on 8/5/16.
6+
// Copyright © 2016 SwiftKick Mobile. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class PassthroughWindow: UIWindow {
12+
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
13+
let view = super.hitTest(point, withEvent: event)
14+
return view == self ? nil : view
15+
}
16+
}

0 commit comments

Comments
 (0)