Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 14, 2024
1 parent 37f9623 commit f1271fb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
19 changes: 16 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ only_rules:
- explicit_init
- fallthrough
- fatal_error_message
- final_test_case
- first_where
- flatmap_over_map_reduce
- for_where
Expand All @@ -72,6 +73,8 @@ only_rules:
- lower_acl_than_parent
- mark
- modifier_order
- multiline_arguments
- multiline_arguments_brackets
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
Expand All @@ -80,12 +83,12 @@ only_rules:
- no_extension_access_modifier
- no_fallthrough_only
- no_space_in_method_call
- non_optional_string_data_conversion
- non_overridable_class_declaration
- notification_center_detachment
- ns_number_init_as_function_reference
- nsobject_prefer_isequal
- number_separator
- opening_brace
- operator_usage_whitespace
- operator_whitespace
- overridden_super_call
Expand Down Expand Up @@ -119,6 +122,7 @@ only_rules:
- sorted_first_last
- statement_position
- static_operator
- static_over_final_class
- strong_iboutlet
- superfluous_disable_command
- superfluous_else
Expand Down Expand Up @@ -146,6 +150,7 @@ only_rules:
- unused_setter_value
- valid_ibinspectable
- vertical_parameter_alignment
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- void_function_in_ternary
Expand All @@ -155,9 +160,10 @@ only_rules:
- yoda_condition
analyzer_rules:
- capture_variable
- typesafe_array_init
- unneeded_synthesized_initializer
- unused_declaration
- unused_import
- typesafe_array_init
for_where:
allow_for_as_filter: true
number_separator:
Expand All @@ -182,8 +188,15 @@ identifier_name:
- 'y1'
- 'y2'
- 'z2'
redundant_type_annotation:
consider_default_literal_types_redundant: true
unneeded_override:
affect_initializers: true
deployment_target:
macOS_deployment_target: '14'
iOS_deployment_target: '17'
tvOS_deployment_target: '17'
watchOS_deployment_target: '10'
custom_rules:
no_nsrect:
regex: '\bNSRect\b'
Expand All @@ -206,7 +219,7 @@ custom_rules:
message: 'Use Double instead of CGFloat'
swiftui_state_private:
regex: '@(ObservedObject|EnvironmentObject)\s+var'
message: 'SwiftUI @ObservedObject/@EnvironmentObject properties should be private'
message: 'SwiftUI @ObservedObject and @EnvironmentObject properties should be private'
swiftui_environment_private:
regex: '@Environment\(\\\.\w+\)\s+var'
message: 'SwiftUI @Environment properties should be private'
Expand Down
34 changes: 18 additions & 16 deletions Blear.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
E304D608268502480035185A /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = E304D607268502480035185A /* Defaults */; };
E33A6D501B2272B700CBEDC9 /* UIImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = E33A6D4F1B2272B700CBEDC9 /* UIImageEffects.m */; };
E3430F431B27AD5800AF3F80 /* Bundled Photos in Resources */ = {isa = PBXBuildFile; fileRef = E3430F421B27AD5800AF3F80 /* Bundled Photos */; };
E350AF852C1CAC6F00AC72A0 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = E350AF842C1CAC6F00AC72A0 /* Sentry */; };
E350AF872C1CAC7900AC72A0 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = E350AF862C1CAC7900AC72A0 /* Sentry */; };
E35850582541D24200F9D5BD /* EditorScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35850572541D24200F9D5BD /* EditorScreen.swift */; };
E37CDDE426F1FA7A00130AD3 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = E37CDDE326F1FA7A00130AD3 /* Defaults */; };
E37D72AE2329664C008B1C48 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E37D72AD2329664B008B1C48 /* Constants.swift */; };
E38674432C165C550089CD67 /* Sentry-Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = E38674422C165C550089CD67 /* Sentry-Dynamic */; };
E38674452C165C5D0089CD67 /* Sentry-Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = E38674442C165C5D0089CD67 /* Sentry-Dynamic */; };
E3A0365A17E5E7AE00892B76 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3A0365917E5E7AE00892B76 /* App.swift */; };
E3A0368F17E6214600892B76 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3A0368E17E6214500892B76 /* Utilities.swift */; };
E3C77408255D7FF900A492FC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3C77407255D7FF900A492FC /* Assets.xcassets */; };
Expand Down Expand Up @@ -80,7 +80,7 @@
buildActionMask = 2147483647;
files = (
E304D608268502480035185A /* Defaults in Frameworks */,
E38674432C165C550089CD67 /* Sentry-Dynamic in Frameworks */,
E350AF852C1CAC6F00AC72A0 /* Sentry in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -89,7 +89,7 @@
buildActionMask = 2147483647;
files = (
E37CDDE426F1FA7A00130AD3 /* Defaults in Frameworks */,
E38674452C165C5D0089CD67 /* Sentry-Dynamic in Frameworks */,
E350AF872C1CAC7900AC72A0 /* Sentry in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -197,7 +197,7 @@
name = Blear;
packageProductDependencies = (
E304D607268502480035185A /* Defaults */,
E38674422C165C550089CD67 /* Sentry-Dynamic */,
E350AF842C1CAC6F00AC72A0 /* Sentry */,
);
productName = blurr;
productReference = E3A0364617E5E7AE00892B76 /* Blear.app */;
Expand All @@ -218,7 +218,7 @@
name = "Action Extension";
packageProductDependencies = (
E37CDDE326F1FA7A00130AD3 /* Defaults */,
E38674442C165C5D0089CD67 /* Sentry-Dynamic */,
E350AF862C1CAC7900AC72A0 /* Sentry */,
);
productName = "Action Extension";
productReference = E3DFE299254390AB00B3F299 /* Action Extension.appex */;
Expand Down Expand Up @@ -395,7 +395,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -447,7 +447,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.5;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
Expand Down Expand Up @@ -558,6 +558,7 @@
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG APP_EXTENSION";
SWIFT_OBJC_BRIDGING_HEADER = "Blear/Blear-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -598,6 +599,7 @@
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = APP_EXTENSION;
SWIFT_OBJC_BRIDGING_HEADER = "Blear/Blear-Bridging-Header.h";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -661,20 +663,20 @@
package = E304D606268502480035185A /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
E37CDDE326F1FA7A00130AD3 /* Defaults */ = {
E350AF842C1CAC6F00AC72A0 /* Sentry */ = {
isa = XCSwiftPackageProductDependency;
package = E304D606268502480035185A /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
package = E31C26B1282D301B0047A564 /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = Sentry;
};
E38674422C165C550089CD67 /* Sentry-Dynamic */ = {
E350AF862C1CAC7900AC72A0 /* Sentry */ = {
isa = XCSwiftPackageProductDependency;
package = E31C26B1282D301B0047A564 /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = "Sentry-Dynamic";
productName = Sentry;
};
E38674442C165C5D0089CD67 /* Sentry-Dynamic */ = {
E37CDDE326F1FA7A00130AD3 /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = E31C26B1282D301B0047A564 /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = "Sentry-Dynamic";
package = E304D606268502480035185A /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
/* End XCSwiftPackageProductDependency section */
};
Expand Down
19 changes: 7 additions & 12 deletions Blear/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,11 @@ extension View {
isPresented: Binding<Bool>,
@ViewBuilder actions: () -> some View
) -> some View {
// swiftlint:disable:next trailing_closure
alert2(
title,
isPresented: isPresented,
actions: actions,
message: {
message: { // swiftlint:disable:this trailing_closure
if let message {
Text(message)
}
Expand All @@ -575,12 +574,11 @@ extension View {
isPresented: Binding<Bool>,
@ViewBuilder actions: () -> some View
) -> some View {
// swiftlint:disable:next trailing_closure
alert2(
title,
isPresented: isPresented,
actions: actions,
message: {
message: { // swiftlint:disable:this trailing_closure
if let message {
Text(message)
}
Expand All @@ -596,12 +594,11 @@ extension View {
message: String? = nil,
isPresented: Binding<Bool>
) -> some View {
// swiftlint:disable:next trailing_closure
alert2(
title,
message: message,
isPresented: isPresented,
actions: {}
actions: {} // swiftlint:disable:this trailing_closure
)
}

Expand All @@ -614,12 +611,11 @@ extension View {
message: String? = nil,
isPresented: Binding<Bool>
) -> some View {
// swiftlint:disable:next trailing_closure
alert2(
title,
message: message,
isPresented: isPresented,
actions: {}
actions: {} // swiftlint:disable:this trailing_closure
)
}
}
Expand Down Expand Up @@ -662,7 +658,7 @@ extension View {
title: { title($0) },
presenting: data,
actions: actions,
message: {
message: { // swiftlint:disable:this trailing_closure
if let message = message?($0) {
Text(message)
}
Expand Down Expand Up @@ -697,12 +693,11 @@ extension View {
message: ((T) -> String?)? = nil,
presenting data: Binding<T?>
) -> some View {
// swiftlint:disable:next trailing_closure
alert2(
title: title,
message: message,
presenting: data,
actions: { _ in }
actions: { _ in } // swiftlint:disable:this trailing_closure
)
}

Expand Down Expand Up @@ -1259,7 +1254,7 @@ Store a value persistently in a `View` like with `@State`, but without updating
You can use it for storing both value and reference types.
*/
@MainActor
//@MainActor // TODO: Enable when on Xcode 16.
@propertyWrapper
struct ViewStorage<Value>: DynamicProperty {
private final class ValueBox {
Expand Down

0 comments on commit f1271fb

Please sign in to comment.