Instructions

repository·main·Indexed 26 days ago

https://github.com/ephread/instructions

A library for adding customizable coach marks and onboarding overlays to iOS projects for iPhone and iPad. It features a customizable highlight system, skippable tours, and support for App Extensions, RTL layouts, and size transitions. Requires Xcode 13+, Swift 5+, and iOS 14.0+ (with limited support back to iOS 9.0). Note: This project is marked as deprecated; the maintainer recommends migrating to SwiftUI and Apple's TipKit for new projects.

Tokens
3.3K
Snippets
11
Records
23
Agent score
40%

What's inside Instructions

  1. Overview of Instructions

    main

    Instructions is a library for adding customizable coach marks (onboarding overlays) to iOS projects for both iPhone and iPad.

    Note: The maintainer has marked this project as deprecated. For new projects, it is recommended to migrate to SwiftUI and use Apple's TipKit instead. However, the library will continue to receive bug fixes and compatibility updates for newer Xcode/iOS versions.

    Key Features:

    • Customizable highlight system, views, and positions.
    • Skippable tours and pilotable flows from code.
    • Support for App Extensions, Right-to-left (RTL) layouts, and size transitions (orientation/multi-tasking).
    • Animatable coach marks and partial UIVisualEffectView support.
  2. Install Instructions manually (Embedded Framework)

    main

    To install manually without a dependency manager:

    1. Drag the Instructions.xcodeproj into your application's Xcode project navigator.
    2. Select your application project in the project navigator.
    3. Select your target and go to the General panel.
    4. Scroll down to the Embedded Binaries section.
    5. Click the + button and select Instructions.framework from the Product directory.
  3. Install Instructions via Carthage

    main

    To install using Carthage, add the following line to your Cartfile:

    gitub "ephread/Instructions" ~> 2.3.0

    Then, run the following commands to update and build the framework:

    $ carthage update
    $ carthage build
  4. Update OverlayManager properties for version 2.0.0

    main

    When migrating to Instructions 2.0.0, update the properties on CoachMarkController.overlay (the OverlayManager) to the following new names:

    // 2.0.0 OverlayManager Properties
    public var backgroundColor: UIColor
    public var isUserInteractionEnabled: Bool 
    public var isUserInteractionEnabledInsideCutoutPath: Bool
    public var areTouchEventsForwarded: Bool
  5. Start and Stop the coach marks flow

    main

    To begin the tour, call start(in:) on your CoachMarksController. It is recommended to call this in viewDidAppear rather than viewDidLoad to ensure the view hierarchy is ready. To prevent animation artifacts, call stop(immediately: true) in viewWillDisappear.

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.coachMarksController.start(in: .window(over: self))
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        self.coachMarksController.stop(immediately: true)
    }
  6. Install Instructions via CocoaPods

    main

    To install using CocoaPods, add the following to your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'
    # Instructions is only supported for iOS 13+, but it
    # can be used on older versions at your own risk,
    # going as far back as iOS 9.
    platform :ios, '9.0'
    use_frameworks!
    
    pod 'Instructions', '~> 2.3.0'

    Then, execute the install command in your terminal:

    $ pod install
  7. Setup Instructions for App Extensions

    main

    App Extensions cannot use UIApplication.sharedApplication(). Instructions provides a specific scheme/framework for this purpose.

    CocoaPods Setup

    In your Podfile, use InstructionsAppExtensions for your extension target:

    target 'Instructions App Extensions Example' do
      pod 'Instructions', '~> 2.3.0'
    end
    
    target 'Keyboard Extension' do
      pod 'InstructionsAppExtensions', '~> 2.3.0'
    end

    Frameworks (Carthage / Manual)

    Embed both Instructions.framework and InstructionsAppExtensions.framework.

    Importing:

    • In regular apps: import Instructions
    • In App Extensions: import InstructionsAppExtensions
    import InstructionsAppExtensions
  8. Implement Skip Functionality

    main

    To allow users to skip the tour:

    1. Set skipView to a view conforming to CoachMarkSkipView. This view must implement a skipControl: UIControl? getter.
    2. (Optional) Use the CoachMarksControllerDataSource method coachMarksController(_:constraintsForSkipView:inParent:) to return [NSLayoutConstraint] defining the skip button's position.