Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### 1.8.0
- **Add**: `TIScrollLabel` - the scroll view with label - TIScrollLabel

### 1.7.0
- **Add**: `TINetworking` - Swagger-frendly networking layer helpers

Expand Down
2 changes: 1 addition & 1 deletion LeadKit.podspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion TIFoundationUtils/TIFoundationUtils.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TIKeychainUtils/TIKeychainUtils.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TINetworking/TINetworking.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TISwiftUtils/TISwiftUtils.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TITableKitUtils/TITableKitUtils.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TITransitions/TITransitions.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
1 change: 1 addition & 0 deletions TIUIElements/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Bunch of useful protocols and views:

- `RefreshControl` - a basic UIRefreshControl with fixed refresh action.
- `TIScrollLabel` - a basic scroll view with label.

# HeaderTransitionDelegate
Use for transition table header to navigationBar view while scrolling
Expand Down
59 changes: 59 additions & 0 deletions TIUIElements/Sources/Views/BaseInitializableScrollView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// 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 TIUIKitCore
import UIKit

open class BaseInitializableScrollView: UIScrollView, InitializableViewProtocol {
override public init(frame: CGRect) {
super.init(frame: frame)

initializeView()
}

required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

initializeView()
}

// MARK: - InitializableView
open func addViews() {
// override in subclass
}

open func configureLayout() {
// override in subclass
}

open func bindViews() {
// override in subclass
}

open func configureAppearance() {
// override in subclass
}

open func localize() {
// override in subclass
}
}
17 changes: 17 additions & 0 deletions TIUIElements/Sources/Views/TIScrollLabel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# TIScrollLabel

Позволяет скролить текст, если его размер больше чем размер вью.

### Особенности

- Если размер текста будет меньше, чем размер вью, то текст будет отображаться в центре

### Пример использования

```swift
label = TIScrollLabel()
label.text = // установка текста
label.font = // установка шрифта
label.textColor = // установка цвета текста
label.textAligment = // установка расположения текста

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textAlig_n_ment

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// 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

open class LabeledScrollView: BaseInitializableScrollView {

private let textLabel = UILabel()
private let contentView = UIView()

// MARK: - Configurable Properties

public var text: String = "" {
didSet {
textLabel.text = text
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ещё attributedText надо добавить


public var textColor: UIColor = .black {
didSet {
textLabel.textColor = textColor
}
}

public var font: UIFont = UIFont.systemFont(ofSize: 13) {
didSet {
textLabel.font = font
}
}

public var textAligment: NSTextAlignment = .center {
Comment thread
kayumovtd marked this conversation as resolved.
Outdated
didSet {
textLabel.textAlignment = textAligment
}
}

// MARK: - Initialization

open override func addViews() {
super.addViews()

addSubview(contentView)
contentView.addSubview(textLabel)
}

open override func configureAppearance() {
super.configureAppearance()

showsVerticalScrollIndicator = false
showsHorizontalScrollIndicator = false
backgroundColor = .clear
clipsToBounds = true

textLabel.numberOfLines = 0
textLabel.textAlignment = textAligment
textLabel.textColor = textColor
textLabel.font = font
}

open override func configureLayout() {
super.configureLayout()

contentView.translatesAutoresizingMaskIntoConstraints = false
textLabel.translatesAutoresizingMaskIntoConstraints = false

let contentViewBottomConstraint = contentView.bottomAnchor.constraint(equalTo: bottomAnchor)
let contentViewCenterYConstraint = contentView.centerYAnchor.constraint(equalTo: centerYAnchor)
let contentViewHeightConstraint = contentView.heightAnchor.constraint(equalTo: heightAnchor)

[
contentViewBottomConstraint,
contentViewCenterYConstraint,
contentViewHeightConstraint
].forEach { $0.priority = .defaultLow }

NSLayoutConstraint.activate([
contentView.leadingAnchor.constraint(equalTo: leadingAnchor),
contentView.trailingAnchor.constraint(equalTo: trailingAnchor),
contentView.topAnchor.constraint(equalTo: topAnchor),
contentView.centerXAnchor.constraint(equalTo: centerXAnchor),
contentViewBottomConstraint,
contentViewCenterYConstraint,
contentViewHeightConstraint
])

NSLayoutConstraint.activate([
textLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
textLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
textLabel.topAnchor.constraint(equalTo: contentView.topAnchor),
textLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
textLabel.heightAnchor.constraint(equalTo: contentView.heightAnchor)
])
}
}
Original file line number Diff line number Diff line change
@@ -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 TIUIElements

open class TIScrollLabel: BaseInitializableView {

private let labeledScrollView = LabeledScrollView()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем нам оборачивать LabeledScrollView в ещё одну view?


public var text: String = "" {
didSet {
labeledScrollView.text = text
}
}

public var textColor: UIColor = .black {
didSet {
labeledScrollView.textColor = textColor
}
}

public var font: UIFont = UIFont.systemFont(ofSize: 13) {
didSet {
labeledScrollView.font = font
}
}

public var textAlignment: NSTextAlignment = .center {
didSet {
labeledScrollView.textAlignment = textAlignment
}
}

open override func addViews() {
super.addViews()

addSubview(labeledScrollView)
}

open override func configureLayout() {
super.configureLayout()

labeledScrollView.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
labeledScrollView.leadingAnchor.constraint(equalTo: leadingAnchor),
labeledScrollView.trailingAnchor.constraint(equalTo: trailingAnchor),
labeledScrollView.topAnchor.constraint(equalTo: topAnchor),
labeledScrollView.bottomAnchor.constraint(equalTo: bottomAnchor)
])
}
}
2 changes: 1 addition & 1 deletion TIUIElements/TIUIElements.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion TIUIKitCore/TIUIKitCore.podspec
Original file line number Diff line number Diff line change
@@ -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' }
Expand Down