Latest 0.1.1
License MIT
Platforms tvos 10.0


✨ Create focus guides linker more easily and versatile

You can download this repository and see this example app.

🌼 Thanks to @EdyJunior

How to use


In Podfile add

pod 'FocusGuideHelper'

and use pod install.


In your Swift file, import this pod:

import FocusGuideHelper

Then, create a object of FocusGuideHelper, for example:

class ViewController: UIViewController {

    let guideHelper = FocusGuideHelper()

And, you need call updateFocus(in:) for every time the focus changes:

override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {

    guideHelper.updateFocus(in: context)

Using this pod


override func viewDidLoad() {

        from: containerForm,  // original view
        to: containerRaccon,  // destination when to touch in this focus guide
        inPosition: .left  // position of the focus guide in relation of "from"

Update the focus guide

Sometimes, you need update your focus guide, because a destination view is changed, or to avoid have multiple copies of the same focus:

func someFunctionCalledSometimes() {

        from: containerForm,
        to: containerRaccon,
        inPosition: .left,
        identifier: "containerForm to containerRaccon"  // identifier of this focus guide

You can write anything in identifier. In each FocusGuideHelper object, can have only one focus with same identifier.
If another focus guide to be created with same identifier, the older is replaced.

Enable/disable focus guide

Sometimes, you need enable or disable a focus guide, to avoid conflict, or to create another experience:

    from: someRaccon,
    to: someView,
    inPosition: .bottom,
    identifier: "raccon to view",
    activedWhen: { context in
        return (context.nextFocusedView as? RacconView) != nil

If the activedWhen returned true, then the focus is enabled, otherwise, the focus is disabled.
The identifier is optional.

Temporary focus

    from: someRaccon,
    to: someView,
    inPosition: .right

This focus guide will be automatically removed when the focus changed.
It’s useful for avoid conflict with anothers focus guide, or when a destination view is also temporary.

Focus autoexclude

Sometimes, you need a temporary focus, but, that is removed at another time, then:

    from: someRaccon,
    to: someView,
    inPosition: .bottom,
    identifier: "raccon to someView",
    autoexcludeWhen: { context in
        return (context.nextFocusedView as? RacconView) == nil

This focus is excluded when the autoexcludeWhen return true.
The identifier is optional.


macabeus  · 
GitHub @macabeus

Latest podspec

    "name": "FocusGuideHelper",
    "version": "0.1.1",
    "summary": "Clean, simple and beautiful segment bar for your AppleTv app",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Bruno Macabeus": "[email protected]"
    "platforms": {
        "tvos": "10.0"
    "source": {
        "git": "",
        "tag": "0.1.1"
    "source_files": [
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This