Compare commits

...

6 Commits

Author SHA1 Message Date
Alexander Rutsman a4845bf0a1 refactor: creating alerts 2021-11-15 18:50:28 +03:00
Alexander Rutsman 632ebdff4d refactor: uialertaction -> voidclosure 2021-11-15 18:39:40 +03:00
Alexander Rutsman 915ec53b8c chore: bump version 1.8.0 2021-11-15 18:17:53 +03:00
Alexander Rutsman 2a3f28afc9 feat: update docs 2021-11-15 18:14:53 +03:00
Alexander Rutsman 7d09e9d874 refactor: removed alert action and added public modifier 2021-11-15 18:08:22 +03:00
Alexander Rutsman 6d4e20f15c feat: added alert factory and protocols 2021-11-13 14:08:41 +03:00
15 changed files with 229 additions and 9 deletions

View File

@ -1,5 +1,8 @@
# Changelog
### 1.8.0
- **Add**: `AlertFactory` - Set of helpers for working with alert.
### 1.7.0
- **Add**: `TINetworking` - Swagger-frendly networking layer helpers

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKit"
s.version = "1.7.0"
s.version = "1.8.0"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/TouchInstinct/LeadKit"
s.license = "Apache License, Version 2.0"

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIFoundationUtils'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Set of helpers for Foundation framework classes.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIKeychainUtils'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Set of helpers for Keychain classes.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TINetworking'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Swagger-frendly networking layer helpers.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TISwiftUtils'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Bunch of useful helpers for Swift development.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TITableKitUtils'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Set of helpers for TableKit classes.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TITransitions'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Set of custom transitions to present controller. '
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -3,6 +3,9 @@
Bunch of useful protocols and views:
- `RefreshControl` - a basic UIRefreshControl with fixed refresh action.
- `AlertFactory` - a basic alert factory setting up UiAlertController.
- `AlertPresentable` - a basic protocol describing api UIAlertController for custom alerts.
- `AlertInformative` - a basic protocol describing actions for creating alerts.
# HeaderTransitionDelegate
Use for transition table header to navigationBar view while scrolling

View File

@ -0,0 +1,51 @@
//
// Copyright (c) 2021 Touch Instinct
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// 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.
//
import UIKit
public enum AlertFactory {
/// The main method of creating alerts
public static func createAlert(with descriptor: AlertDescriptor) -> UIAlertController {
let controller = UIAlertController(title: descriptor.title,
message: descriptor.message,
preferredStyle: descriptor.style)
controller.view.tintColor = descriptor.tintColor
descriptor.actions.forEach {
controller.addAction($0)
}
return controller
}
/// The auxiliary method of creating alerts
public static func createAlert(title: String? = nil,
message: String? = nil,
actions: [UIAlertAction] = []) -> UIAlertController {
let descriptor = AlertDescriptor(title: title, message: message, actions: actions)
return createAlert(with: descriptor)
}
}

View File

@ -0,0 +1,55 @@
//
// Copyright (c) 2021 Touch Instinct
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// 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.
//
import UIKit
/// Protocol describes alert data
public struct AlertDescriptor {
/// Alert title
public let title: String?
/// Alert message
public let message: String?
/// Alert style
public let style: UIAlertController.Style
/// Alert tint color
public let tintColor: UIColor
/// Alert actions
public let actions: [UIAlertAction]
public init(title: String? = nil,
message: String? = nil,
style: UIAlertController.Style = .alert,
tintColor: UIColor = .blue,
actions: [UIAlertAction] = []) {
self.title = title
self.message = message
self.style = style
self.tintColor = tintColor
self.actions = actions
}
}

View File

@ -0,0 +1,72 @@
//
// Copyright (c) 2021 Touch Instinct
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// 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.
//
import UIKit
import TISwiftUtils
public protocol AlertInformative {
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?)
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?,
message: String?)
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?,
message: String?,
infoStyle: UIAlertAction.Style)
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?,
infoAction: VoidClosure?)
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?,
message: String?,
infoAction: VoidClosure?)
/// An alert informing about something with one closing button (by default ["OK"])
func presentInfoAlert(title: String?,
message: String?,
infoTitle: String?,
infoStyle: UIAlertAction.Style,
infoAction: VoidClosure?)
/// Alert offering to repeat the action (with the "Repeat" and "Cancel" buttons)
func presentRetryAlert(title: String?,
message: String?,
retryAction: @escaping VoidClosure)
/// Alert offering to repeat the action (with the "Repeat" and "Cancel" buttons)
func presentRetryAlert(title: String?,
message: String?,
retryAction: @escaping VoidClosure,
cancelAction: VoidClosure?)
/// Alert with custom actions and cancel button
func presentActionsAlert(title: String?,
message: String?,
actions: [UIAlertAction],
cancelAction: VoidClosure?)
}

View File

@ -0,0 +1,36 @@
//
// Copyright (c) 2021 Touch Instinct
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// 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.
//
import Foundation
import TISwiftUtils
public protocol AlertPresentable {
/// Alert title
var title: String? { get }
/// Alert message
var message: String? { get }
/// Attaches an action object to the alert
func addAction(title: String, action: VoidClosure)
}

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIUIElements'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Bunch of useful protocols and views.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIUIKitCore'
s.version = '1.7.0'
s.version = '1.8.0'
s.summary = 'Core UI elements: protocols, views and helpers.'
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }