Base types for theming an app.

Overview

CostumeKit 🎩

Base types for theming an app.

CostumeKit is made of up a set of Swift protocols. They are meant to be implemented by you in your app.

Featured in Little Bites of Cocoa Bite #270: Implementing Theming with CostumeKit

Color 🎨

Includes Color and ColorPalette protocols.

Usage:

public enum MyAppColors : Color, ColorPalette {
  case white = "FFFFFF"
  case lightTeal = "3CB39E"
  case forestGreen = "216055"
  case black = "000000"
}

Font 🔠

Includes Font protocol, and one concrete SystemFont implementation for iOS system fonts.

Usage:

public struct MyAppFont : Font {
  public init(size: FontSize = .textStyle(.body)) {
    self.size = size
  }

  // Font

  public var size: FontSize

  // FontConvertible

  public var FontValue: UIFont {
    return UIFont(name: "SomeCustomFont", size: pointSize)!
  }
}

SVG 🌠

Includes SVG Protocol and SVGMetadata type.

Usage:

enum MyAppSVGs {
  case clockGlyph
  case bird
}

extension MyAppSVGs : SVG {
  public func metadata() -> SVGMetadata {
    switch self {
      case .clockGlyph: return SVGMetadata(name: "clock", size: CGSize(width: 100, height: 100), fullColor: false)
      case .bird: return SVGMetadata(name: "bird", size: CGSize(width: 58, height: 28), fullColor: true)
    }
  }
}

What you do with SVGMetadata is up to you. I recommend SwiftSVG from Michael Choe. Read more here to learn how to use it.

CostumeKit's goals are to be a generic solution, so no assumptions are made about how something should be retrieved from disk, parsed, etc. You'll need to implement these anyways, so nothing is forced on you.

Costume 🎩

Includes Costume protocol. Usage:

open class MyAppCostume : Costume {
  let spacing = CGFloat(8)

  public func wearRootBackground(_ view: UIView) {
    view.backgroundColor = Color.black.colorValue
  }

  public func wearHeadline(_ label: UILabel) {
    label.font = MyAppFont(size: .textStyle(.title1)).fontValue
    label.textColor = MyAppColors.forestGreen.colorValue
  }

  public var name: String { return "Default" }
  public var description: String { return "The default costume." }

  public init() { }
}

Cheers.

You might also like...
A Simple Camera App With Programmatic UI
A Simple Camera App With Programmatic UI

CameraApp-ProgrammaticUI Hey there! This is a simple Camera Application that I and Sahab Alharbi worked on as part of Tuwaiq's iOS bootcamp projects.

Confetti View lets you create a magnificent confetti view in your app
Confetti View lets you create a magnificent confetti view in your app

ConfettiView Confetti View lets you create a magnificent confetti view in your app. This was inspired by House Party app's login screen. Written in Sw

iOS custom controller used in Jobandtalent app to present new view controllers as cards
iOS custom controller used in Jobandtalent app to present new view controllers as cards

CardStackController iOS custom controller used in the Jobandtalent app to present new view controllers as cards. This controller behaves very similar

DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

A little app which shows different ways to simulate NSPanel using NSWindow
A little app which shows different ways to simulate NSPanel using NSWindow

FunWithPanels A little app which shows different ways to simulate NSPanel using NSWindow, for better or worse. Settings FunWithPanels uses a combinati

We-split - A study app made using SwiftUI

We Split We Split is a study app made using SwiftUI, being part of 100 Days of S

Basic iOS app to track stocks (data from Finnhub, Tiingo, or IEX Cloud)
Basic iOS app to track stocks (data from Finnhub, Tiingo, or IEX Cloud)

Basic iOS app to track stocks (data from Finnhub, Tiingo, or IEX Cloud)

App that uses iTunes Search API with SwiftUI for iOS 15+
App that uses iTunes Search API with SwiftUI for iOS 15+

ItunesSearchApp App that uses iTunes Search API with SwiftUI for iOS 15+ Documentation iTunes Search API: https://developer.apple.com/library/archive/

Base types for theming an app.

CostumeKit 🎩 Base types for theming an app. CostumeKit is made of up a set of Swift protocols. They are meant to be implemented by you in your app. F

An unintrusive & light-weight iOS app-theming library with support for animated theme switching.
An unintrusive & light-weight iOS app-theming library with support for animated theme switching.

Gestalt Gestalt is an unintrusive and light-weight framework for application theming with support for animated theme switching. Usage Let's say you wa

Turbo-iOS base project that's entirely driven from your backend Rails app.

Turbo-iOS base project that's entirely driven from your backend Rails app.

Projeto base de uma app de Delivery utilizado nas Sprints da Devpass.
Projeto base de uma app de Delivery utilizado nas Sprints da Devpass.

Delivery App Challenge 🍕 Neste desafio, implementaremos uma app de Delivery em equipe, dividindo tarefas e seguindo todas as boas práticos de desenvo

SwiftAudioPlayer - Swift-based audio player with AVAudioEngine as its base

SwiftAudioPlayer Swift-based audio player with AVAudioEngine as its base. Allows for: streaming online audio, playing local file, changing audio speed

libuv base Swift web HTTP server framework

Notice Trevi now open a Trevi Community. Yoseob/Trevi project split up into respective Trevi, lime, middlewares and sys packages at our community. If

Uncomplicated cryptography frameworks base on CommonCrypto

Keys - Keys of data encryption 中文介绍 Example let password = Password("Secret") let key = SymmetricKey() password.encrypt(data) let data = "Hello Wo

Repository with base samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Includes steps for encoding and packaging your own test content.

Video Everything Repository with minimal samples for playing HLS/DASH with CMAF video, across as many platforms as possible. Content and License All t

A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.

MJExtension A fast, convenient and nonintrusive conversion framework between JSON and model. 转换速度快、使用简单方便的字典转模型框架 📜 ✍🏻Release Notes: more details Co

ARKit Base Project. Place virtual objects based on WWDC example project
ARKit Base Project. Place virtual objects based on WWDC example project

ARKit - Placing Virtual Objects in Augmented Reality Learn best practices for visual feedback, gesture interactions, and realistic rendering in AR exp

Handles some of the base configuration to make creating a UIAlertController with text entry even easier. Plus validation!
Handles some of the base configuration to make creating a UIAlertController with text entry even easier. Plus validation!

🍅 FancyTextEntryController A simpler/easier API for adding text fields to UIAlertControllers. Not a custom view, just uses good ol' UIAlertController

Owner
Jake Marsh
iOS Developer, Designer, Writer. I make littlebitesofcocoa.com, deallocatedobjects.com, conditionsapp.com.
Jake Marsh
Circular progress indicator for your macOS app

CircularProgress Circular progress indicator for your macOS app This package is used in production by apps like Gifski and HEIC Converter. Requirement

Sindre Sorhus 520 Jan 3, 2023
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version

ContainerController UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/ Preview Requirements Installation CocoaPods Swi

Rustam 419 Dec 12, 2022
Show progress in your app's Dock icon

DockProgress Show progress in your app's Dock icon This package is used in production by the Gifski app. You might also like some of my other apps. Re

Sindre Sorhus 958 Jan 2, 2023
⚙ Add a preferences window to your macOS app in minutes

Preferences Add a preferences window to your macOS app in minutes Just pass in some view controllers and this package will take care of the rest. Requ

Sindre Sorhus 1.2k Jan 6, 2023
Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle.

Twinkle ✨ Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle. This library creates several CAEmitterLayers and animate

patrick piemonte 600 Nov 24, 2022
Repository for the dgca wallet app for iOS.

EU Digital COVID Certificate Wallet App - iOS About • Development • Documentation • Support • Contribute • Contributors • Licensing About This reposit

null 49 May 7, 2022
FacebookMe is a Swift App Mimics the personal profile tab of Facebook.

FacebookMe FacebookMe is a Swift App Mimics the personal profile tab of Facebook. It demos one simple way to implement a UITableView with mutiple sect

Kushal Shingote 3 Feb 20, 2022
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Michael Verges 695 Jan 3, 2023
Example Catalyst app that is shown in a UIKit popover underneath an NSStatusItem

CatalystStatusItemPopoverExample Example Catalyst app that is shown in a UIKit popover underneath an NSStatusItem. References How to use macOS Specifi

Tom Irving 9 Sep 8, 2022
Flutter Apple Product Store App UI Home Page With Getx

Flutter Apple Product Store App UI Home Page With Getx A new Flutter UI Project on my Youtube Channel . About The Project Create a beautiful Flutter U

Muawia Saeed 11 Dec 23, 2022