A comprehensive, production-ready Swift package that provides a unified, highly configurable table view cell system for iOS apps. MetaCellKit replaces multiple specialized cell classes with a single, parametric solution that supports 0-3 configurable metadata views with automatic date formatting.
MetaCellKit was born from real-world necessity. Originally developed and extensively refined within addTaskManager, a productivity app based on the Assess - Decide - Do framework, where it powers thousands of task list interactions daily. Through continuous use and iteration in a production environment, MetaCellKit evolved from a simple cell component into a robust, feature-complete solution. The decision to extract and open-source MetaCellKit came from recognizing that many iOS developers face the same challenge: managing multiple specialized table view cells across their apps. What started as an internal solution has now become a universal tool for the iOS development community.
Showing MetaCellKit's flexible configurations, smooth animations, and master / details layouts in action.
From left to right: Master style in the Assess view, Detail style with 2 metadata views, Detail style with 3 metadata views, and Project view layout demonstrating MetaCellKit's versatility across different content types.
- Single parametric cell class that replaces multiple specialized cells
- Card-based design with master/detail style variants
- Consistent rounded styling with shadows and borders
- Dynamic layout system that adapts to content
- Master Style: Subtle styling for list controllers
- Detail Style: Enhanced paper-like styling for detail views
- Parametrizable colors for metadata views
- Smooth selection/highlight animations
- Dynamic badges with auto-sizing for numbers/text
- SF Symbols support with tinting
- UILabel/UITextView switching for title content
- 0-3 configurable metadata views with custom colors and icons
- Generic protocol works with any data model
- Automatic date formatting with multiple styles
- Reflection-based binding for flexible content
- Type-agnostic metadata content support
Add MetaCellKit to your project using Swift Package Manager:
- In Xcode, go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/dragosroua/MetaCellKit
- Choose the version and add to your target
Or add it to your Package.swift
:
dependencies: [
.package(url: "https://github.com/dragosroua/MetaCellKit", from: "1.0.0")
]
import MetaCellKit
// In your table view cell configuration
let cell = tableView.dequeueReusableCell(withIdentifier: "MetaCellKit") as! MetaCellKit
// Simple configuration
let taskData = MetaCellKit.TaskData(
title: "Complete project proposal",
icon: UIImage(systemName: "doc.text"),
badge: "3",
dueDate: Date().addingTimeInterval(86400)
)
cell.configure(with: taskData, metadataViews: 2, style: .detail)
// Create custom configuration
var config = CellConfiguration()
config.metadataViewCount = 3
config.style = .detail
config.showBadge = true
// Define metadata views
let priorityMetadata = MetadataViewConfig(
icon: UIImage(systemName: "flag.fill"),
text: "High",
backgroundColor: .systemRed,
textColor: .white
)
let contextMetadata = MetadataViewConfig(
icon: UIImage(systemName: "at"),
text: "Work",
backgroundColor: .systemBlue,
textColor: .white
)
let statusMetadata = MetadataViewConfig(
icon: UIImage(systemName: "clock"),
text: "Due Soon",
backgroundColor: .systemOrange,
textColor: .white
)
config.metadataConfigs = [priorityMetadata, contextMetadata, statusMetadata]
// Apply configuration
cell.configure(with: taskData, configuration: config)
Icon + Title + Badge + Disclosure indicator
let config = MetaCellKit.basicConfiguration(style: .master)
cell.configure(with: data, configuration: config)
Basic layout + 1 configurable metadata view
cell.configure(with: data, metadataViews: 1, style: .detail)
Basic layout + 2 configurable metadata views
let config = MetaCellKit.dualMetadataConfiguration(style: .detail)
cell.configure(with: data, configuration: config)
Basic layout + 3 configurable metadata views
let config = MetaCellKit.tripleMetadataConfiguration(style: .master)
cell.configure(with: data, configuration: config)
- Subtle borders and system backgrounds
- Ideal for master list controllers
- Minimal spacing and gentle shadows
- Paper-like backgrounds with enhanced shadows
- Perfect for detail views and secondary lists
- Increased spacing and visual depth
MetaCellKit automatically detects Date
properties in your data models and formats them appropriately:
struct TaskData: CellDataProtocol {
let title: String
let dueDate: Date // Automatically formatted as "15 Jan 2024"
let createdDate: Date // Automatically formatted as "2h ago"
}
// Multiple date format styles available
let formatter = DateFormattingUtility.shared
formatter.formatDate(date, style: .short) // "15 Jan"
formatter.formatDate(date, style: .medium) // "15 Jan 2024"
formatter.formatDate(date, style: .relative) // "2h ago"
Implement the CellDataProtocol
for automatic data binding:
struct MyTaskData: CellDataProtocol {
let title: String // Automatically bound to title
let icon: UIImage? // Automatically bound to icon
let badge: String? // Automatically bound to badge
let dueDate: Date? // Automatically formatted and bound to metadata
let priority: String? // Bound to available metadata views
let context: String? // Bound to available metadata views
}
The main cell class that handles all layout variants and configurations.
Configuration struct that defines:
- Layout variant (0-3 metadata views)
- Style variant (master/detail)
- Visibility options (badge, disclosure)
- Metadata view configurations
Defines appearance of metadata views:
- Icon and text content
- Background and text colors
- Corner radius and font
Auto-sizing badge component with:
- Automatic width calculation
- Support for numbers and text
- Customizable colors and minimum size
Automatic date formatting with multiple styles:
- Short, medium, long formats
- Relative time formatting
- Consistent formatting across the app
// Register the cell
tableView.register(MetaCellKit.self, forCellReuseIdentifier: "MetaCellKit")
// In cellForRowAt
let cell = tableView.dequeueReusableCell(withIdentifier: "MetaCellKit", for: indexPath) as! MetaCellKit
let data = yourDataArray[indexPath.row]
cell.configure(with: data, metadataViews: 2, style: .detail)
return cell
// Enable automatic dimension for dynamic height
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 80
If you're currently using multiple specialized cell classes:
- Replace cell classes with
MetaCellKit
- Convert cell data to conform to
CellDataProtocol
- Create configurations that match your existing designs
- Update table view registration and dequeue calls
// Before: Multiple cell classes
class BasicTaskCell: UITableViewCell { ... }
class DetailTaskCell: UITableViewCell { ... }
class PriorityTaskCell: UITableViewCell { ... }
// After: Single MetaCellKit with configurations
let basicConfig = MetaCellKit.basicConfiguration()
let detailConfig = MetaCellKit.singleMetadataConfiguration(style: .detail)
let priorityConfig = MetaCellKit.dualMetadataConfiguration()
MetaCellKit is optimized for:
- Cell reuse: Efficient
prepareForReuse
implementation - Memory management: Minimal object allocation
- Layout performance: Constraint-based layout with caching
- Smooth scrolling: Optimized for large datasets
- iOS 13.0+
- Swift 5.7+
- Xcode 14.0+
Check out the included sample data and configurations:
// Use sample data for testing
let sampleTasks = MetaCellKitSampleData.sampleTasks()
let sampleConfigs = MetaCellKitSampleData.sampleConfigurations()
// Quick testing in your table view
cell.configure(with: sampleTasks[0], configuration: sampleConfigs[2])
MetaCellKit is available under the MIT license. See LICENSE for details.
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
- 📖 Documentation
- 🐛 Issues
- 💬 Discussions
MetaCellKit is actively used in production apps, powering thousands of user interactions daily:
- addTaskManager - A comprehensive task management app where MetaCellKit originated. Used throughout the app for task lists, project views, and settings screens, handling complex metadata display including priorities, due dates, contexts, and progress indicators.
Using MetaCellKit in your app? Let us know and we'll add it to this list!
MetaCellKit - One cell to rule them all. ✨