Home
Softono

Charcoal Ios

Open source Apache-2.0 Swift
67
Stars
8
Forks
15
Issues
2
Watchers
3 months
Last Commit

 About Charcoal Ios

Design system library by pixiv

Platforms

Web Self-hosted macOS iOS

Languages

Swift

Need Help Installing Charcoal Ios?

We provide expert installation service for this software. Our team will install, configure, and secure Charcoal Ios on your server. plans start at just $30.

Charcoal Ios

View on GitHub

charcoal-ios ― PIXIV Design System

Usage

SwiftUI

Text("Hello")
  .charcoalTypography20Bold()

Button("OK") {}
  .charcoalPrimaryButton(size: .medium)

UIKit

Storyboard とコードから利用可能です。

let label = CharcoalTypography20()
label.isBold = true
label.text = "Hello"

let button = CharcoalPrimaryMButton()
button.setTitle("OK", for: .normal)

Dynamic Type

charcoal-ios はデフォルトで Dynamic Type をサポートしています。この機能を無効にしたい場合は、以下の手順を参照してください。

SwiftUI

.environment(.sizeCategory, .large) を使用して Dynamic Type レベルを固定します。

Button("Default Button M") {}
    .charcoalDefaultButton(size: .medium)
    .environment(\.sizeCategory, .large)

UIKit

CharcoalConfig.configUIKit.fixedSizeCategory を使用して Dynamic Type レベルを固定します。

CharcoalConfig.configUIKit.fixedSizeCategory = .large

デフォルトでは、 CharcoalUIKit は UITraitCollection の preferredContentSizeCategory に従うので、UITraitCollection を変更することで SizeCategory を指定できます。

let trait = UITraitCollection(preferredContentSizeCategory: .large)

setOverrideTraitCollection(trait, forChild: viewController)

Installation

Swift Package Manager を使ってライブラリをインストールすることができます。

dependencies: [
  .package(url: "https://github.com/pixiv/charcoal-ios", .upToNextMajor(from: "1.0.0"))
]

Requirements

  • iOS 15+
  • macOS 12+

Documentation

Documentation

Development

Configuration

Xcode configuration DebugMaxDeploymentTarget は、自動化テストの際に IPHONEOS_DEPLOYMENT_TARGET を指定するためだけに使用されます。

SwiftGen

Generate Assets

Run swiftgen command in the charcoal-ios project folder.

swift run --package-path BuildTools swiftgen

SwiftLint

swift run --package-path BuildTools swiftlint

Code Format

swift run -c release --package-path BuildTools swiftformat .