Skip to content

Commit

Permalink
Merge pull request #32 from 3sidedcube/release/2.1.0
Browse files Browse the repository at this point in the history
Release/2.1.0
  • Loading branch information
BenShutt authored Feb 2, 2021
2 parents 7bd6719 + 65fba31 commit 07d8d56
Show file tree
Hide file tree
Showing 99 changed files with 1,412 additions and 1,146 deletions.
92 changes: 92 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
excluded:
- Carthage
- Pods
disabled_rules:
- file_header
- identifier_name
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- discouraged_object_literal
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- enum_case_associated_values_count
- explicit_init
- extension_access_modifier
- fallthrough
- fatal_error_message
- file_header
- file_name
- first_where
- flatmap_over_map_reduce
- identical_operands
- joined_default_parameter
- legacy_random
- let_var_whitespace
- last_where
- legacy_multiple
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
- nimble_operator
- nslocalizedstring_key
- number_separator
# - object_literal
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_interface_builder
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
# - sorted_imports
- static_operator
- strong_iboutlet
- toggle_bool
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
# - vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition

force_cast: warning
force_try:
severity: error
line_length:
warning: 100
ignores_comments: true
ignores_urls: true
reporter: "xcode"
number_separator:
minimum_length: 5
file_name:
excluded:
- main.swift
- LinuxMain.swift
type_name:
min_length: 3
max_length: 50
1 change: 0 additions & 1 deletion Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

6 changes: 3 additions & 3 deletions Example/Extensions/UIButton+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import UIKit

extension UIButton {

@discardableResult
static func addToCenter(
of view: UIView,
Expand All @@ -22,14 +22,14 @@ extension UIButton {
button.setTitle(title, for: .normal)
button.addTarget(target, action: selector, for: .touchUpInside)
button.setTitleColor(.systemBlue, for: .normal)

view.addSubview(button)
button.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])

return button
}
}
2 changes: 1 addition & 1 deletion Example/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }

let window = UIWindow(windowScene: windowScene)
window.rootViewController = UINavigationController(
rootViewController: RootTableViewController()
Expand Down
6 changes: 3 additions & 3 deletions Example/Theme/UIColor+Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import UIKit
// MARK: - UIColor + Colors

extension UIColor {

/// Override `.red` color
static let red = UIColor(
red: 231/255, green: 19/255, blue: 36/255, alpha: 1
red: 231 / 255, green: 19 / 255, blue: 36 / 255, alpha: 1
)

/// Override `.darkGray` color
static let darkGray = UIColor(
red: 109/255, green: 110/255, blue: 112/255, alpha: 1
red: 109 / 255, green: 110 / 255, blue: 112 / 255, alpha: 1
)
}
6 changes: 3 additions & 3 deletions Example/Theme/UIImage+Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Foundation
import UIKit

extension UIImage {

/// Circular information i
static let information = UIImage(named: "information-32")

/// Simple black cross
static let cross = UIImage(named: "cross-32")

/// Donations
static let donations = UIImage(named: "donations")
}
29 changes: 15 additions & 14 deletions Example/ViewControllers/BadgeMessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import MessageStackView

/// `UIViewController` to demo posting a `BadgeMessage` on a `PostView`
class BadgeMessageViewController: UIViewController {

/// `PostView` for posting messages
private lazy var postView = view.createPostView()

/// Arrray of titles for `badgeMessages` to demo
private let badgeTitles: [(title: String, subtitle: String)] = [
("Badge Earned!", "That's a badge unlock"),
("Badge Earned Again!", "That's another badge unlock"),
("Badge Earned Again And Again!", "That's yet another badge unlock")
]

/// `BadgeMessage`s from ``badgeTitles`
private var badgeMessages: [BadgeMessage] {
return badgeTitles.map {
Expand All @@ -34,12 +34,12 @@ class BadgeMessageViewController: UIViewController {
)
}
}

// MARK: - ViewController lifecycle

override func viewDidLoad() {
super.viewDidLoad()

UIButton.addToCenter(
of: view,
title: "Post with updated insets",
Expand All @@ -50,26 +50,27 @@ class BadgeMessageViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

badgeMessages.forEach {
postView.post(badgeMessage: $0)
}
}

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)

postView.postManager.invalidate()
}

// MARK: - Actions

@objc private func buttonTouchUpInside(_ sender: UIButton) {

@objc
private func buttonTouchUpInside(_ sender: UIButton) {
postView.edgeInsets = UIEdgeInsets(
top: 3, left: 10, bottom: 3, right: 10
)
let _ = postView.post(badgeMessage: BadgeMessage(

_ = postView.post(badgeMessage: BadgeMessage(
title: "\(PostView.self) Insets Updated",
subtitle: "The insets (margins) have been updated on the \(PostView.self)",
image: .donations,
Expand Down
25 changes: 13 additions & 12 deletions Example/ViewControllers/MessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import MessageStackView

class MessageViewController: UIViewController {

private lazy var messageStackView: MessageStackView = {
let messageStackView: MessageStackView = view.createMessageStackView()
messageStackView.messageConfiguation = MessageConfiguration(
Expand All @@ -21,7 +21,7 @@ class MessageViewController: UIViewController {
)
return messageStackView
}()

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

Expand All @@ -31,7 +31,7 @@ class MessageViewController: UIViewController {
subtitle: "This is a subtitle, with a left image",
leftImage: .information
), dismissAfter: 6)

// Post another message after delay
DispatchQueue.main.asyncAfterNow(time: .seconds(2)) { [weak self] in
guard let self = self else { return }
Expand All @@ -44,19 +44,19 @@ class MessageViewController: UIViewController {
),
dismissAfter: 8
)

messageView.rightImageViewSize = CGSize(width: 10, height: 10)
self.addTapToRemoveGesture(to: messageView)
}

// Post a custom view after delay
DispatchQueue.main.asyncAfterNow(time: .seconds(4)) { [weak self] in
let view = CustomView()
self?.messageStackView.post(view: view)
self?.addTapToRemoveGesture(to: view)
}
}

/// Add ability to remove `view` from `messageStackView` by tap
///
/// - Parameter view: `UIView`
Expand All @@ -68,21 +68,22 @@ class MessageViewController: UIViewController {

// MARK: - CustomView

fileprivate class CustomView: UIView {
private class CustomView: UIView {

init() {
super.init(frame: .zero)
backgroundColor = .blue

translatesAutoresizingMaskIntoConstraints = false
let heightConstraint = heightAnchor.constraint(equalToConstant: 50)

// Allow the height to be defined by the stackView during animation
heightConstraint.priority = .init(999)

heightConstraint.isActive = true
}


@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
Loading

0 comments on commit 07d8d56

Please sign in to comment.