Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat: add ModePillToggle component with animated pill segmented control

libokaif854bf9e060e
diff --git a/Codync-iOS/Views/Components/ModePillToggle.swift b/Codync-iOS/Views/Components/ModePillToggle.swift
new file mode 100644
index 00000000..f15640b1
--- /dev/null
+++ b/Codync-iOS/Views/Components/ModePillToggle.swift
@@ -0,0 +1,81 @@
+import SwiftUI
+import CodyncShared
+
+struct ModePillToggle: View {
+ @Binding var mode: LiveActivityMode
+ @Environment(\.theme) private var theme
+
+ var body: some View {
+ HStack(spacing: 0) {
+ pillSegment(
+ mode: .overall,
+ icon: overallIcon,
+ label: "Overall"
+ )
+ pillSegment(
+ mode: .individual,
+ icon: individualIcon,
+ label: "Individual"
+ )
+ }
+ .padding(3)
+ .background(
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
+ .fill(theme.primaryText.opacity(0.06))
+ )
+ }
+
+ @ViewBuilder
+ private func pillSegment(mode segmentMode: LiveActivityMode, icon: some View, label: String) -> some View {
+ let isSelected = mode == segmentMode
+
+ Button {
+ withAnimation(.spring(duration: 0.35, bounce: 0.15)) {
+ mode = segmentMode
+ }
+ } label: {
+ HStack(spacing: 6) {
+ icon
+ Text(label)
+ .font(.system(size: 14, weight: isSelected ? .semibold : .regular))
+ }
+ .foregroundStyle(isSelected ? theme.primaryText : theme.tertiaryText)
+ .padding(.vertical, 10)
+ .frame(maxWidth: .infinity)
+ .background(
+ RoundedRectangle(cornerRadius: 10, style: .continuous)
+ .fill(isSelected ? theme.primaryText.opacity(0.1) : .clear)
+ )
+ }
+ .buttonStyle(.plain)
+ }
+
+ // 3-dot grid for Overall
+ private var overallIcon: some View {
+ Canvas { context, size in
+ let fg = theme.primaryText
+ let dotSize: CGFloat = 3.5
+ let gap: CGFloat = 1.5
+ let positions: [(CGFloat, CGFloat, Double)] = [
+ (0, 0, 0.8), (dotSize + gap, 0, 0.5),
+ (0, dotSize + gap, 0.3), (dotSize + gap, dotSize + gap, 0.15),
+ ]
+ for (x, y, opacity) in positions {
+ let rect = CGRect(x: x + 1, y: y + 1, width: dotSize, height: dotSize)
+ context.opacity = mode == .overall ? opacity : opacity * 0.5
+ context.fill(
+ RoundedRectangle(cornerRadius: 1).path(in: rect),
+ with: .color(fg)
+ )
+ }
+ }
+ .frame(width: 12, height: 12)
+ }
+
+ // Single rect for Individual
+ private var individualIcon: some View {
+ RoundedRectangle(cornerRadius: 2.5, style: .continuous)
+ .stroke(mode == .individual ? theme.primaryText : theme.tertiaryText, lineWidth: 1.5)
+ .frame(width: 10, height: 10)
+ }
+}
diff --git a/Codync.xcodeproj/project.pbxproj b/Codync.xcodeproj/project.pbxproj
index 0ae4a824..eff4f889 100644
--- a/Codync.xcodeproj/project.pbxproj
+++ b/Codync.xcodeproj/project.pbxproj
@@ -52,6 +52,7 @@
F5A6B7C8D9E0F1A2B3C4D5E6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5A6B7C8D9E0F1A2B3C4D5E7 /* AppDelegate.swift */; };
FF66001122334455667788BB /* NSScreen+Notch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC33DD44EE55FF6600112233 /* NSScreen+Notch.swift */; };
PANEL001122334455667788 /* PanelHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = PANEL002233445566778899 /* PanelHeaderView.swift */; };
+ F7407323258F4D54ABC49AA7 /* ModePillToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D38EB22B9A74DB4A5A84274 /* ModePillToggle.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -80,6 +81,7 @@
/* Begin PBXFileReference section */
05154CFD496486BA9E126E9D /* JSONLTailReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONLTailReader.swift; sourceTree = "<group>"; };
+ 9D38EB22B9A74DB4A5A84274 /* ModePillToggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModePillToggle.swift; sourceTree = "<group>"; };
0D161FDC49BE96E3A73FEA33 /* PIDChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIDChecker.swift; sourceTree = "<group>"; };
22479FA0953120F3B50A1AF3 /* CloudKitSync.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudKitSync.swift; sourceTree = "<group>"; };
3935CEE144EC8AFCA3AEAEA3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -192,6 +194,7 @@
32B90F722211C6377233886C /* Views */ = {
isa = PBXGroup;
children = (
+ 1A0CEB1937DE4129AB71C6FC /* Components */,
A7B8C9D0E1F2A3B4C5D6E7F8 /* ComingSoonView.swift */,
D866EFD6224AECD6846B76BE /* IOSOnboardingView.swift */,
DF291DF4A4EF932B774F227D /* IOSRootView.swift */,
@@ -205,6 +208,14 @@
path = Views;
sourceTree = "<group>";
};
+ 1A0CEB1937DE4129AB71C6FC /* Components */ = {
+ isa = PBXGroup;
+ children = (
+ 9D38EB22B9A74DB4A5A84274 /* ModePillToggle.swift */,
+ );
+ path = Components;
+ sourceTree = "<group>";
+ };
38DD3C2C943D4DCC5208E8BB /* Codync-macOS */ = {
isa = PBXGroup;
children = (
@@ -480,6 +491,7 @@
B1C2D3E4F5A6B7C8D9E0F1A1 /* IOSTheme.swift in Sources */,
B1C2D3E4F5A6B7C8D9E0F1A2 /* IOSStatusIndicator.swift in Sources */,
B1C2D3E4F5A6B7C8D9E0F1A3 /* IOSSessionTagView.swift in Sources */,
+ F7407323258F4D54ABC49AA7 /* ModePillToggle.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};