Skip to content

Commit

Permalink
Remove State initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Oct 28, 2024
1 parent e36de45 commit 2b0ff4d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct CustomTabWidthView: View {
/// - completionHandler: The callback method to perform when the command was accepted.
init(tabWidth: Int, completionHandler: @escaping (_ tabWidth: Int) -> Void) {

self._value = State(initialValue: tabWidth)
self.value = tabWidth
self.defaultWidth = tabWidth
self.completionHandler = completionHandler
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct PatternSortView: View {
self.sampleFontName = sampleFontName
self.completionHandler = completionHandler

self._attributedSampleLine = State(initialValue: AttributedString(sampleLine))
self.attributedSampleLine = AttributedString(sampleLine)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ import Defaults

struct UnicodeInputView: View {

let completionHandler: (_ character: Character) -> Void

@State private var codePoint: String = ""
@State var codePoint: String = ""
var completionHandler: (_ character: Character) -> Void = { _ in }


// MARK: View
Expand Down Expand Up @@ -154,17 +153,6 @@ private extension UTF32.CodeUnit {

// MARK: - Preview

private extension UnicodeInputView {

/// Initializer for preview.
init(codePoint: String) {

self._codePoint = State(initialValue: codePoint)
self.completionHandler = { _ in }
}
}


#Preview("Empty") {
UnicodeInputView(codePoint: "")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private struct ConflictTable: View {
init(_ name: String, conflicts: [Item]) {

self.name = name
self._conflicts = .init(wrappedValue: conflicts)
self.conflicts = conflicts
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct SyntaxEditView: View {

init(syntax: Syntax? = nil, originalName: String? = nil, isBundled: Bool = false, saveAction: @escaping SaveAction) {

self._syntax = State(wrappedValue: SyntaxObject(value: syntax))
self.syntax = SyntaxObject(value: syntax)
self.originalName = originalName
self.isBundled = isBundled
self.saveAction = saveAction
Expand Down

0 comments on commit 2b0ff4d

Please sign in to comment.