← Back to Projects

MacOS Image Viewer

A native macOS application for browsing, viewing, and organizing your image collection

Overview

MacOS Image Viewer is a native SwiftUI application designed for macOS that provides a powerful and intuitive way to browse, view, and organize image collections. Built entirely with Swift and SwiftUI, it offers a modern, native macOS experience with features like folder browsing, tag-based organization and fullscreen viewing.

Key Features

📁 Folder Browsing

Browse image folders with a hierarchical tree view. Navigate through nested directories and quickly access your images.

🏷️ Tag System

Organize images with custom tags. Tags are stored in hidden .tag files next to each image, keeping metadata close to your files.

🔍 Tag-Based Search

Filter images by tags with an intuitive search interface. Autocomplete suggestions help you find and apply tags quickly.

🖼️ Image Viewing

View images with smooth zoom controls (0.5x to 5x magnification). Supports scrolling for large images that exceed the viewport.

🖥️ Fullscreen Mode

Immerse yourself in your images with fullscreen viewing mode. Toggle with keyboard shortcut (F key).

⌨️ Keyboard Shortcuts

Efficient navigation with keyboard shortcuts: F for fullscreen, T for tags, O for open folder, Escape to quit.

💡 Smart Suggestions

Tag autocomplete provides suggestions based on existing tags, making organization faster and more consistent.

Technology Stack

Swift SwiftUI AppKit Core Data Xcode macOS

Architecture & Design

The application follows a modern SwiftUI architecture with clear separation of concerns:

Model Layer

The ImageItem struct represents individual images with their file URLs and associated tags. Tags are stored as a Set of strings, normalized to lowercase for consistent searching. Each image item is identifiable by its file URL.

ViewModel Layer

The ImageLibraryViewModel manages the application state, including:

View Layer

The application uses SwiftUI views organized into:

Tag Storage System

One of the unique features of this application is its file-system-based tag storage. Tags are stored in hidden text files (prefixed with a dot) next to each image. The tag file format is:

# image tags for <filename> created by ImageViewer v. 1.0 tag1,tag2,tag3

This approach has several advantages:

The application also maintains a global tag list in Application Support for quick autocomplete and suggestions across all images.

User Interface

The interface is organized into three main areas:

Left Panel - Image List

A hierarchical tree view showing folders and images. Folders can be expanded and collapsed. Images are displayed with their filenames. Selection in this panel updates the detail view.

Right Panel - Detail View

Split into two sections:

Bottom Panel - Search Results

When tags are applied in the search, matching images are displayed here with thumbnails and their associated tags. Clicking a result selects that image in the main view.

Keyboard Shortcuts

The application supports several keyboard shortcuts for efficient navigation:

Supported Image Formats

The application supports the following image formats:

Performance Features

Project Structure

The project follows a clean architecture with organized directories:

Technical Highlights

Custom Split View Implementation

The application uses custom NSSplitView implementations (CustomVSplitView and CustomHSplitView) to provide precise control over split positions, user adjustments, and programmatic resizing. These components handle state management carefully to avoid SwiftUI state modification warnings.

Animated GIF Support

GIF animation is handled through NSImageView with animation enabled. The AnimatedGIFView component wraps NSImageView in a SwiftUI-compatible view, allowing GIFs to play smoothly while maintaining zoom functionality.

Tag Persistence

Tags are persisted asynchronously to avoid blocking the UI. The system checks for write permissions and provides helpful error messages if tags cannot be saved. Tag files are created with a specific header format for validation.

Development & Building

The application is built using Xcode and requires:

To build and run:

1. Open ImageView.xcodeproj in Xcode 2. Select a target (macOS) 3. Build and run (Cmd+R) 4. Use "Open Folder…" to select a folder with images

Version Information

Current version: 1.0.0

Author: Thomas Byrdal

Built with Swift & SwiftUI • Native macOS Experience • Fast & Efficient