Skip to content

Commit 1120d6d

Browse files
committed
Target iOS 17
1 parent 0df06d5 commit 1120d6d

11 files changed

Lines changed: 117 additions & 174 deletions

File tree

.github/funding.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.swiftlint.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ only_rules:
8080
- no_extension_access_modifier
8181
- no_fallthrough_only
8282
- no_space_in_method_call
83+
- non_overridable_class_declaration
8384
- notification_center_detachment
8485
- ns_number_init_as_function_reference
8586
- nsobject_prefer_isequal
@@ -94,6 +95,7 @@ only_rules:
9495
- private_action
9596
- private_outlet
9697
- private_subject
98+
- private_swiftui_state
9799
- private_unit_test
98100
- prohibited_super_call
99101
- protocol_property_accessors_order
@@ -133,6 +135,7 @@ only_rules:
133135
- unavailable_condition
134136
- unavailable_function
135137
- unneeded_break_in_switch
138+
- unneeded_override
136139
- unneeded_parentheses_in_closure_argument
137140
- unowned_variable_capture
138141
- untyped_error_in_catch
@@ -180,7 +183,7 @@ identifier_name:
180183
- 'y2'
181184
- 'z2'
182185
deployment_target:
183-
iOS_deployment_target: '16'
186+
iOS_deployment_target: '17'
184187
custom_rules:
185188
no_nsrect:
186189
regex: '\bNSRect\b'
@@ -202,8 +205,8 @@ custom_rules:
202205
regex: '\bCGFloat\('
203206
message: 'Use Double instead of CGFloat'
204207
swiftui_state_private:
205-
regex: '@(State|StateObject|ObservedObject|EnvironmentObject)\s+var'
206-
message: 'SwiftUI @State/@StateObject/@ObservedObject/@EnvironmentObject properties should be private'
208+
regex: '@(ObservedObject|EnvironmentObject)\s+var'
209+
message: 'SwiftUI @ObservedObject/@EnvironmentObject properties should be private'
207210
swiftui_environment_private:
208211
regex: '@Environment\(\\\.\w+\)\s+var'
209212
message: 'SwiftUI @Environment properties should be private'

Action Extension/MainScreen.swift

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,42 @@ struct MainScreen: View {
1010
@State private var isWallpaperTipPresented = false
1111
@ViewStorage private var hostingView: UIView?
1212

13+
var body: some View {
14+
VStack {
15+
if let image {
16+
EditorScreen(
17+
image: .constant(image),
18+
blurAmount: $blurAmount
19+
)
20+
}
21+
}
22+
.safeAreaInset(edge: .top) {
23+
if !isSaving {
24+
controls
25+
.safeAreaPadding(.top, 16)
26+
}
27+
}
28+
.taskOrAssign($error) {
29+
image = try await getImage()
30+
}
31+
.alert2(
32+
"How to Change Wallpaper",
33+
message: "Go to the most recent photo in the photo library, tap the action button at the \(DeviceInfo.isPad ? "top right" : "bottom left"), and choose “Use as Wallpaper”.",
34+
isPresented: $isWallpaperTipPresented
35+
)
36+
.onChange(of: isWallpaperTipPresented) {
37+
guard !isWallpaperTipPresented else {
38+
return
39+
}
40+
41+
extensionContext.cancel()
42+
}
43+
.alert(error: $error)
44+
.accessHostingView {
45+
hostingView = $0
46+
}
47+
}
48+
1349
private var controls: some View {
1450
VStack {
1551
HStack {
@@ -22,7 +58,7 @@ struct MainScreen: View {
2258
.imageScale(.large)
2359
// Increase tap area
2460
.padding(8)
25-
.contentShape(.rectangle)
61+
.contentShape(.rect)
2662
}
2763
.padding(.horizontal, -8)
2864
// TOOD: use label instead
@@ -39,7 +75,7 @@ struct MainScreen: View {
3975
.imageScale(.large)
4076
// Increase tap area
4177
.padding(8)
42-
.contentShape(.rectangle)
78+
.contentShape(.rect)
4379
}
4480
.padding(.horizontal, -8)
4581
// TOOD: Use label instead
@@ -60,40 +96,8 @@ struct MainScreen: View {
6096
.padding(.vertical)
6197
}
6298

63-
var body: some View {
64-
ZStack {
65-
if let image {
66-
EditorScreen(
67-
image: .constant(image),
68-
blurAmount: $blurAmount
69-
)
70-
}
71-
if !isSaving {
72-
controls
73-
}
74-
}
75-
.taskOrAssign($error) {
76-
image = try await getImage()
77-
}
78-
.alert2(
79-
"How to Change Wallpaper",
80-
message: "Go to the most recent photo in the photo library, tap the action button at the \(DeviceInfo.isPad ? "top right" : "bottom left"), and choose “Use as Wallpaper”.",
81-
isPresented: $isWallpaperTipPresented
82-
)
83-
.onChange(of: isWallpaperTipPresented) {
84-
guard !$0 else {
85-
return
86-
}
87-
88-
extensionContext.cancel()
89-
}
90-
.alert(error: $error)
91-
.accessHostingView {
92-
hostingView = $0
93-
}
94-
}
95-
9699
private func getImage() async throws -> UIImage {
100+
// TODO: Switch to Transferable when targeting iOS 18.
97101
guard
98102
let itemProvider = (extensionContext.attachments.first { $0.hasItemConforming(to: .image) })
99103
else {
@@ -152,8 +156,6 @@ struct MainScreen: View {
152156
}
153157
}
154158

155-
//struct MainScreen_Previews: PreviewProvider {
156-
// static var previews: some View {
157-
// MainScreen()
158-
// }
159+
//#Preview {
160+
// MainScreen()
159161
//}

Blear.xcodeproj/project.pbxproj

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
E31C26B5282D31900047A564 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = E31C26B4282D31900047A564 /* Sentry */; };
1313
E33A6D501B2272B700CBEDC9 /* UIImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = E33A6D4F1B2272B700CBEDC9 /* UIImageEffects.m */; };
1414
E3430F431B27AD5800AF3F80 /* Bundled Photos in Resources */ = {isa = PBXBuildFile; fileRef = E3430F421B27AD5800AF3F80 /* Bundled Photos */; };
15-
E3476879267E9ED40022D2F5 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3476878267E9ED40022D2F5 /* AppState.swift */; };
1615
E35850582541D24200F9D5BD /* EditorScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35850572541D24200F9D5BD /* EditorScreen.swift */; };
1716
E37CDDE426F1FA7A00130AD3 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = E37CDDE326F1FA7A00130AD3 /* Defaults */; };
1817
E37D72AE2329664C008B1C48 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E37D72AD2329664B008B1C48 /* Constants.swift */; };
1918
E3A0365A17E5E7AE00892B76 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3A0365917E5E7AE00892B76 /* App.swift */; };
2019
E3A0368F17E6214600892B76 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3A0368E17E6214500892B76 /* Utilities.swift */; };
2120
E3C77408255D7FF900A492FC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3C77407255D7FF900A492FC /* Assets.xcassets */; };
22-
E3DFE28B25422D4500B3F299 /* AboutScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3DFE28A25422D4500B3F299 /* AboutScreen.swift */; };
2321
E3DFE29C254390AB00B3F299 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3DFE29B254390AB00B3F299 /* Media.xcassets */; };
2422
E3DFE29E254390AB00B3F299 /* ActionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3DFE29D254390AB00B3F299 /* ActionViewController.swift */; };
2523
E3DFE2A5254390AB00B3F299 /* Action Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = E3DFE299254390AB00B3F299 /* Action Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@@ -59,7 +57,6 @@
5957
E33A6D4E1B2272B700CBEDC9 /* UIImageEffects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageEffects.h; sourceTree = "<group>"; };
6058
E33A6D4F1B2272B700CBEDC9 /* UIImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageEffects.m; sourceTree = "<group>"; };
6159
E3430F421B27AD5800AF3F80 /* Bundled Photos */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Bundled Photos"; sourceTree = "<group>"; };
62-
E3476878267E9ED40022D2F5 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
6360
E35850572541D24200F9D5BD /* EditorScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorScreen.swift; sourceTree = "<group>"; };
6461
E37D72AD2329664B008B1C48 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Constants.swift; sourceTree = "<group>"; usesTabs = 1; };
6562
E3A0364617E5E7AE00892B76 /* Blear.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Blear.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -68,7 +65,6 @@
6865
E3A0368E17E6214500892B76 /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Utilities.swift; sourceTree = "<group>"; usesTabs = 1; };
6966
E3B140881F2C2F2A008408AC /* Blear-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Blear-Bridging-Header.h"; sourceTree = "<group>"; };
7067
E3C77407255D7FF900A492FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
71-
E3DFE28A25422D4500B3F299 /* AboutScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutScreen.swift; sourceTree = "<group>"; };
7268
E3DFE299254390AB00B3F299 /* Action Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Action Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
7369
E3DFE29B254390AB00B3F299 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
7470
E3DFE29D254390AB00B3F299 /* ActionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionViewController.swift; sourceTree = "<group>"; };
@@ -125,10 +121,8 @@
125121
children = (
126122
E3A0365917E5E7AE00892B76 /* App.swift */,
127123
E37D72AD2329664B008B1C48 /* Constants.swift */,
128-
E3476878267E9ED40022D2F5 /* AppState.swift */,
129124
E3ECA0C124A4FC5900A1864E /* MainScreen.swift */,
130125
E35850572541D24200F9D5BD /* EditorScreen.swift */,
131-
E3DFE28A25422D4500B3F299 /* AboutScreen.swift */,
132126
E3A0368E17E6214500892B76 /* Utilities.swift */,
133127
E3C77407255D7FF900A492FC /* Assets.xcassets */,
134128
E3A0365017E5E7AE00892B76 /* Supporting Files */,
@@ -166,9 +160,9 @@
166160
E3DFE29A254390AB00B3F299 /* Action Extension */ = {
167161
isa = PBXGroup;
168162
children = (
169-
E3DFE29B254390AB00B3F299 /* Media.xcassets */,
170163
E3DFE2AC254390D000B3F299 /* MainScreen.swift */,
171164
E3DFE29D254390AB00B3F299 /* ActionViewController.swift */,
165+
E3DFE29B254390AB00B3F299 /* Media.xcassets */,
172166
E3DFE2A2254390AB00B3F299 /* Info.plist */,
173167
);
174168
path = "Action Extension";
@@ -311,8 +305,6 @@
311305
files = (
312306
E37D72AE2329664C008B1C48 /* Constants.swift in Sources */,
313307
E3ECA0C224A4FC5A00A1864E /* MainScreen.swift in Sources */,
314-
E3DFE28B25422D4500B3F299 /* AboutScreen.swift in Sources */,
315-
E3476879267E9ED40022D2F5 /* AppState.swift in Sources */,
316308
E35850582541D24200F9D5BD /* EditorScreen.swift in Sources */,
317309
E3A0365A17E5E7AE00892B76 /* App.swift in Sources */,
318310
E33A6D501B2272B700CBEDC9 /* UIImageEffects.m in Sources */,
@@ -395,7 +387,7 @@
395387
GCC_WARN_UNINITIALIZED_AUTOS = YES;
396388
GCC_WARN_UNUSED_FUNCTION = YES;
397389
GCC_WARN_UNUSED_VARIABLE = YES;
398-
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
390+
IPHONEOS_DEPLOYMENT_TARGET = 17.1;
399391
ONLY_ACTIVE_ARCH = YES;
400392
SDKROOT = iphoneos;
401393
SWIFT_VERSION = 5.0;
@@ -447,7 +439,7 @@
447439
GCC_WARN_UNINITIALIZED_AUTOS = YES;
448440
GCC_WARN_UNUSED_FUNCTION = YES;
449441
GCC_WARN_UNUSED_VARIABLE = YES;
450-
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
442+
IPHONEOS_DEPLOYMENT_TARGET = 17.1;
451443
SDKROOT = iphoneos;
452444
SWIFT_COMPILATION_MODE = wholemodule;
453445
SWIFT_OPTIMIZATION_LEVEL = "-O";
@@ -539,6 +531,9 @@
539531
PRODUCT_BUNDLE_IDENTIFIER = "com.sindresorhus.blear.Action-Extension";
540532
PRODUCT_NAME = "$(TARGET_NAME)";
541533
SKIP_INSTALL = YES;
534+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
535+
SUPPORTS_MACCATALYST = NO;
536+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
542537
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG APP_EXTENSION";
543538
SWIFT_OBJC_BRIDGING_HEADER = "Blear/Blear-Bridging-Header.h";
544539
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -574,6 +569,9 @@
574569
PRODUCT_BUNDLE_IDENTIFIER = "com.sindresorhus.blear.Action-Extension";
575570
PRODUCT_NAME = "$(TARGET_NAME)";
576571
SKIP_INSTALL = YES;
572+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
573+
SUPPORTS_MACCATALYST = NO;
574+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
577575
SWIFT_ACTIVE_COMPILATION_CONDITIONS = APP_EXTENSION;
578576
SWIFT_OBJC_BRIDGING_HEADER = "Blear/Blear-Bridging-Header.h";
579577
TARGETED_DEVICE_FAMILY = "1,2";

Blear/AboutScreen.swift

Lines changed: 0 additions & 40 deletions
This file was deleted.

Blear/App.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ TODO:
1111

1212
@main
1313
struct AppMain: App {
14-
@StateObject private var appState = AppState()
15-
1614
init() {
1715
initSentry()
1816
}
1917

2018
var body: some Scene {
2119
WindowGroup {
2220
MainScreen()
23-
.environmentObject(appState)
2421
}
2522
}
2623
}

Blear/AppState.swift

Lines changed: 0 additions & 6 deletions
This file was deleted.

Blear/EditorScreen.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ struct EditorScreen: View {
2424
.fillFrame()
2525
}
2626
.ignoresSafeArea()
27-
.onChange(of: image) { _ in
27+
.onChange(of: image) {
2828
updateImage(blurAmount: blurAmount)
2929
}
3030
.onChange(of: blurAmount) {
31-
updateImage(blurAmount: $0)
31+
updateImage(blurAmount: blurAmount)
3232
}
3333
.task {
3434
UIScrollView.appearance().bounces = false
@@ -60,8 +60,6 @@ struct EditorScreen: View {
6060
}
6161
}
6262

63-
//struct EditorScreen_Previews: PreviewProvider {
64-
// static var previews: some View {
65-
// EditorScreen()
66-
// }
63+
//#Preview {
64+
// EditorScreen()
6765
//}

0 commit comments

Comments
 (0)