import SwiftUI struct BackIcon: View { var color: Color var size: CGFloat = 16 var body: some View { Canvas { ctx, sz in var p = Path() p.move(to: CGPoint(x: sz.width * 0.68, y: sz.height * 0.18)) p.addLine(to: CGPoint(x: sz.width * 0.28, y: sz.height * 0.5)) p.addLine(to: CGPoint(x: sz.width * 0.68, y: sz.height * 0.82)) ctx.stroke(p, with: .color(color), style: StrokeStyle(lineWidth: min(sz.width, sz.height) * 0.16, lineCap: .round, lineJoin: .round)) } .frame(width: size, height: size) } } struct SearchIcon: View { var color: Color var size: CGFloat = 18 var body: some View { Canvas { ctx, sz in let r = min(sz.width, sz.height) * 0.28 let c = CGPoint(x: sz.width * 0.42, y: sz.height * 0.42) ctx.stroke(Path(ellipseIn: CGRect(x: c.x - r, y: c.y - r, width: r * 2, height: r * 2)), with: .color(color), lineWidth: min(sz.width, sz.height) * 0.12) var handle = Path() handle.move(to: CGPoint(x: sz.width * 0.62, y: sz.height * 0.62)) handle.addLine(to: CGPoint(x: sz.width * 0.82, y: sz.height * 0.82)) ctx.stroke(handle, with: .color(color), style: StrokeStyle(lineWidth: min(sz.width, sz.height) * 0.12, lineCap: .round)) } .frame(width: size, height: size) } } struct StatsIcon: View { var color: Color var size: CGFloat = 18 var body: some View { Canvas { ctx, sz in let w = min(sz.width, sz.height) * 0.16 let bars: [(CGFloat, CGFloat, CGFloat)] = [ (0.18, 0.48, 0.36), (0.42, 0.22, 0.62), (0.66, 0.36, 0.48), ] for b in bars { let rect = CGRect(x: sz.width * b.0, y: sz.height * b.1, width: w, height: sz.height * b.2) ctx.fill(Path(roundedRect: rect, cornerRadius: w), with: .color(color)) } } .frame(width: size, height: size) } } struct SettingsIcon: View { var color: Color var size: CGFloat = 18 var body: some View { Canvas { ctx, sz in let cx = sz.width / 2 let cy = sz.height / 2 let s = min(sz.width, sz.height) let rOuter = s * 0.48 let rInner = s * 0.34 let rHole = s * 0.16 let teeth = 8 let toothHalf = CGFloat.pi / CGFloat(teeth) var gear = Path() for i in 0.. some View { switch name { case "globe": GlobeIcon(color: color) case "people": PeopleIcon(color: color) case "bulb": BulbIcon(color: color) case "quiz": QuizIcon(color: color) case "order": OrderIcon(color: color) default: BookIcon(color: color) } }