Skip to content

tqtuan1201/TTBaseUIKit

Repository files navigation

TTBaseUIKit Banner

TTBaseUIKit

Build iOS Apps Faster — 100+ Production-Ready Base Views for UIKit & SwiftUI

Version Swift iOS License CocoaPods SPM

📖 Documentation🚀 Getting Started🎯 Best Practice🛠 TTBDebugPlus📱 Showcase📝 Blog


Overview

TTBaseUIKit is an enterprise-grade iOS framework that eliminates boilerplate and accelerates development by providing 100+ production-ready base views for both UIKit (programmatic) and SwiftUI (declarative). Ship production UI in hours, not days.

TTBaseUIKit Demo

Key Numbers

Metric Count
UIKit Components 72+
SwiftUI Views 51+
AI Agent Skills 17
Production Apps Shipped 36+
Users Reached 5M+

Features

🧱 UIKit Foundation

Production-ready programmatic views with zero Storyboard/XIB dependency:

  • TTBaseUIViewController, TTBaseUITableViewController, TTBaseUICollectionViewController
  • TTBaseUIView, TTBaseUILabel, TTBaseUIButton, TTBaseUITextField, TTBaseUITextView
  • TTBaseUIImageView, TTBaseUIStackView, TTBaseUIScrollView
  • ViewCodable protocol — structured lifecycle: setupData → makeUI → makeConstraints → bindViewModel
  • Popup, Notification, Skeleton Loading, Segmented Control, PIN Input, and more
  • Programmatic Auto Layout helpers — chainable, clean constraint syntax

🎨 SwiftUI Modernity (v2.3.0+)

Full SwiftUI support targeting iOS 14+:

  • BaseSUIView, BaseSUIText, BaseSUIButton, BaseSUIImage
  • BaseSUIList, BaseSUIGroup, BaseSUITabView, BaseSUINavLink
  • BaseSUISlider, BaseSUIToggle, BaseSUITextField, BaseSUIProgress
  • View modifiers: ttFont(), ttShadow(), ttPadding()
  • Built-in Shimmer / Skeleton loading animations

🛠 Built-in UI Debug Kit (v2.2.1+)

Activate with a single line — no additional dependencies:

  • Triple-tap Layout Inspector — visualize constraints and view hierarchy
  • API Response Log Viewer — inspect request/response data in-app
  • Screen Capture — annotate screenshots and share with team
  • Developer Settings Panel — toggle environments, feature flags
LogViewHelper.share.config(
    withDes: "Debug Panel",
    isStartAppToShow: false,
    passCode: ""
).onShow()
// Long-press any screen to open | Triple-tap to inspect layout

UI Debug Kit

🖥 TTBDebugPlus — macOS Companion Debugger

A professional-grade native macOS app for debugging iOS applications in real-time. Built entirely with SwiftUI.

⚠️ Requires TTBaseUIKit v2.3.0 or later. The DebugBridge SDK is included from version 2.3.0+.

Feature Description
📋 Live Console Real-time log streaming with level filtering & JSON inspector
🌐 Network Inspector Full HTTP inspection, JSON Tree Viewer, cURL & Postman export
📱 Device Control Remote screenshot, dark mode toggle, app lifecycle management
📊 Performance Monitor CPU, Memory, FPS charts, bandwidth monitoring, API analytics
💬 Feedback Reporter Structured bug reports with annotated screenshots
📤 Export & Share Postman Collection v2.1, cURL, session files (.ttbdebug)

Architecture: iOS ↔ Bonjour (mDNS) ↔ WebSocket ↔ macOS — zero configuration, auto-discovery.

🚀 iOS SDK Integration Guide
TTBDebugPlus Integration Guide
📱 Device Control & Screenshot
TTBDebugPlus Device Control
✏️ Screenshot Annotation
TTBDebugPlus Annotation
🛠 Dev Tools — JSON Editor
TTBDebugPlus Dev Tools

📥 Download TTBDebugPlus for macOS (.dmg • 5.8 MB • macOS 14+ • Universal)

📖 Full documentation & SDK integration guide →

🤖 AI Agent Ready

Pre-configured for modern AI coding assistants:

  • GitHub Copilot — custom instructions & workspace prompts
  • Claude Code — CLAUDE.md with project context
  • Xcode Agent Skills — 17 custom agent skills
  • Google Gemini — GEMINI.md configuration
  • OpenAI Codex — codex.md setup

📖 Explore AI Agent Skills →

🎨 Configurable Design System

Control every aspect of your app's appearance globally:

let view = ViewConfig()
view.viewBgNavColor = .systemBlue
view.buttonBgDef    = .systemBlue
view.viewBgColor    = .white

let size = SizeConfig()
size.H_BUTTON = 44.0
size.H_SEG    = 50.0

let font = FontConfig()
font.HEADER_H       = 16
font.TITLE_H        = 14
font.SUB_TITLE_H    = 12

TTBaseUIKitConfig.withDefaultConfig(
    withFontConfig: font,
    frameSize: size,
    view: view
)?.start(withViewLog: true)
Config Purpose Reference
ViewConfig Colors for buttons, labels, backgrounds, navigation Global theme
SizeConfig Heights, corner radius, icon sizes, spacing Layout system
FontConfig Typography scale: header, title, subtitle, body Type system

Installation

Swift Package Manager (Recommended)

Via Xcode:

  1. File → Add Package Dependencies...
  2. Enter URL: https://github.com/tqtuan1201/TTBaseUIKit.git
  3. Select "Up to Next Major" from 2.3.0

Via Package.swift:

dependencies: [
    .package(url: "https://github.com/tqtuan1201/TTBaseUIKit.git", from: "2.3.0")
]

CocoaPods

pod 'TTBaseUIKit'

Carthage

github "tqtuan1201/TTBaseUIKit"

Manual

  1. Clone or download the repository
  2. Add TTBaseUIKit.xcodeproj to your project
  3. Add TTBaseUIKit.framework as an embedded binary (General tab) and target dependency (Build Phases tab)

Quick Start

import UIKit
import TTBaseUIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {

        // 1. Configure design system
        let view = ViewConfig()
        let size = SizeConfig()
        let font = FontConfig()
        
        TTBaseUIKitConfig.withDefaultConfig(
            withFontConfig: font,
            frameSize: size,
            view: view
        )?.start(withViewLog: true)

        // 2. (Optional) Enable debug bridge for TTBDebugPlus macOS
        #if DEBUG
        TTDebugBridge.shared.start()
        LogInterceptor.shared.install()
        #endif

        // 3. Set root view controller
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.rootViewController = UINavigationController(
            rootViewController: HomeViewController()
        )
        window?.makeKeyAndVisible()
        
        return true
    }
}

Usage Examples

UIKit — Custom ViewController

import TTBaseUIKit

class HomeViewController: TTBaseUIViewController<TTBaseUIView> {

    let titleLabel = TTBaseUILabel()
    let actionButton = TTBaseUIButton()

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

extension HomeViewController: TTViewCodable {

    func setupStyles() {
        titleLabel.setText(text: "Welcome")
        actionButton.setText(text: "Get Started")
    }

    func setupCustomView() {
        view.addSubview(titleLabel)
        view.addSubview(actionButton)
    }

    func setupConstraints() {
        titleLabel.setTopAnchor(constant: 20)
        titleLabel.setCenterXAnchor(constant: 0)
        actionButton.setTopAnchor(titleLabel, constant: 16)
        actionButton.setCenterXAnchor(constant: 0)
    }
}

SwiftUI — Declarative View

import TTBaseUIKit

struct HomeView: BaseSUIView {
    var body: some View {
        VStack(spacing: 16) {
            BaseSUIText("Welcome to TTBaseUIKit")
                .ttFont(type: .HEADER_H)
                .foregroundColor(.primary)

            BaseSUIButton(title: "Get Started") {
                // action
            }
            .ttButtonStyle(.filled)

            BaseSUIList(items: viewModel.items) { item in
                ItemRowView(item: item)
            }
        }
        .baseSUIPadding()
    }
}

Auto Layout Helpers

// Chainable programmatic constraints
myView.setTopAnchor(constant: 16)
myView.setLeadingAnchor(constant: 20)
myView.setTrailingAnchor(constant: 20)
myView.setBottomAnchor(constant: 16)
myView.setCenterXAnchor(constant: 0)
myView.setcenterYAnchor(constant: 0)

UI Components

// Notification banner
let noti = TTBaseNotificationViewConfig(with: window)
noti.setText(with: "Success!", subTitle: "Operation completed")
noti.notifiType = .SUCCESS
noti.onShow()

// Popup dialog
let popup = TTPopupViewController(
    title: "Confirm",
    subTitle: "Are you sure?",
    isAllowTouchPanel: true
)
present(popup, animated: true)

// Empty state for table view
tableView.setStaticBgNoData(
    title: "No Data",
    des: "Nothing to show yet"
) {
    print("Retry tapped")
}

Project Structure

TTBaseUIKit/
├── Sources/TTBaseUIKit/
│   ├── BaseConfig/          # ViewConfig, SizeConfig, FontConfig
│   ├── Coordinators/        # Navigation coordination
│   ├── CustomView/          # 72+ UIKit base views
│   │   ├── BaseUIView/
│   │   ├── BaseUILabel/
│   │   ├── BaseUIButton/
│   │   ├── BaseUITextField/
│   │   ├── BaseUITableView/
│   │   ├── BaseUICollectionView/
│   │   ├── ViewCodable/
│   │   └── ...
│   ├── SwiftUIView/         # 51+ SwiftUI views
│   │   ├── BaseSUIView/
│   │   ├── BaseSUIText/
│   │   ├── BaseSUIButton/
│   │   └── ...
│   ├── Extensions/          # String, Date, JSON, Device utilities
│   └── Support/
│       ├── DebugBridge/     # TTBDebugPlus iOS SDK
│       └── Resources/      # Fonts, Images
├── TTBaseUIKitExample/      # Official sample project
├── TTBDebugPlus/            # macOS companion app (Xcode project)
├── Agents/                  # AI agent configurations
├── docs/                    # Documentation website
├── Package.swift
├── TTBaseUIKit.podspec
└── LICENSE

🎯 Best Practice — Run First, Read Code Later

The fastest way to learn TTBaseUIKit: Clone the example project, run it first, explore all features in action — then study the code. Developers who run examples first learn frameworks 10x faster.

📖 Full Best Practice Guide →

Quick Start (60 seconds)

git clone https://github.com/tqtuan1201/TTBaseUIKit.git
open TTBaseUIKit.xcodeproj
# Select TTBaseUIKitExample target → Run (⌘R)

What's Inside TTBaseUIKitExample

The TTBaseUIKitExample is a full-featured sample app with 5 tabs:

Tab Description Tech
📋 Menu Framework overview, theme config, base components showcase UIKit
Demos 7 real-world demos — Recipe Book, Product Catalog, User Directory, Social Feed, Quotes Wall, Todo Manager, Photo Gallery SwiftUI + API
🔗 DebugBridge TTBDebugPlus macOS companion — real-time logs, network inspector, remote screenshots v2.3.0+
🔍 UI Debug Built-in TTBaseDebugKit — layout inspector, API logger, screen capture v2.2.1+
👤 Contact Author info and portfolio links UIKit

Example Screenshots

📋 Menu
Menu Tab
✨ Demos
Demos Tab
🔗 DebugBridge
DebugBridge Tab
🔍 UI Debug
UI Debug Tab

Code Architecture

The example follows a clean architecture pattern:

AppDelegate (Config) → AppCoordinator (TabBar) → ViewControllers (ViewCodable)
  • AppDelegate — Configure ViewConfig, SizeConfig, FontConfig, StyleConfig, ParamConfig + start TTDebugBridge
  • AppCoordinator — Setup UITabBarController with 5 tabs using Coordinator pattern
  • ViewControllers — Implement ViewCodable protocol: setupData → makeUI → makeConstraints → bindViewModel

UIKit Demo Categories

The Menu tab includes 11 UIKit demo categories:

Demo What It Shows
Auto Layout Programmatic constraints with chainable helpers
Calendar Custom calendar view implementation
Cell Types Table/Collection cell patterns
CollectionView BaseUICollectionViewController demos
Components Buttons, labels, text fields, images
Empty Table Empty state + retry pattern
Message Notification banners & alerts
Popup Modal dialogs & bottom sheets
Skeleton Loading placeholder animations
TableView BaseUITableViewController patterns
ViewController ViewCodable lifecycle demos

Apps Built with TTBaseUIKit

12Bay iOS
✈️ Travel • #20 App Store VN
UIKit + SwiftUI • MVVM/VIPER
Aihealth - Truedoc
🏥 Healthcare • Pre-Series A
UIKit • AI Diagnostics
TMS Mobile
🚛 Logistics
UIKit • Real-time GPS
WECARE 247
🫶 Care Management
UIKit + SwiftUI
12Bay macOS
🖥️ Mac Catalyst
Shared codebase with iOS
AiDoctor
⚕️ Telemedicine
UIKit • Video Consult
AiPharmacy
💊 Pharmacy
UIKit • Order Management
Contacts Plus
👤 Productivity
UIKit • App Store

36+ production apps shipped across Travel, Healthcare, Logistics, Education, and more. See full showcase → Apps Showcase

Documentation

Resource Link
📖 Full Documentation tqtuan1201.github.io/public/docs/ttbaseuikit
🚀 Getting Started Installation & Setup Guide
🧱 UIKit Components 72+ Component Docs
🎨 SwiftUI Views 51+ View Docs
🛠 TTBDebugPlus macOS Debugger & SDK Guide
🤖 AI Agent Skills 17 Agent Configurations
🎯 Best Practice Run First, Read Code Later
🎬 Project Demo TTBaseUIKitExample Demo
📱 Apps Showcase 36+ Production Apps
📝 Author's Blog Technical Articles

Requirements

Requirement Minimum
iOS 14.0+
macOS (Catalyst) 10.15+
Swift 5.0+
Xcode 13.0+
TTBDebugPlus (macOS) macOS 14+

Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

If you find TTBaseUIKit useful, please consider giving it a ⭐ — it helps others discover the project.

Author

Truong Quang Tuan — Mobile Lead & Framework Author

We build high-quality apps. Get in touch if you need help with a project.

License

TTBaseUIKit is available under the MIT License. See the LICENSE file for details.

MIT License — Copyright (c) 2019 Quang Tuan

Packages

 
 
 

Contributors

Languages