프로젝트
GitHub에서 보기
kenmueller/TextView
소개
The missing TextView in SwiftUI
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalTextView
The missing TextView in SwiftUI
Download
- File -> Swift Packages -> Add Package Dependency...
- Select your project
- Enter
https://github.com/kenmueller/TextViewfor the package repository URL - Select Branch: master
- Click Finish
Inputs
text: Binding<String>isEditing: Binding<Bool>- The
TextViewwill modify the value when it is selected and deselected - You can also modify this value to automatically select and deselect the
TextView
- The
placeholder: String? = niltextAlignment: TextView.TextAlignment = .lefttextHorizontalPadding: CGFloat = 0textVerticalPadding: CGFloat = 7placeholderAlignment: Alignment = .topLeadingplaceholderHorizontalPadding: CGFloat = 4.5placeholderVerticalPadding: CGFloat = 7font: UIFont = .preferredFont(forTextStyle: .body)- By default, the font is a body-style font
textColor: UIColor = .blackplaceholderColor: Color = .graybackgroundColor: UIColor = .whitecontentType: TextView.ContentType? = nil- For semantic purposes only
autocorrection: TextView.Autocorrection = .defaultautocapitalization: TextView.Autocapitalization = .sentencesisSecure: Bool = falseisEditable: Bool = trueisSelectable: Bool = trueisScrollingEnabled: Bool = trueisUserInteractionEnabled: Bool = trueshouldWaitUntilCommit: Bool = true- For multi-stage input methods, setting this to
falsewould make theTextViewcompletely unusable. - This option will ignore text changes when the user is still composing characters.
- For multi-stage input methods, setting this to
shouldChange: TextView.ShouldChangeHandler? = nil- Of type
(NSRange, String) -> Booland is called with the arguments totextView(_:shouldChangeTextIn:replacementText:).
- Of type
Example
import SwiftUI
import TextView
struct ContentView: View {
@State var text = ""
@State var isEditing = false
var body: some View {
VStack {
Button(action: {
self.isEditing.toggle()
}) {
Text("\(isEditing ? "Stop" : "Start") editing")
}
TextView(
text: $text,
isEditing: $isEditing,
placeholder: "Enter text here"
)
}
}
}
You might also find these useful...
관련 프로젝트 살펴보기
불러오는 중…