{"id":13666944,"url":"https://github.com/macabeus/FocusGuideHelper","last_synced_at":"2025-04-26T15:31:59.049Z","repository":{"id":56911545,"uuid":"91263807","full_name":"macabeus/FocusGuideHelper","owner":"macabeus","description":"TV Client | Create focus guides linker more easily and versatile.","archived":false,"fork":false,"pushed_at":"2018-02-16T11:33:16.000Z","size":22,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-12T19:08:24.476Z","etag":null,"topics":["focus-guide","stalkr-internals","swift","tvos","uikit"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macabeus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-14T18:39:05.000Z","updated_at":"2023-12-03T00:34:48.000Z","dependencies_parsed_at":"2022-08-20T20:20:52.663Z","dependency_job_id":null,"html_url":"https://github.com/macabeus/FocusGuideHelper","commit_stats":null,"previous_names":["brunomacabeusbr/focusguidehelper"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FFocusGuideHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FFocusGuideHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FFocusGuideHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macabeus%2FFocusGuideHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macabeus","download_url":"https://codeload.github.com/macabeus/FocusGuideHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224039033,"owners_count":17245530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["focus-guide","stalkr-internals","swift","tvos","uikit"],"created_at":"2024-08-02T07:00:17.364Z","updated_at":"2024-11-11T02:30:45.401Z","avatar_url":"https://github.com/macabeus.png","language":"Swift","funding_links":[],"categories":["UIKit","HarmonyOS","Uncategorized"],"sub_categories":["Windows Manager","Uncategorized"],"readme":"[![Version](https://img.shields.io/cocoapods/v/FocusGuideHelper.svg?style=flat)](http://cocoapods.org/pods/FocusGuideHelper)\n[![License](https://img.shields.io/cocoapods/l/FocusGuideHelper.svg?style=flat)](http://cocoapods.org/pods/FocusGuideHelper)\n[![Platform](https://img.shields.io/cocoapods/p/FocusGuideHelper.svg?style=flat)](http://cocoapods.org/pods/FocusGuideHelper)\n\n# FocusGuideHelper\n✨ Create focus guides linker more easily and versatile\n\n![](http://i.imgur.com/QaggXnh.png)\n\nYou can download this repository and see this example app.\n\n🌼 Thanks to [@EdyJunior](https://github.com/EdyJunior)\n\n# How to use\n\n## Install\n\nIn `Podfile` add\n\n```\npod 'FocusGuideHelper'\n```\n\nand use `pod install`.\n\n## Setup\n\nIn your Swift file, import this pod:\n\n```swift\nimport FocusGuideHelper\n```\n\nThen, create a object of `FocusGuideHelper`, for example:\n\n```swift\nclass ViewController: UIViewController {\n\n    let guideHelper = FocusGuideHelper()\n    ...\n```\n\nAnd, you need call `updateFocus(in:)` for every time the focus changes:\n\n```swift\noverride func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {\n\n    guideHelper.updateFocus(in: context)\n}\n```\n\n## Using this pod\n\n### Minimal\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n        \n    guideHelper.addLinkByFocus(\n        from: containerForm,  // original view\n        to: containerRaccon,  // destination when to touch in this focus guide\n        inPosition: .left  // position of the focus guide in relation of \"from\"\n    )\n    ...\n```\n\n### Update the focus guide\n\nSometimes, you need update your focus guide, because a destination view is changed, or to avoid have multiple copies of the same focus:\n\n```swift\nfunc someFunctionCalledSometimes() {\n\n    guideHelper.addLinkByFocus(\n        from: containerForm,\n        to: containerRaccon,\n        inPosition: .left,\n        identifier: \"containerForm to containerRaccon\"  // identifier of this focus guide\n    )\n}\n```\n\nYou can write anything in `identifier`. In each `FocusGuideHelper` object, can have only one focus with same identifier.\u003cbr\u003e\nIf another focus guide to be created with same identifier, the older is replaced.\n\n### Enable/disable focus guide\n\nSometimes, you need enable or disable a focus guide, to avoid conflict, or to create another experience:\n\n```swift\nguideHelper.addLinkByFocus(\n    from: someRaccon,\n    to: someView,\n    inPosition: .bottom,\n    identifier: \"raccon to view\",\n    activedWhen: { context in\n        return (context.nextFocusedView as? RacconView) != nil\n     }\n)\n```\n\nIf the `activedWhen` returned `true`, then the focus is enabled, otherwise, the focus is disabled.\u003cbr\u003e\nThe `identifier` is optional.\n\n### Temporary focus\n\n```swift\nguideHelper.addLinkByFocusTemporary(\n    from: someRaccon,\n    to: someView,\n    inPosition: .right\n)\n```\n\nThis focus guide will be automatically removed when the focus changed.\u003cbr\u003e\nIt's useful for avoid conflict with anothers focus guide, or when a destination view is also temporary.\n\n### Focus autoexclude\n\nSometimes, you need a temporary focus, but, that is removed at another time, then:\n\n```swift\nguideHelper.addLinkByFocus(\n    from: someRaccon,\n    to: someView,\n    inPosition: .bottom,\n    identifier: \"raccon to someView\",\n    autoexcludeWhen: { context in\n        return (context.nextFocusedView as? RacconView) == nil\n    }\n)\n```\n\nThis focus is excluded when the `autoexcludeWhen` return true.\u003cbr\u003e\nThe `identifier` is optional.\n\n---\n\n**Maintainer**:\n\n\u003e [macabeus](http://macalogs.com.br/) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@macabeus](https://github.com/macabeus)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacabeus%2FFocusGuideHelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacabeus%2FFocusGuideHelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacabeus%2FFocusGuideHelper/lists"}