Skip to content

Commit 9d7d21e

Browse files
authored
Merge pull request #26 from okanerdogan09/master
adding accessory view to the right of Message Bar
2 parents 9d3a8ca + a19a7c3 commit 9d7d21e

File tree

7 files changed

+168
-176
lines changed

7 files changed

+168
-176
lines changed

Example/SwiftMessageBarExample/SwiftMessageBarExample.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273273
GCC_WARN_UNUSED_FUNCTION = YES;
274274
GCC_WARN_UNUSED_VARIABLE = YES;
275-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
275+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
276276
MTL_ENABLE_DEBUG_INFO = YES;
277277
ONLY_ACTIVE_ARCH = YES;
278278
SDKROOT = iphoneos;
@@ -321,7 +321,7 @@
321321
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
322322
GCC_WARN_UNUSED_FUNCTION = YES;
323323
GCC_WARN_UNUSED_VARIABLE = YES;
324-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
324+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
325325
MTL_ENABLE_DEBUG_INFO = NO;
326326
SDKROOT = iphoneos;
327327
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";

Example/SwiftMessageBarExample/SwiftMessageBarExample/Base.lproj/Main.storyboard

+35-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="15A178w" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
510
</dependencies>
611
<scenes>
712
<!--View Controller-->
@@ -13,64 +18,65 @@
1318
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
1419
</layoutGuides>
1520
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
16-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
21+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1722
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1823
<subviews>
1924
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="g3H-aA-9F1">
20-
<rect key="frame" x="249" y="397" width="102" height="30"/>
21-
<animations/>
25+
<rect key="frame" x="137.5" y="426" width="100" height="30"/>
2226
<state key="normal" title="Show Success">
23-
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
27+
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2428
</state>
2529
<connections>
26-
<action selector="showSuccess:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="UXp-O5-5af"/>
30+
<action selector="showSuccess" destination="vXZ-lx-hvc" eventType="touchUpInside" id="LcG-Pk-Pd8"/>
31+
</connections>
32+
</button>
33+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nha-ta-9BD" userLabel="Show Succes with custom view">
34+
<rect key="frame" x="67.5" y="464" width="240" height="30"/>
35+
<state key="normal" title="Show Succes With Accessory View"/>
36+
<connections>
37+
<action selector="showSuccessWithAccesoryView" destination="vXZ-lx-hvc" eventType="touchUpInside" id="e3k-x5-dIy"/>
2738
</connections>
2839
</button>
2940
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tfK-dL-iQe">
30-
<rect key="frame" x="266" y="435" width="69" height="30"/>
31-
<animations/>
41+
<rect key="frame" x="153.5" y="502" width="68" height="30"/>
3242
<state key="normal" title="Show Info">
33-
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
43+
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
3444
</state>
3545
<connections>
36-
<action selector="showInfo:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="0IS-En-Vtu"/>
46+
<action selector="showInfo" destination="vXZ-lx-hvc" eventType="touchUpInside" id="sSJ-3z-lvi"/>
3747
</connections>
3848
</button>
3949
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vTD-O1-rRw">
40-
<rect key="frame" x="262" y="473" width="77" height="30"/>
41-
<animations/>
50+
<rect key="frame" x="149.5" y="540" width="76" height="30"/>
4251
<state key="normal" title="Show Error">
43-
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
52+
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
4453
</state>
4554
<connections>
46-
<action selector="showError:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="dfc-Cu-ILl"/>
55+
<action selector="showError" destination="vXZ-lx-hvc" eventType="touchUpInside" id="xga-jW-viM"/>
4756
</connections>
4857
</button>
4958
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tgG-aC-S2q">
50-
<rect key="frame" x="245" y="511" width="110" height="30"/>
51-
<animations/>
59+
<rect key="frame" x="132.5" y="578" width="110" height="30"/>
5260
<state key="normal" title="Clear Messages">
5361
<color key="titleColor" red="0.96326452493667603" green="0.096623696386814117" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5462
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
5563
</state>
5664
<connections>
57-
<action selector="clearAll:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="pqO-1x-qOR"/>
65+
<action selector="clearAll" destination="vXZ-lx-hvc" eventType="touchUpInside" id="acw-re-8lv"/>
5866
</connections>
5967
</button>
6068
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EGE-TM-z4L">
61-
<rect key="frame" x="254" y="549" width="92" height="30"/>
62-
<animations/>
69+
<rect key="frame" x="141.5" y="616" width="92" height="30"/>
6370
<state key="normal" title="Clear Current">
64-
<color key="titleColor" red="0.96326452493667603" green="0.096623696386814117" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
65-
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
71+
<color key="titleColor" red="0.94059276580810547" green="0.0" blue="0.02498987689614296" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
72+
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
6673
</state>
6774
<connections>
68-
<action selector="clearCurrent:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Zc0-4F-4Rk"/>
75+
<action selector="clearCurrent" destination="vXZ-lx-hvc" eventType="touchUpInside" id="DhZ-cG-jZf"/>
6976
</connections>
7077
</button>
7178
</subviews>
72-
<animations/>
73-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
79+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7480
<constraints>
7581
<constraint firstAttribute="centerX" secondItem="vTD-O1-rRw" secondAttribute="centerX" id="2Pw-Rj-x4i"/>
7682
<constraint firstItem="tgG-aC-S2q" firstAttribute="top" secondItem="vTD-O1-rRw" secondAttribute="bottom" constant="8" id="47L-d1-JEj"/>
@@ -79,9 +85,11 @@
7985
<constraint firstItem="EGE-TM-z4L" firstAttribute="top" secondItem="tgG-aC-S2q" secondAttribute="bottom" constant="8" id="H3Y-hp-4gv"/>
8086
<constraint firstAttribute="centerX" secondItem="tfK-dL-iQe" secondAttribute="centerX" id="MZv-wF-YQk"/>
8187
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="vTD-O1-rRw" secondAttribute="bottom" constant="97" id="RX8-LJ-8Gq"/>
88+
<constraint firstItem="tfK-dL-iQe" firstAttribute="top" secondItem="nha-ta-9BD" secondAttribute="bottom" constant="8" id="UnV-p0-unb"/>
8289
<constraint firstItem="vTD-O1-rRw" firstAttribute="top" secondItem="tfK-dL-iQe" secondAttribute="bottom" constant="8" id="fUI-GQ-Zoy"/>
8390
<constraint firstAttribute="centerX" secondItem="EGE-TM-z4L" secondAttribute="centerX" id="hj6-wm-cik"/>
84-
<constraint firstItem="tfK-dL-iQe" firstAttribute="top" secondItem="g3H-aA-9F1" secondAttribute="bottom" constant="8" id="lZg-Nx-Cwn"/>
91+
<constraint firstItem="nha-ta-9BD" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="u0y-PX-D4M"/>
92+
<constraint firstItem="nha-ta-9BD" firstAttribute="top" secondItem="g3H-aA-9F1" secondAttribute="bottom" constant="8" id="yl9-Pz-aHD"/>
8593
</constraints>
8694
</view>
8795
</viewController>

Example/SwiftMessageBarExample/SwiftMessageBarExample/ViewController.swift

+25-5
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,57 @@ class ViewController: UIViewController {
1515
SwiftMessageBar.setSharedConfig(messageBarConfig)
1616
}
1717

18-
@IBAction private func showSuccess(_ sender: AnyObject) {
18+
@IBAction private func showSuccess() {
1919
let message = "A really long message can go here, to provide a description for the user"
2020
uuid = SwiftMessageBar.showMessage(withTitle: nil, message: message, type: .success, duration: 3, dismiss: false) {
2121
print("Dismiss callback")
2222
}
2323
}
2424

25-
@IBAction private func showError(_ sender: AnyObject) {
25+
@IBAction private func showError() {
2626
let message = "A really long message can go here, to provide a description for the user"
2727
uuid = SwiftMessageBar.showMessage(withTitle: "Error", message: message, type: .error, duration: 3) {
2828
print("Dismiss callback")
2929
}
3030
}
3131

32-
@IBAction private func showInfo(_ sender: AnyObject) {
32+
@IBAction private func showInfo() {
3333
let message = "A really long message can go here, to provide a description for the user"
3434
uuid = SwiftMessageBar.showMessage(withTitle: "Info", message: message, type: .info, duration: 3) {
3535
print("Dismiss callback")
3636
}
3737
}
3838

39-
@IBAction private func clearAll(_ sender: AnyObject) {
39+
@IBAction private func clearAll() {
4040
SwiftMessageBar.sharedMessageBar.cancelAll(force: true)
4141
uuid = nil
4242
}
4343

44-
@IBAction private func clearCurrent(_ sender: AnyObject) {
44+
@IBAction private func clearCurrent() {
4545
if let id = uuid {
4646
SwiftMessageBar.sharedMessageBar.cancel(withId: id)
4747
uuid = nil
4848
}
4949
}
5050

51+
@IBAction private func showSuccessWithAccesoryView() {
52+
let message = "A really long message can go here, to provide a description for the user"
53+
let button = UIButton(type: .roundedRect)
54+
button.contentEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
55+
button.setContentHuggingPriority(.required, for: .horizontal)
56+
button.setTitle("Open", for: .normal)
57+
button.tintColor = .orange
58+
button.backgroundColor = .white
59+
button.layer.cornerRadius = 6
60+
button.addTarget(self, action: #selector(handleButtonTap), for: .touchUpInside)
61+
62+
uuid = SwiftMessageBar.showMessage(withTitle: nil, message: message, type: .success, duration: 3, dismiss: false, accessoryView: button ) {
63+
print("Dismiss callback")
64+
}
65+
}
66+
67+
@objc private func handleButtonTap() {
68+
print("button tapped")
69+
}
70+
5171
}

SwiftMessageBar.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
1919
s.authors = { "Jan Gorman" => "https://github.com/JanGorman/", "Ramy Kfoury" => "https://github.com/ramy-kfoury/" }
2020
s.social_media_url = "http://twitter.com/JanGorman"
2121

22-
s.platform = :ios, "8.4"
22+
s.platform = :ios, "9.0"
2323

2424
s.source = { :git => "https://github.com/JanGorman/SwiftMessageBar.git", :tag => s.version }
2525

SwiftMessageBar.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
254254
GCC_WARN_UNUSED_FUNCTION = YES;
255255
GCC_WARN_UNUSED_VARIABLE = YES;
256-
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
256+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
257257
MTL_ENABLE_DEBUG_INFO = YES;
258258
ONLY_ACTIVE_ARCH = YES;
259259
SDKROOT = iphoneos;
@@ -306,7 +306,7 @@
306306
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
307307
GCC_WARN_UNUSED_FUNCTION = YES;
308308
GCC_WARN_UNUSED_VARIABLE = YES;
309-
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
309+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
310310
MTL_ENABLE_DEBUG_INFO = NO;
311311
SDKROOT = iphoneos;
312312
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -329,7 +329,7 @@
329329
DYLIB_INSTALL_NAME_BASE = "@rpath";
330330
INFOPLIST_FILE = SwiftMessageBar/Info.plist;
331331
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
332-
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
332+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
333333
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
334334
PRODUCT_BUNDLE_IDENTIFIER = "com.schnaub.$(PRODUCT_NAME:rfc1034identifier)";
335335
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -350,7 +350,7 @@
350350
DYLIB_INSTALL_NAME_BASE = "@rpath";
351351
INFOPLIST_FILE = SwiftMessageBar/Info.plist;
352352
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
353-
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
353+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
354354
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
355355
PRODUCT_BUNDLE_IDENTIFIER = "com.schnaub.$(PRODUCT_NAME:rfc1034identifier)";
356356
PRODUCT_NAME = "$(TARGET_NAME)";

0 commit comments

Comments
 (0)