diff --git a/CHANGELOG.md b/CHANGELOG.md index 884b702f..4608ac9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +### 0.9.39 +- **Add**: `Animatable` protocol to TIUIKitCore. +- **Add**: `ActivityIndicator` protocol to TIUIKitCore. +- **Add**: `ActivityIndicatorHolder` protocol to TIUIKitCore. +- **Add**: `TIUIElements` for ui elements. + ### 0.9.38 - **Add**: `BaseRxTableViewCell` is subclass of `UITableViewCell` class with support `InitializableView` and `DisposeBagHolder` protocols. - **Add**: `ContainerTableCell` is container class that provides wrapping any `UIView` into `UITableViewCell`. diff --git a/LeadKit.podspec b/LeadKit.podspec index e3b2ae6b..a8dc1db2 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.9.38" + s.version = "0.9.39" 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" diff --git a/Package.swift b/Package.swift index 7c2250b7..6d1622df 100644 --- a/Package.swift +++ b/Package.swift @@ -4,14 +4,16 @@ import PackageDescription let package = Package( name: "LeadKit", platforms: [ - .iOS(.v12) + .iOS(.v11) ], products: [ .library(name: "TITransitions", targets: ["TITransitions"]), - .library(name: "TIUIKitCore", targets: ["TIUIKitCore"]) + .library(name: "TIUIKitCore", targets: ["TIUIKitCore"]), + .library(name: "TIUIElements", targets: ["TIUIElements"]) ], targets: [ .target(name: "TITransitions", path: "TITransitions/Sources"), .target(name: "TIUIKitCore", path: "TIUIKitCore/Sources"), + .target(name: "TIUIElements", dependencies: ["TIUIKitCore"], path: "TIUIElements/Sources") ] ) diff --git a/README.md b/README.md index c4298f10..b0849610 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ LeadKit is the iOS framework with a bunch of tools for rapid app development. ## Additional This repository contains the following additional frameworks: +- [TIUIKitCore](TIUIKitCore) - core ui elements and protocols from LeadKit. - [TITransitions](TITransitions) - set of custom transitions to present controller. -- [TIUIKitCore](TIUIKitCore) - core ui elements from LeadKit. +- [TIUIElements](TIUIElements) - bunch of of useful protocols and views. diff --git a/TIUIElements/README.md b/TIUIElements/README.md new file mode 100644 index 00000000..50d4e5af --- /dev/null +++ b/TIUIElements/README.md @@ -0,0 +1,7 @@ +# TIUIElements + +Bunch of useful protocols and views. + +# Installation via SPM + +You can install this framework as a target of LeadKit. diff --git a/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+ActivityIndicatorHolder.swift b/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+ActivityIndicatorHolder.swift new file mode 100644 index 00000000..b24434a4 --- /dev/null +++ b/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+ActivityIndicatorHolder.swift @@ -0,0 +1,30 @@ +// +// Copyright (c) 2020 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 TIUIKitCore + +extension UIActivityIndicatorView: ActivityIndicatorHolder { + public var activityIndicator: Animatable { + self + } +} diff --git a/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+Animatable.swift b/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+Animatable.swift new file mode 100644 index 00000000..2d709284 --- /dev/null +++ b/TIUIElements/Sources/Extensions/UIActivityIndicatorView/UIActivityIndicatorView+Animatable.swift @@ -0,0 +1,26 @@ +// +// Copyright (c) 2020 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 TIUIKitCore + +extension UIActivityIndicatorView: Animatable {} diff --git a/TIUIKitCore/README.md b/TIUIKitCore/README.md index 9953d1a8..9c46b9b3 100644 --- a/TIUIKitCore/README.md +++ b/TIUIKitCore/README.md @@ -1,6 +1,17 @@ # TIUIKitCore -Core UI elements from LeadKit. +Core UI elements: protocols, views and helpers. + +# Protocols + +- [InitializableView](InitializableView/InitializableView.swift) - protocol with methods that should be called in constructor methods of view. +- [Animatable](Animatable/Animatable.swift) - protocol that ensures that specific type support basic animation actions. +- [ActivityIndicator](ActivityIndicator/ActivityIndicator.swift) - basic activity indicator. +- [ActivityIndicatorHolder](ActivityIndicator/ActivityIndicatorHolder.swift) - placeholder view, containing activity indicator. + +# Views + +- [BaseInitializableView](BaseInitializableView/BaseInitializableView.swift) - UIView conformance to InitializableView. # Installation via SPM diff --git a/TIUIKitCore/Sources/Extensions/UIView/UIView+ActivityIndicatorHolder.swift b/TIUIKitCore/Sources/Extensions/UIView/UIView+ActivityIndicatorHolder.swift new file mode 100644 index 00000000..16c6baf4 --- /dev/null +++ b/TIUIKitCore/Sources/Extensions/UIView/UIView+ActivityIndicatorHolder.swift @@ -0,0 +1,29 @@ +// +// Copyright (c) 2020 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 extension ActivityIndicatorHolder where Self: UIView { + var indicatorOwner: UIView { + self + } +} diff --git a/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicator.swift b/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicator.swift new file mode 100644 index 00000000..6d289364 --- /dev/null +++ b/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicator.swift @@ -0,0 +1,26 @@ +// +// Copyright (c) 2020 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 that describes basic activity indicator. +public typealias ActivityIndicator = UIView & Animatable diff --git a/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicatorHolder.swift b/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicatorHolder.swift new file mode 100644 index 00000000..dffd4b32 --- /dev/null +++ b/TIUIKitCore/Sources/Protocols/ActivityIndicator/ActivityIndicatorHolder.swift @@ -0,0 +1,29 @@ +// +// Copyright (c) 2020 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 that describes placeholder view, containing activity indicator. +public protocol ActivityIndicatorHolder: class { + var activityIndicator: Animatable { get } + var indicatorOwner: UIView { get } +} diff --git a/TIUIKitCore/Sources/Protocols/Animatable/Animatable.swift b/TIUIKitCore/Sources/Protocols/Animatable/Animatable.swift new file mode 100644 index 00000000..927884dd --- /dev/null +++ b/TIUIKitCore/Sources/Protocols/Animatable/Animatable.swift @@ -0,0 +1,30 @@ +// +// Copyright (c) 2020 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. +// + +/// Protocol that ensures that specific type support basic animation actions. +public protocol Animatable { + + /// Method that starts animation. + func startAnimating() + /// Method that stops animation. + func stopAnimating() +} diff --git a/TIUIKitCore/Sources/Protocols/InitializableView.swift b/TIUIKitCore/Sources/Protocols/InitializableView/InitializableView.swift similarity index 100% rename from TIUIKitCore/Sources/Protocols/InitializableView.swift rename to TIUIKitCore/Sources/Protocols/InitializableView/InitializableView.swift