A category is a collection of components that share common traits. A category may contain subcategories. By default, components are laid out in nested table views, with each component being represented by a single row. A CatalogDisplayView is used to display a component in a single row. It displays small components together with a title and optional detail description. This is used for icons, fonts, and colors, but also works well for smaller components such as buttons. By using generics, CatalogDisplayView can display any view (populated with an associated model). The framework includes pre-defined categories for displaying common components: colors, fonts, and icons.
The catalog display view model has four parameters:
title: title
detail: detail description (optional), defaults to nil
axis: primary axis for the content view, defaults to .horizontal
model: model to populate the content view
By using CustomCategory, a larger component, such as a card view, can be shown. Each custom component might occupy a full row by itself.
For even larger components such as a view controller, we may skip the table view controller and display the component on a full screen by itself. This is accomplished by defining a custom category and destination that conform to the Classification and Destination protocols, respectively.
Color category
We can display colors by declaring a ColorCategory object:
models: information about the components to be displayed (in this case buttons)
Medium Component Category
We can display medium-sized custom components (such as a card or a note) by declaring a CustomCategory object that directly uses the view to be displayed:
models: information about the components to be displayed (in this case notes)
Large Component Category
In order to display large custom components (including full-screen views and even view controllers), we need to:
Create a custom destination that returns a view controller to be presented. If your component is not a view controller, this would be a view controller that contains your component.
If you’re submitting before and after screenshots, movies, or GIF’s, enter them in a two-column table so that they can be viewed side-by-side.
When merging a pull request:
Make sure the branch is rebased (not merged) off of the latest HEAD from the parent branch. This keeps our git history easy to read and understand.
Make sure the branch is deleted upon merge (should be automatic).
Releasing new versions
Tag the corresponding commit with the new version (e.g. 1.0.5)
Push the local tag to remote
Requirements
SwiftLint (linter)
brew install swiftlint
Jazzy (documentation)
sudo gem install jazzy
Setup
Open Package.swift in Xcode.
Generating Documentation (via Jazzy)
You can generate your own local set of documentation directly from the source code using the following command from Terminal:
jazzy
This generates a set of documentation under /docs. The default configuration is set in the default config file .jazzy.yaml file.
To view additional documentation options type:
jazzy --help
A GitHub Action automatically runs each time a commit is pushed to main that runs Jazzy to generate the documentation for our GitHub page at: https://yml-org.github.io/YComponentBrowser/
Easily extend any project to include an intelligent design component browser.
Licensing
Y—Component Browser is licensed under the Apache 2.0 license.
Documentation
Documentation is automatically generated from source code comments and rendered as a static website hosted via GitHub Pages at: https://yml-org.github.io/YComponentBrowser/
Table of Contents
Usage
A category is a collection of components that share common traits. A category may contain subcategories. By default, components are laid out in nested table views, with each component being represented by a single row. A
CatalogDisplayView
is used to display a component in a single row. It displays small components together with a title and optional detail description. This is used for icons, fonts, and colors, but also works well for smaller components such as buttons. By using generics,CatalogDisplayView
can display any view (populated with an associated model). The framework includes pre-defined categories for displaying common components: colors, fonts, and icons.The catalog display view model has four parameters:
title
: titledetail
: detail description (optional), defaults tonil
axis
: primary axis for the content view, defaults to.horizontal
model
: model to populate the content viewBy using
CustomCategory
, a larger component, such as a card view, can be shown. Each custom component might occupy a full row by itself.For even larger components such as a view controller, we may skip the table view controller and display the component on a full screen by itself. This is accomplished by defining a custom category and destination that conform to the
Classification
andDestination
protocols, respectively.Color category
We can display colors by declaring a
ColorCategory
object:where you need to specify:
name
: color category namemodels
: information about the colors to be displayedFont Category
We can display fonts by declaring a
FontCategory
object:where you need to specify:
name
: font category namemodels
: information about the fonts to be displayedIcon Category
We can display icons by declaring an
IconCategory
object:where you need to specify:
name
: icon category namemodels
: information about the icons to be displayedCatalog Category
We can display nested subcategories by declaring a
CatalogCategory
object:where you need to specify:
name
: category namesubcategories
: array of subcategoriesSmall Component Category
We can display small custom components (such as buttons) by declaring a
CustomCategory
object that leveragesCatalogDisplayView
:where you need to specify:
name
: category namemodels
: information about the components to be displayed (in this case buttons)Medium Component Category
We can display medium-sized custom components (such as a card or a note) by declaring a
CustomCategory
object that directly uses the view to be displayed:where you need to specify:
name
: category namemodels
: information about the components to be displayed (in this case notes)Large Component Category
In order to display large custom components (including full-screen views and even view controllers), we need to:
Create a custom destination that returns a view controller to be presented. If your component is not a view controller, this would be a view controller that contains your component.
Create a custom category for that particular view controller
Declare an instance of the category
Contributing to Y—Component-Browser
Versioning strategy
We utilize semantic versioning.
e.g.
Branching strategy
We utilize a simplified branching strategy for our frameworks.
main
main
main
as they are completed and approved.main
gets tagged with an updated version # for each releaseBranch naming conventions:
e.g.
Pull Requests
Prior to submitting a pull request you should:
jazzy
from the command line and confirm that you have 100% documentation coverage.git rebase -i HEAD~{commit-count}
to squash your last {commit-count} commits together into functional chunks.main
) has been updated since you created your branch, usegit rebase main
to rebase your branch.When submitting a pull request:
When merging a pull request:
Releasing new versions
1.0.5
)Requirements
SwiftLint (linter)
Jazzy (documentation)
Setup
Open
Package.swift
in Xcode.Generating Documentation (via Jazzy)
You can generate your own local set of documentation directly from the source code using the following command from Terminal:
This generates a set of documentation under
/docs
. The default configuration is set in the default config file.jazzy.yaml
file.To view additional documentation options type:
A GitHub Action automatically runs each time a commit is pushed to
main
that runs Jazzy to generate the documentation for our GitHub page at: https://yml-org.github.io/YComponentBrowser/