STTextView
STTextView – 使用 Swift 编写的简单且整洁的库。这个框架添加了一个带有必要 placeholder
属性的自定义 UITextView 子类。
需求
- iOS 10.0 或更高版本。
框架与 Swift 5 兼容。
安装
STTextView
可通过 CocoaPods、Carthage 和 Swift 包管理器 获取。
CocoaPods
-
在您的 Podfile 中添加以下行
pod 'STTextView'
-
然后在您的终端中运行此命令
$ pod install
Carthage
-
在您的 Cartfile 中添加以下行
github "onl1ner/STTextView"
-
然后在终端中运行下一个命令
$ carthage update
Swift 包管理器
-
在 Xcode 中选择
File > Swift Packages > Add Package Dependency...
-
然后粘贴此 URL
https://github.com/onl1ner/STTextView.git
手动安装
您也可以手动安装。只需将 STTextView.swift
文件拖放到您的 Xcode 项目中。
用法
界面构建器
只需将 STTextView
类附加到您的 UITextView 对象中,您就可以通过界面构建器修改值。
Swift
import STTextView
let textView = STTextView()
textView.placeholder = "Some placeholder text"
textView.placeholderColor = .secondaryLabel
您还可以拥有一个属性化占位符。使用 attributedPlaceholder
属性。
示例
打开示例项目 STTextViewExample/STTextViewExample.xcworkspace
,以查看框架使用的基本演示。
贡献
遇到一些问题?请随意打开一个问题。
许可证
STTextView在MIT许可证的条款和条件下。
MIT License
Copyright (c) 2020 Tamerlan Satualdypov
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.