diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index f8f02a349..d5f1eadf2 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -878,6 +878,7 @@ DFD406FA291FB5E400C02962 /* SettingsRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406F9291FB5E400C02962 /* SettingsRows.swift */; }; DFD406FC291FB63B00C02962 /* SettingsHelpSheets.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */; }; DFD406FF291FDC0C00C02962 /* DisplayAndBehaviorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406FE291FDC0C00C02962 /* DisplayAndBehaviorsView.swift */; }; + DFE522A32953DEF400376B77 /* CustomInsetGroupedRowStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFE522A22953DEF400376B77 /* CustomInsetGroupedRowStyle.swift */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; DFFC4E7428E95C01006B82AF /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFC4E7328E95C01006B82AF /* AboutView.swift */; }; FF3ABF13232599810074C542 /* ArticleSorterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF09232599450074C542 /* ArticleSorterTests.swift */; }; @@ -1629,6 +1630,7 @@ DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsHelpSheets.swift; sourceTree = ""; }; DFD406FE291FDC0C00C02962 /* DisplayAndBehaviorsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayAndBehaviorsView.swift; sourceTree = ""; }; DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; + DFE522A22953DEF400376B77 /* CustomInsetGroupedRowStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomInsetGroupedRowStyle.swift; sourceTree = ""; }; DFFC4E7328E95C01006B82AF /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = ""; }; FF3ABF09232599450074C542 /* ArticleSorterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorterTests.swift; sourceTree = ""; }; FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorter.swift; sourceTree = ""; }; @@ -2966,11 +2968,12 @@ DFB34986294B446300BC81AD /* SwiftUI Extensions */ = { isa = PBXGroup; children = ( - DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */, DFB349A3294E914D00BC81AD /* AccountSectionHeader.swift */, + DFE522A22953DEF400376B77 /* CustomInsetGroupedRowStyle.swift */, DF28B454294FE74A00C4D8CA /* ExtensionSectionHeader.swift */, - DF28B44C294ED52700C4D8CA /* View+DismissOnExternalContext.swift */, + DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */, DF28B450294EFC6C00C4D8CA /* View+DismissOnAccountAdd.swift */, + DF28B44C294ED52700C4D8CA /* View+DismissOnExternalContext.swift */, ); path = "SwiftUI Extensions"; sourceTree = ""; @@ -4296,6 +4299,7 @@ 518651DA235621840078E021 /* ImageTransition.swift in Sources */, 51C266EA238C334800F53014 /* ContextMenuPreviewViewController.swift in Sources */, 173A642C2547BE9600267F6E /* AccountType+Helpers.swift in Sources */, + DFE522A32953DEF400376B77 /* CustomInsetGroupedRowStyle.swift in Sources */, 51627A6923861DED007B3B4B /* MasterFeedViewController+Drop.swift in Sources */, 514219372352510100E07E2C /* ImageScrollView.swift in Sources */, 516AE9B32371C372007DEEAA /* MasterFeedTableViewSectionHeaderLayout.swift in Sources */, diff --git a/iOS/Settings/Appearance/TimelineCustomizerView.swift b/iOS/Settings/Appearance/TimelineCustomizerView.swift index 4948e7d34..07404c7d9 100644 --- a/iOS/Settings/Appearance/TimelineCustomizerView.swift +++ b/iOS/Settings/Appearance/TimelineCustomizerView.swift @@ -16,19 +16,12 @@ struct TimelineCustomizerView: View { var body: some View { List { Section(header: Text("Icon Size", comment: "Timline Customiser: Icon size section header")) { - ZStack { TickMarkSliderView(minValue: 1, maxValue: 3, currentValue: Binding(get: { Float(appDefaults.timelineIconSize.rawValue) }, set: { AppDefaults.shared.timelineIconSize = IconSize(rawValue: Int($0))! })) } - .padding(.horizontal, 16) - .padding(.vertical, 8) - .listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15)) - .background( - RoundedRectangle(cornerRadius: 8) - .foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground)) - ) + .customInsetGroupedRowStyle() } .listRowInsets(EdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30)) .listRowBackground(Color.clear) @@ -40,13 +33,7 @@ struct TimelineCustomizerView: View { Float(appDefaults.timelineNumberOfLines) }, set: { appDefaults.timelineNumberOfLines = Int($0) })) } - .padding(.horizontal, 16) - .padding(.vertical, 8) - .listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15)) - .background( - RoundedRectangle(cornerRadius: 8) - .foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground)) - ) + .customInsetGroupedRowStyle() } .listRowInsets(EdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30)) .listRowBackground(Color.clear) diff --git a/iOS/SwiftUI Extensions/CustomInsetGroupedRowStyle.swift b/iOS/SwiftUI Extensions/CustomInsetGroupedRowStyle.swift new file mode 100644 index 000000000..4ca621bec --- /dev/null +++ b/iOS/SwiftUI Extensions/CustomInsetGroupedRowStyle.swift @@ -0,0 +1,34 @@ +// +// CustomInsetGroupedRowStyle.swift +// NetNewsWire-iOS +// +// Created by Stuart Breckenridge on 22/12/2022. +// Copyright © 2022 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct CustomInsetGroupedRowStyle: ViewModifier { + + func body(content: Content) -> some View { + content + .padding(.horizontal, 16) + .padding(.vertical, 8) + .listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15)) + .background( + RoundedRectangle(cornerRadius: 8) + .foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground)) + ) + } + +} + +extension View { + + /// This function dismisses a view when the user launches from + /// an external action, for example, opening the app from the widget. + /// - Returns: `View` + func customInsetGroupedRowStyle() -> some View { + modifier(CustomInsetGroupedRowStyle()) + } +}