Skip to content

Commit

Permalink
Swiftlint rules, and some bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
superhighfives committed Nov 24, 2024
1 parent 3fb9a66 commit c36fb9d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disabled_rules: # rule identifiers turned on by default to exclude from running
- opening_brace
10 changes: 6 additions & 4 deletions Pika.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
EA0F36AE2929138E00BFC7EB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
EA0F36B02929139000BFC7EB /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Main.strings; sourceTree = "<group>"; };
EA136071284887E9004F1630 /* AppearanceButtonStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearanceButtonStyle.swift; sourceTree = "<group>"; };
EA16C6562CF3301500FBC93E /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
EA1D669E282EAE8700816F99 /* WindowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowManager.swift; sourceTree = "<group>"; };
EA257BD025D8629300C3FC54 /* SwapButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwapButtonStyle.swift; sourceTree = "<group>"; };
EA424C7C25CDEF98009056A9 /* ComplianceToggleGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComplianceToggleGroup.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -196,6 +197,7 @@
EAD0B6BF259CED1C00FA2F67 = {
isa = PBXGroup;
children = (
EA16C6562CF3301500FBC93E /* .swiftlint.yml */,
EAD0B705259CF3BA00FA2F67 /* LICENSE.md */,
EAD0B704259CF3BA00FA2F67 /* README.md */,
EAD0B6CA259CED1C00FA2F67 /* Pika */,
Expand Down Expand Up @@ -654,7 +656,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 41;
CURRENT_PROJECT_VERSION = 42;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pika/Preview Content\"";
DEVELOPMENT_TEAM = TGHU37N6EX;
Expand All @@ -668,7 +670,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = "0.0.18-beta2";
MARKETING_VERSION = "0.0.18-beta3";
PRODUCT_BUNDLE_IDENTIFIER = com.superhighfives.Pika;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -685,7 +687,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 41;
CURRENT_PROJECT_VERSION = 42;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pika/Preview Content\"";
DEVELOPMENT_TEAM = TGHU37N6EX;
Expand All @@ -699,7 +701,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = "0.0.18-beta2";
MARKETING_VERSION = "0.0.18-beta3";
PRODUCT_BUNDLE_IDENTIFIER = com.superhighfives.Pika;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
30 changes: 16 additions & 14 deletions Pika/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ struct ContentView: View {
VStack(alignment: .trailing, spacing: 0) {
Divider()
ColorPickers()
.onHover { hover in
guard hover else { return }
swapVisible = true
timerSubscription?.cancel()
timerSubscription = nil
}
.onReceive(timer) { _ in
swapVisible = false
timerSubscription?.cancel()
timerSubscription = nil
}
.overlay(
Button(action: {
NSApp.sendAction(#selector(AppDelegate.triggerSwap), to: nil, from: nil)
Expand All @@ -43,22 +54,13 @@ struct ContentView: View {
.frame(maxHeight: .infinity, alignment: .top)
)
.onHover { hover in
if hover {
swapVisible = true
timerSubscription?.cancel()
timerSubscription = nil
} else {
if timerSubscription == nil {
timer = Timer.publish(every: 0.25, on: .main, in: .common)
timerSubscription = timer.connect()
}
guard !hover, timerSubscription == nil else {
return
}
timer = Timer.publish(every: 0.25, on: .main, in: .common)
timerSubscription = timer.connect()
}
.onReceive(timer) { _ in
swapVisible = false
timerSubscription?.cancel()
timerSubscription = nil
}

Divider()
Footer(foreground: eyedroppers.foreground, background: eyedroppers.background)
}
Expand Down
3 changes: 2 additions & 1 deletion Pika/Views/KeyboardShortcutItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ struct KeyboardShortcutItem: View {

struct KeyboardShortcutItem_Previews: PreviewProvider {
static var previews: some View {
KeyboardShortcutItem(title: "Copy example but with a much longer text", event: PikaConstants.ncTriggerPickForeground, keys: ["A", "B"])
KeyboardShortcutItem(title: "Copy example but with a much longer text",
event: PikaConstants.ncTriggerPickForeground, keys: ["A", "B"])
.frame(width: 100.0, height: 100.0)
}
}

0 comments on commit c36fb9d

Please sign in to comment.