Skip to content
Recent Menu preview
Rendered from the SwiftUI source on this page.

Recent Menu

From syxUI — written for both platforms, not translated between them.

A recently-used items menu.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

MenuRecent.swift
// Recent Menu · syxUI · https://syxui.dev/components/menu-recent
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let mnBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

func menuCard<C: View>(_ w: CGFloat, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.06), radius: 14, y: 5)
}

struct MenuRecent: View { var body: some View { menuCard(250) { VStack(spacing: 0) { HStack { Text("Recent").font(.system(size: 13, weight: .semibold)).foregroundStyle(.secondary); Spacer() }.padding(.horizontal, 14).padding(.top, 10).padding(.bottom, 4); ForEach(Array([("Q3 Report.pdf", "doc.fill"), ("Design Specs", "doc.text"), ("Budget.xlsx", "tablecells")].enumerated()), id: \.offset) { i, r in HStack(spacing: 10) { Image(systemName: r.1).font(.system(size: 14)).foregroundStyle(mnBlue); Text(r.0).font(.system(size: 14)); Spacer(); Image(systemName: "clock").font(.system(size: 12)).foregroundStyle(.secondary) }.padding(.horizontal, 14).padding(.vertical, 10); if i < 2 { Divider() } } } } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17