소스 정보
- 저장소
- amberframework/asset_pipeline
- 최근 소스 활동
- 2026년 2월 18일 11:55
- 감지된 SKILL.md 언어
- 영어
- 스타
- 5
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/amberframework/asset_pipeline --skill cross-platform-components명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | cross-platform-components |
| description | Overview of the Crystal cross-platform UI component system |
| version | 1.0 |
The cross-platform UI component system extends the asset_pipeline shard with native rendering for macOS (AppKit), iOS (UIKit), and Android (JNI/Views), alongside the existing web (HTML) output path. A single Crystal source tree defines a UI::View abstract class hierarchy that is rendered by platform-specific visitors selected at compile time via flag?(). Zero bytes of platform code leak across targets.
Core model: App code builds a tree of UI::View objects. A compile-time-selected PlatformRenderer (a PlatformVisitor subclass) walks the tree and produces native UI. The web renderer delegates to the existing Components::Elements system; native renderers call through ObjC or JNI bridges.
App Code (single Crystal source)
|
v
UI::View (abstract class hierarchy, pointer-sized virtual dispatch)
|
v
UI::PlatformVisitor (compile-time selected via flag?())
|
+-- Web::Renderer -> Components::Elements (existing HTML system)
+-- AppKit::Renderer -> NSView via ObjC bridge [flag?(:macos)]
+-- UIKit::Renderer -> UIView via ObjC bridge [flag?(:ios)]
+-- Android::Renderer -> Android Views via JNI bridge [flag?(:android)]
Layout is 100% delegated to each platform's native engine. There is no custom constraint solver or Flexbox implementation in Crystal. VStack maps to NSStackView / UIStackView / LinearLayout / flex-column; each platform handles its own geometry.
| View Type | Purpose |
|---|---|
UI::Label | Read-only text display with font, color, alignment, and line limit |
UI::Button | Tappable element with a text label and on_tap callback |
UI::VStack | Vertical stack layout arranging children top to bottom |
UI::HStack | Horizontal stack layout arranging children leading to trailing |
UI::ZStack | Z-axis overlay stack drawing children back to front |
UI::Image | Image display with content mode and optional tint |
UI::TextField | Editable single-line text input with change callback |
UI::ScrollView | Scrollable container for content exceeding visible bounds |
UI::Spacer | Flexible space that expands within a stack layout |
All view types are classes (not structs) because container views hold Array(View) children, creating recursive type relationships that Crystal structs cannot represent.
Use the cross-platform UI layer when:
Do NOT use this when:
Components::Elements directly)require "ui"
class CounterApp
@count = 0
def build_view : UI::View
stack = UI::VStack.new(spacing: 16.0, alignment: UI::Alignment::Center)
label = UI::Label.new("Count: #{@count}")
label.font = UI::Font.new(size: 24.0, weight: :bold)
stack << label
button = UI::Button.new("Increment") { @count += 1; nil }
stack << button
stack
end
end
This single definition renders as:
<div style="display:flex;flex-direction:column;gap:16px"> with <span> and <button> childrenNSStackView(vertical) containing NSTextField (non-editable) and NSButtonUIStackView(.vertical) containing UILabel and UIButtonLinearLayout(VERTICAL) containing TextView and MaterialButtonThe platform renderer is selected at compile time with zero runtime branching:
{% if flag?(:macos) %}
require "./renderers/appkit_renderer"
alias PlatformRenderer = UI::AppKit::Renderer
{% elsif flag?(:ios) %}
require "./renderers/uikit_renderer"
alias PlatformRenderer = UI::UIKit::Renderer
{% elsif flag?(:android) %}
require "./renderers/android_renderer"
alias PlatformRenderer = UI::Android::Renderer
{% else %}
require "./renderers/web_renderer"
alias PlatformRenderer = UI::Web::Renderer
{% end %}
The Crystal compiler eliminates all code for non-selected platforms. A macOS binary contains zero Android code, and vice versa.
| File | Purpose |
|---|---|
src/ui/view.cr | UI::View abstract class, Color, Font, EdgeInsets, enums |
src/ui/views/*.cr | All 9 concrete view types |
src/ui/platform_visitor.cr | UI::PlatformVisitor abstract class with 9 visit methods |
src/ui.cr | Top-level require that pulls in the full UI module |
Run the asset_pipeline convention linter (`scripts/lint_conventions.cr`) — Crystal-side runner that enforces Phase 10 Family 1 naming rules across src/, samples/, and spec/. Use before commit, in CI, or when reviewing a PR.
Build cross-platform apps with UI::App + UI::Screen + UI::Controller + UI::ActionDispatcher + UI::FormState — route declarations, native action dispatch, Amber web integration, and the static-site web target.
The developer-facing guide to building Apple UI (iOS 26, iPadOS 26, macOS 26) with asset_pipeline's UI::View system. Backed by the Apple HIG corpus and validated by macOS + iOS screenshots. Answers "I want to show X — what component, what args, what HIG says."