Skip to content

Commit c3a0b55

Browse files
committed
Check readme rendering
1 parent 7b0a23e commit c3a0b55

File tree

5 files changed

+85
-15
lines changed

5 files changed

+85
-15
lines changed

LICENSE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Copyright (c) 2016 SwiftKick Mobile LLC
2+
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+64-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,66 @@
11
# SwiftMessages
2-
A designer-friendly iOS message bar written in Swift.
32

4-
Under construction.
3+
SwiftMessages is a library for displaying temporary status messages on iOS.
4+
5+
In addition to providing numerous layouts, themes and configuration options, SwiftMessages allows complete control over the design of your message:
6+
7+
* Copy one of the included nib files into your project and modify it.
8+
* Subclass `MessageView` to add elements, etc.
9+
* Or just supply an arbitrary view.
10+
11+
Try exploring [the demo app](./Demo/Demo.xcworkspace) to get a feel for the extensive configurability of SwiftMessages.
12+
13+
## Installation
14+
15+
### CocoaPods
16+
17+
Add the following line to your Podfile:
18+
19+
````
20+
pod 'SwiftMessages'
21+
````
22+
23+
### Carthage
24+
25+
Todo
26+
27+
## Usage
28+
29+
````swift
30+
// A type-safe factory method for one of the
31+
// provided nib-based layouts. The main bundle is always
32+
// searched first, so you can easily copy the nib file
33+
// into your project and modify it.
34+
let view = MessageView.viewFromNib(layout: .MessageView)
35+
36+
// One of several convenience methods for theming
37+
// message elements.
38+
view.configureWarningTheme()
39+
40+
41+
view.configureContent(title: "Warning", body: "Consider yourself warned.", iconText: "🤔")
42+
SwiftMessages.show(view: view)
43+
````
44+
45+
````swift
46+
SwiftMessages.show {
47+
let view = MessageView.viewFromNib(layout: .MessageView)
48+
...
49+
return view
50+
}
51+
````
52+
53+
````swift
54+
var config = SwiftMessages.Config()
55+
56+
config.presentationStyle = .Bottom // Slide up from the bottom
57+
config.presentationContext = .Window(windowLevel: UIWindowLevelNormal) // Display over key window
58+
config.duration = .Forever // Disable auto-hiding
59+
config.dimMode = .Automatic(interactive: true) // Dim the background (like a popover view)
60+
config.interactiveHide = false // Disable the interactive hide gesture
61+
config.preferredStatusBarStyle = .LightContent // Specify a matching status bar style
62+
63+
SwiftMessages.show(config: config) { ... }
64+
````
65+
66+
## License

SwiftMessages.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'SwiftMessages'
3-
spec.version = '0.0.1'
3+
spec.version = '1.0.0'
44
spec.license = { :type => 'MIT' }
55
spec.homepage = 'https://github.com/SwiftKickMobile/swift-messages-ios'
66
spec.authors = { 'Timothy Moose' => 'tim@swiftkick.it' }
7-
spec.summary = 'A designer-friendly iOS message bar written in Swift.'
8-
spec.source = {:git => 'https://github.com/SwiftKickMobile/swift-messages-ios.git', :tag => 'v0.0.1'}
7+
spec.summary = 'A very flexible message bar for iOS written in Swift.'
8+
spec.source = {:git => 'https://github.com/SwiftKickMobile/swift-messages-ios.git', :tag => 'v1.0.0'}
99
spec.platform = :ios, '8.0'
1010
spec.ios.deployment_target = '8.0'
1111
spec.source_files = 'SwiftMessages/**/*.swift'

SwiftMessages/Presenter.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Presenter: NSObject, UIGestureRecognizerDelegate {
168168
switch config.dimMode {
169169
case .None:
170170
break
171-
case .Automatic(let interactive):
171+
case .Default(let interactive):
172172
if interactive { setupInteractive() }
173173
case .Color(_, let interactive):
174174
if interactive { setupInteractive() }
@@ -208,9 +208,9 @@ class Presenter: NSObject, UIGestureRecognizerDelegate {
208208
switch config.dimMode {
209209
case .None:
210210
break
211-
case .Automatic(let interactive):
211+
case .Default:
212212
dim(UIColor(white: 0, alpha: 0.3))
213-
case .Color(let color, let interactive):
213+
case .Color(let color, _):
214214
dim(color)
215215
}
216216
}
@@ -260,7 +260,7 @@ class Presenter: NSObject, UIGestureRecognizerDelegate {
260260
switch config.dimMode {
261261
case .None:
262262
break
263-
case .Automatic:
263+
case .Default:
264264
undim()
265265
case .Color:
266266
undim()

SwiftMessages/SwiftMessages.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ public class SwiftMessages: PresenterDelegate {
3434

3535
public enum DimMode {
3636
case None
37-
case Automatic(interactive: Bool)
37+
case Default(interactive: Bool)
3838
case Color(color: UIColor, interactive: Bool)
3939
}
4040

4141
public struct Config {
4242

4343
public init() {}
4444

45-
public var duration = Duration.Automatic
46-
4745
public var presentationStyle = PresentationStyle.Top
46+
47+
public var presentationContext = PresentationContext.Automatic
48+
49+
public var duration = Duration.Automatic
4850

4951
public var dimMode = DimMode.None
5052

51-
public var presentationContext = PresentationContext.Automatic
52-
5353
public var interactiveHide = true
5454

5555
/**
@@ -274,7 +274,7 @@ extension SwiftMessages {
274274
return view
275275
}
276276

277-
public class func viewFromNib<T: UIView>(named name: String, bundle: NSBundle, filesOwner: AnyObject = NSNull.init()) throws -> T {
277+
public class func viewFromNib<T: UIView>(named name: String, bundle: NSBundle, filesOwner: AnyObject = NSNull.init()) throws -> T {
278278
let view: T = try internalViewFromNib(named: name, bundle: bundle, filesOwner: filesOwner)
279279
return view
280280
}

0 commit comments

Comments
 (0)