File tree Expand file tree Collapse file tree
CodeEdit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //
2+ // GlassEffectView.swift
3+ // CodeEdit
4+ //
5+ // Created by Khan Winter on 9/2/25.
6+ //
7+
8+ import SwiftUI
9+ import AppKit
10+
11+ struct GlassEffectView : NSViewRepresentable {
12+ var tintColor : NSColor ?
13+
14+ init ( tintColor: NSColor ? = nil ) {
15+ self . tintColor = tintColor
16+ }
17+
18+ func makeNSView( context: Context ) -> NSView {
19+ #if compiler(>=6.2)
20+ if #available( macOS 26 , * ) {
21+ let view = NSGlassEffectView ( )
22+ view. cornerRadius = 0
23+ view. tintColor = tintColor
24+ return view
25+ }
26+ #endif
27+ return NSView ( )
28+ }
29+
30+ func updateNSView( _ nsView: NSView , context: Context ) {
31+ #if compiler(>=6.2)
32+ if #available( macOS 26 , * ) , let view = nsView as? NSGlassEffectView {
33+ view. tintColor = tintColor
34+ }
35+ #endif
36+ }
37+ }
Original file line number Diff line number Diff line change @@ -341,21 +341,27 @@ struct EditorTabs: View {
341341 // To fill up the parent space of tab bar.
342342 . frame ( maxWidth: . infinity)
343343 }
344- . overlay ( alignment: . leading) {
345- EditorTabsOverflowShadow (
346- width: colorScheme == . dark ? 5 : 7 ,
347- startPoint: . leading,
348- endPoint: . trailing
349- )
350- . opacity ( scrollOffset >= 0 ? 0 : 1 )
351- }
352- . overlay ( alignment: . trailing) {
353- EditorTabsOverflowShadow (
354- width: colorScheme == . dark ? 5 : 7 ,
355- startPoint: . trailing,
356- endPoint: . leading
357- )
358- . opacity ( ( scrollTrailingOffset ?? 0 ) <= 0 ? 0 : 1 )
344+ . if ( . tahoe) {
345+ if #available( macOS 26 . 0 , * ) {
346+ $0. background ( GlassEffectView ( tintColor: . secondarySystemFill) ) . clipShape ( Capsule ( ) )
347+ }
348+ } else: {
349+ $0. overlay ( alignment: . leading) {
350+ EditorTabsOverflowShadow (
351+ width: colorScheme == . dark ? 5 : 7 ,
352+ startPoint: . leading,
353+ endPoint: . trailing
354+ )
355+ . opacity ( scrollOffset >= 0 ? 0 : 1 )
356+ }
357+ . overlay ( alignment: . trailing) {
358+ EditorTabsOverflowShadow (
359+ width: colorScheme == . dark ? 5 : 7 ,
360+ startPoint: . trailing,
361+ endPoint: . leading
362+ )
363+ . opacity ( ( scrollTrailingOffset ?? 0 ) <= 0 ? 0 : 1 )
364+ }
359365 }
360366 }
361367 }
Original file line number Diff line number Diff line change @@ -19,6 +19,18 @@ struct EditorAreaView: View {
1919 @AppSettings ( \. general. dimEditorsWithoutFocus)
2020 var dimEditorsWithoutFocus
2121
22+ @AppSettings ( \. theme. useThemeBackground)
23+ var useThemeBackground
24+
25+ private var backgroundColor : NSColor {
26+ let fallback = NSColor . textBackgroundColor
27+ return if useThemeBackground {
28+ ThemeModel . shared. selectedTheme? . editor. background. nsColor ?? fallback
29+ } else {
30+ fallback
31+ }
32+ }
33+
2234 @ObservedObject var editor : Editor
2335
2436 @FocusState . Binding var focus : Editor ?
@@ -111,7 +123,9 @@ struct EditorAreaView: View {
111123 EditorTabBarView ( hasTopInsets: topSafeArea > 0 , codeFile: fileBinding)
112124 . id ( " TabBarView " + editor. id. uuidString)
113125 . environmentObject ( editor)
114- Divider ( )
126+ if #unavailable( macOS 26 ) {
127+ Divider ( )
128+ }
115129 }
116130 if showEditorJumpBar {
117131 EditorJumpBarView (
@@ -129,7 +143,8 @@ struct EditorAreaView: View {
129143 }
130144 }
131145 . environment ( \. isActiveEditor, editor == editorManager. activeEditor)
132- . background ( EffectView ( . headerView) )
146+ // .background(EffectView(.headerView))
147+ . background ( GlassEffectView ( ) )
133148 }
134149 }
135150 . focused ( $focus, equals: editor)
Original file line number Diff line number Diff line change 1+ //
2+ // View+if.swift
3+ // CodeEdit
4+ //
5+ // Created by Khan Winter on 9/5/25.
6+ //
7+
8+ import SwiftUI
9+
10+ extension View {
11+ /// Applies the given transform if the given condition evaluates to `true`.
12+ /// - Parameters:
13+ /// - condition: The condition to evaluate.
14+ /// - transform: The transform to apply to the source `View`.
15+ /// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
16+ @ViewBuilder
17+ func `if`< Content: View > ( _ condition: Bool , @ViewBuilder transform: ( Self ) -> Content ) -> some View {
18+ if condition {
19+ transform ( self )
20+ } else {
21+ self
22+ }
23+ }
24+
25+ /// Applies the given transform if the given condition evaluates to `true`.
26+ /// - Parameters:
27+ /// - condition: The condition to evaluate.
28+ /// - transform: The transform to apply to the source `View`.
29+ /// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
30+ @ViewBuilder
31+ func `if`< Content: View , ElseContent: View > (
32+ _ condition: Bool ,
33+ @ViewBuilder transform: ( Self ) -> Content ,
34+ @ViewBuilder else elseTransform: ( Self ) -> ElseContent
35+ ) -> some View {
36+ if condition {
37+ transform ( self )
38+ } else {
39+ elseTransform ( self )
40+ }
41+ }
42+ }
43+
44+ extension Bool {
45+ static var tahoe : Bool {
46+ if #available( macOS 26 , * ) {
47+ return true
48+ } else {
49+ return false
50+ }
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments