All Projects β†’ playbook-ui β†’ Playbook Ios

playbook-ui / Playbook Ios

Licence: apache-2.0
πŸ“˜A library for isolated developing UI components and automatically taking snapshots of them.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Playbook Ios

Accessibilitysnapshot
Easy regression testing for iOS accessibility
Stars: ✭ 236 (-71.57%)
Mutual labels:  snapshot-testing, accessibility, a11y
A11y styled form controls
Various styled accessible form controls
Stars: ✭ 335 (-59.64%)
Mutual labels:  accessibility, a11y
A11yproject.com
The A11Y Project is a community-driven effort to make digital accessibility easier.
Stars: ✭ 3,436 (+313.98%)
Mutual labels:  accessibility, a11y
Nextsimplestarter
🐳 Simple and Accessible PWA boilerplate with Nextjs 10 + React Hooks
Stars: ✭ 744 (-10.36%)
Mutual labels:  accessibility, a11y
Pa11y Ci
Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
Stars: ✭ 291 (-64.94%)
Mutual labels:  accessibility, a11y
A11y Toggle
A tiny script for accessible content toggles.
Stars: ✭ 304 (-63.37%)
Mutual labels:  accessibility, a11y
Accessible components
Listing of accessible components & patterns
Stars: ✭ 393 (-52.65%)
Mutual labels:  accessibility, a11y
Accessibility
A repo to organize the guidelines and best practices for accessibility at 18f.
Stars: ✭ 269 (-67.59%)
Mutual labels:  accessibility, a11y
Accesslint.js
Keep accessibility errors in check.
Stars: ✭ 423 (-49.04%)
Mutual labels:  accessibility, a11y
Construct.css
Focus on the content and structure of your HTML
Stars: ✭ 432 (-47.95%)
Mutual labels:  accessibility, a11y
Snapshot Diff
Diffing snapshot utility for Jest
Stars: ✭ 490 (-40.96%)
Mutual labels:  snapshot, snapshot-testing
A11y Courses
Courses offered in web accessibility (and other learning opportunities)
Stars: ✭ 288 (-65.3%)
Mutual labels:  accessibility, a11y
Pa11y
Pa11y is your automated accessibility testing pal
Stars: ✭ 3,207 (+286.39%)
Mutual labels:  accessibility, a11y
Checka11y.css
A CSS stylesheet to quickly highlight a11y concerns.
Stars: ✭ 313 (-62.29%)
Mutual labels:  accessibility, a11y
Js Offcanvas
A lightweight, flexible jQuery off-canvas navigation plugin which lets you create fully accessible sidebar or top/bottom sliding (or push) panels with keyboard interactions and ARIA attributes.
Stars: ✭ 272 (-67.23%)
Mutual labels:  accessibility, a11y
Axe Core
Accessibility engine for automated Web UI testing
Stars: ✭ 4,293 (+417.23%)
Mutual labels:  accessibility, a11y
Reakit
Toolkit for building accessible rich web apps with React
Stars: ✭ 5,265 (+534.34%)
Mutual labels:  accessibility, a11y
react-native-aria
A library of React Hooks for React-Native (Android/iOS/web) to provide accessible UI primitives for a design system.
Stars: ✭ 164 (-80.24%)
Mutual labels:  accessibility, a11y
Whocanuse
WhoCanUse is a tool that brings attention and understanding to how color contrast can affect different people with visual impairments.
Stars: ✭ 259 (-68.8%)
Mutual labels:  accessibility, a11y
Koa11y
Easily check for website accessibility issues
Stars: ✭ 403 (-51.45%)
Mutual labels:  accessibility, a11y

Playbook

A library for isolated developing UI components and automatically taking snapshots of them.

playbook

Playbook

Playbook

Swift5 CI Status Lincense
Release Swift Package Manager CocoaPods Carthage

Playbook is a library that provides a sandbox for building UI components without having to worry about application-specific dependencies, strongly inspired by Storybook for JavaScript in web-frontend development.

Components built by using Playbook can generate a standalone app as living styleguide.
This allows you to not only review UI quickly but also deliver more robost designs by separating business logics out of components.

Besides, snapshots of each component can be automatically generated by unit tests, and visual regression testing can be performed using arbitrary third-party tools.

For complex modern app development, it’s important to catch UI changes more sensitively and keep improving them faster.
With the Playbook, you don't have to struggle through preparing the data and spend human resources for manual testings.



Usage


Playbook

Playbook is a framework that provides the basic functionality for managing components. It supports both SwiftUI and UIKit.
Components are uniquely stored as scenarios. A Scenario has the way to layout component. Please check the API Doc for the variety of layouts.

Playbook.default.addScenarios(of: "Home") {
    Scenario("CategoryHome", layout: .fill) {
        CategoryHome().environmentObject(UserData.stub)
    }

    Scenario("LandmarkList", layout: .fill) {
        NavigationView {
            LandmarkList().environmentObject(UserData.stub)
        }
    }

    Scenario("UIView red", layout: .fixed(length: 100)) {
        let view = UIView()
        view.backgroundColor = .red
        return view
    }
}

ScenarioProvider allows you to isolate additional scenarios and keep your playbook building clean.

struct HomeScenarios: ScenarioProvider {
    static func addScenarios(into playbook: Playbook) {
        playbook.addScenarios(of: "Home") {
            Scenario("CategoryHome", layout: .fill) {
                CategoryHome().environmentObject(UserData.stub)
            }
        }
    }
}

struct AllScenarios: ScenarioProvider {
    static func addScenarios(into playbook: Playbook) {
        playbook.add(HomeScenarios.self)
    }
}

You can use the ScenarioContext passed to the closure that creates the component to get the screen size in snapshot, or wait before generating a snapshot.

Scenario("MapView", layout: .fill) { context in
    MapView(coordinate: landmarkData[10].locationCoordinate) {
        // This closure will called after the map has completed to render.
        context.snapshotWaiter.fulfill()
     }
     .onAppear(perform: context.snapshotWaiter.wait)
}

PlaybookUI

PlaybookUI is a framework that provides user interfaces made by SwiftUI for browsing a list of scenarios.

PlaybookGallery

The component visuals are listed and displayed.
Those that are displayed on the top screen are not actually doing layout, but rather display the snapshots that are efficiently generated at runtime.

Browser Detail
Gellery LightGellery Dark Gellery Content LightGellery Content Dark

PlaybookCatalog

The UI that search and select a scenario in a drawer. It's more similar to Storybook.
If you have too many scenarios, this may be more efficient than PlaybookCatalog.

Browser Detail
Catalog Drawer LightCatalog Drawer Dark Catalog LightCatalog Dark

How to Save Snapshot Images

To save snapshot images to the photo library from the share button on each UI, NSPhootLibraryAddUsageDescription must be supported. See the official document for more information.


PlaybookSnapshot

Scenarios can be tested by the instance of types conform to TestTool protocol.
Snapshot is one of them, which can generate the snapshots of all scenarios with simulate the screen size and safe area of the given devices.
Since Snapshot depends on XCTest, it should be used in the module for unit test.

final class SnapshotTests: XCTestCase {
    func testTakeSnapshot() throws {
        let directory = ProcessInfo.processInfo.environment["SNAPSHOT_DIR"]!

        try Playbook.default.run(
            Snapshot(
                directory: URL(fileURLWithPath: directory),
                clean: true,
                format: .png,
                keyWindow: UIApplication.shared.windows.first { $0.isKeyWindow },
                devices: [.iPhone11Pro(.portrait)]
            )
        )
    }
}
generate images

PlaybookAccessibilitySnapshot

An extension to Playbook that uses AccessibilitySnapshot to produce snapshots with accessibility information such as activation points and labels.

accessibility-snapshot

Integration with Third-party Tools

The generated snapshot images can be used for more advanced visual regression testing by using a variety of third party tools.

percy

percy

reg-viz/reg-suit

reg-suit

Requirements

  • Swift 5.1+
  • Xcode 11.0+
  • iOS
    • Playbook: 11.0+
    • PlaybookSnapshot: 11.0+
    • PlaybookUI: 13.0+

Installation

Playbook features are separated into the following frameworks.

  • Playbook: Core system of component management.
  • PlaybookSnapshot: Generates snapshots of all components.
  • PlaybookUI: Products a browsing UI for components managed by Playbook.

CocoaPods

Add the following to your Podfile:

target 'YourPlaybook' do
  pod 'Playbook'
  pod 'PlaybookUI'

  target 'YourPlaybookTests' do
    inherit! :search_paths

    pod 'PlaybookSnapshot'
  end
end

Carthage

Add the following to your Cartfile:

github "playbook-ui/playbook-ios"

Swift Package Manager

Select Xcode menu File > Swift Packages > Add Package Dependency... and enter repository URL with GUI.

Repository: https://github.com/playbook-ui/playbook-ios

Note: Currently, SwiftPM doesn't support specifying the OS version for each library, so only iOS13 is supported.


License

Playbook is released under the Apache 2.0 License.


Playbook

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].