Commit 113407a 1 parent 2d69bfb commit 113407a Copy full SHA for 113407a
File tree 4 files changed +21
-15
lines changed
4 files changed +21
-15
lines changed Original file line number Diff line number Diff line change 8
8
//
9
9
// ---------------------------------------------------------------------------
10
10
//
11
- // © 2022-2023 1024jp
11
+ // © 2022-2024 1024jp
12
12
//
13
13
// Licensed under the Apache License, Version 2.0 (the "License");
14
14
// you may not use this file except in compliance with the License.
@@ -190,7 +190,9 @@ final class PaddingTextField: NSTextField {
190
190
// MARK: - Preview
191
191
192
192
#Preview {
193
- InsetTextField ( text: . constant( " " ) , prompt: " Prompt " )
193
+ @State var text = " "
194
+
195
+ return InsetTextField ( text: $text, prompt: " Prompt " )
194
196
. inset ( . leading, 20 )
195
197
. frame ( width: 160 )
196
198
}
Original file line number Diff line number Diff line change 8
8
//
9
9
// ---------------------------------------------------------------------------
10
10
//
11
- // © 2023 1024jp
11
+ // © 2023-2024 1024jp
12
12
//
13
13
// Licensed under the Apache License, Version 2.0 (the "License");
14
14
// you may not use this file except in compliance with the License.
@@ -122,6 +122,8 @@ struct RegexTextField: NSViewRepresentable {
122
122
// MARK: - Preview
123
123
124
124
#Preview {
125
- RegexTextField ( text: . constant( " [^abc]def " ) )
125
+ @State var text = " [^abc]def "
126
+
127
+ return RegexTextField ( text: $text)
126
128
. leadingInset ( 20 )
127
129
}
Original file line number Diff line number Diff line change @@ -115,10 +115,8 @@ private extension Binding where Value == Int {
115
115
116
116
// MARK: - Preview
117
117
118
- struct StepperNumberField_Previews : PreviewProvider {
118
+ #Preview {
119
+ @State var value = 4
119
120
120
- static var previews : some View {
121
-
122
- StepperNumberField ( value: . constant( 4 ) , in: 0 ... 10 )
123
- }
121
+ return StepperNumberField ( value: $value, in: 0 ... 10 )
124
122
}
Original file line number Diff line number Diff line change @@ -311,20 +311,24 @@ private extension Theme.Metadata {
311
311
312
312
// MARK: - Preview
313
313
314
- #Preview {
314
+ @available ( macOS 14 , * )
315
+ #Preview( traits: . fixedLayout( width: 360 , height: 280 ) ) {
315
316
ThemeEditorView ( ThemeManager . shared. setting ( name: " Anura " ) !, isBundled: false ) { _ in }
316
- . frame ( width: 360 , height: 280 )
317
317
}
318
318
319
319
#Preview( " Metadata (editable) " ) {
320
- ThemeMetadataView ( metadata: . constant ( . init (
320
+ @ State var metadata = Theme . Metadata (
321
321
author: " Clarus " ,
322
322
distributionURL: " https://coteditor.com "
323
- ) ) , isEditable: true )
323
+ )
324
+
325
+ return ThemeMetadataView ( metadata: $metadata, isEditable: true )
324
326
}
325
327
326
328
#Preview( " Metadata (fixed) " ) {
327
- ThemeMetadataView ( metadata: . constant ( . init (
329
+ @ State var metadata = Theme . Metadata (
328
330
author: " Claus "
329
- ) ) , isEditable: false )
331
+ )
332
+
333
+ return ThemeMetadataView ( metadata: $metadata, isEditable: false )
330
334
}
You can’t perform that action at this time.
0 commit comments