Skip to content

Commit

Permalink
Update docs for Picker, Slider, and TextField (#57)
Browse files Browse the repository at this point in the history
* Corrected some documentation for the TextField, Picker, and Slider

* Applied fixes from comments
  • Loading branch information
NinjaCheetah authored Oct 20, 2023
1 parent c9d2cd4 commit a08685f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 42 deletions.
36 changes: 0 additions & 36 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
"version": null
}
},
{
"package": "OpenCombine",
"repositoryURL": "https://github.com/OpenCombine/OpenCombine.git",
"state": {
"branch": null,
"revision": "8576f0d579b27020beccbccc3ea6844f3ddfc2c2",
"version": "0.14.0"
}
},
{
"package": "Qlift",
"repositoryURL": "https://github.com/Longhanks/qlift",
Expand Down Expand Up @@ -64,33 +55,6 @@
"version": "508.0.1"
}
},
{
"package": "SwiftTerm",
"repositoryURL": "https://github.com/migueldeicaza/SwiftTerm.git",
"state": {
"branch": null,
"revision": "116b795e4de2324d4a1b1bb2db02141294bc9229",
"version": "1.2.4"
}
},
{
"package": "TermKit",
"repositoryURL": "https://github.com/migueldeicaza/TermKit",
"state": {
"branch": null,
"revision": "3bce85d1bafbbb0336b3b7b7e905c35754cb9adf",
"version": null
}
},
{
"package": "TextBufferKit",
"repositoryURL": "https://github.com/migueldeicaza/TextBufferKit.git",
"state": {
"branch": null,
"revision": "7f3ed5b1d7288de34ad853544d802647be11cfcf",
"version": "0.3.0"
}
},
{
"package": "XMLCoder",
"repositoryURL": "https://github.com/CoreOffice/XMLCoder",
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftCrossUI/Views/Picker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
public struct Picker<Value: Equatable>: View {
public var body = EmptyViewContent()

/// The string to be shown in the text view.
/// The options to be offered by the picker.
private var options: [Value]
/// Specifies whether the text should be wrapped if wider than its container.
/// The picker's selected option.
private var value: Binding<Value?>

/// The index of the selected option (if any).
Expand All @@ -14,7 +14,7 @@ public struct Picker<Value: Equatable>: View {
}
}

/// Creates a new text view with the given content.
/// Creates a new picker with the given options and a binding for the selected value.
public init(of options: [Value], selection value: Binding<Value?>) {
self.options = options
self.value = value
Expand Down
2 changes: 2 additions & 0 deletions Sources/SwiftCrossUI/Views/Slider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public struct Slider: View {
/// The number of decimal places used when displaying the value.
private var decimalPlaces: Int

/// Creates a slider to select a value between a minimum and maximum value.
public init<T: BinaryInteger>(_ value: Binding<T>? = nil, minimum: T, maximum: T) {
if let value = value {
self.value = Binding<Double>(
Expand All @@ -64,6 +65,7 @@ public struct Slider: View {
decimalPlaces = 0
}

/// Creates a slider to select a value between a minimum and maximum value.
public init<T: BinaryFloatingPoint>(_ value: Binding<T>? = nil, minimum: T, maximum: T) {
if let value = value {
self.value = Binding<Double>(
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftCrossUI/Views/TextField.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/// A button view.
/// A TextField view.
public struct TextField: View {
public var body = EmptyViewContent()

/// The label to show when the field is empty.
private var placeholder: String
/// Storage for the field's content.
/// The field's content.
private var value: Binding<String>?

/// Creates a new button.
/// Creates an editable text field and binds a value.
public init(_ placeholder: String = "", _ value: Binding<String>? = nil) {
self.placeholder = placeholder
self.value = value
Expand Down

0 comments on commit a08685f

Please sign in to comment.