Compare commits

...

2 Commits

Author SHA1 Message Date
krasich74 22a3916366 Updated Readme and podspecs 2020-08-21 12:13:34 +03:00
krasich74 7d6cdfb3e3 Added BaseConfigurableBarButton, LabelBarButton 2020-08-21 11:55:52 +03:00
5 changed files with 96 additions and 1 deletions

View File

@ -1,5 +1,10 @@
# Changelog # Changelog
### 0.9.40
- **Add**: `BaseConfigurableBarButton` subclass of UIBarButton to TIUIKitCore.
- **Add**: `LabelBarButton` subclass of `BaseConfigurableBarButton` with wrappedValue of UILabel to TIUIKitCore.
### 0.9.39 ### 0.9.39
- **Add**: `Animatable` protocol to TIUIKitCore. - **Add**: `Animatable` protocol to TIUIKitCore.
- **Add**: `ActivityIndicator` protocol to TIUIKitCore. - **Add**: `ActivityIndicator` protocol to TIUIKitCore.

View File

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

View File

@ -0,0 +1,34 @@
//
// 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
open class LabelBarButton: BaseConfigurableBarButton<UILabel> {
public init(text: String, font: UIFont?, target: Any?, action: Selector) {
super.init(target: target, action: action)
wrappedView.text = text
wrappedView.font = font
}
}

View File

@ -12,6 +12,7 @@ Core UI elements: protocols, views and helpers.
# Views # Views
- [BaseInitializableView](BaseInitializableView/BaseInitializableView.swift) - UIView conformance to InitializableView. - [BaseInitializableView](BaseInitializableView/BaseInitializableView.swift) - UIView conformance to InitializableView.
- [BaseConfigurableBarButton](BaseConfigurableBarButton/BaseConfigurableBarButton.swift) - UIBarButton generic wrapper subclass, that uses any UIView as it's custom view
# Installation via SPM # Installation via SPM

View File

@ -0,0 +1,55 @@
//
// 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
open class BaseConfigurableBarButton<ViewType: UIView>: UIBarButtonItem {
// MARK: - Interface
public let wrappedView = ViewType()
@available(*, unavailable)
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public init(target: Any?, action: Selector) {
super.init()
customView = wrappedView
addAction(target: target, action: action)
}
open func configureAppearance() {
//empty for subclass overriding
}
// MARK: - Private Methods
private func addAction(target: Any?, action: Selector) {
wrappedView.isUserInteractionEnabled = true
let gestureRecognizer = UITapGestureRecognizer(target: target, action: action)
wrappedView.addGestureRecognizer(gestureRecognizer)
}
}