{"id":17148900,"url":"https://github.com/ivanvorobei/spindicator","last_synced_at":"2025-05-16T10:05:56.550Z","repository":{"id":40995603,"uuid":"369603290","full_name":"ivanvorobei/SPIndicator","owner":"ivanvorobei","description":"Floating indicator, mimicrate to indicator which appear when silent mode switched. Can be present from top and bottom. Interactive with gesters.","archived":false,"fork":false,"pushed_at":"2024-05-29T09:44:52.000Z","size":6677,"stargazers_count":769,"open_issues_count":10,"forks_count":46,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T03:02:09.610Z","etag":null,"topics":["alert","animation","apple","banner","indicator","interface","iphone","mode","popover","popup","silent","silentmode","swift","switch","toast","toast-notifications","ui","uikit","xcode"],"latest_commit_sha":null,"homepage":"https://opensource.ivanvorobei.io","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/ivanvorobei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ivanvorobei","sparrowcode"]}},"created_at":"2021-05-21T17:06:50.000Z","updated_at":"2025-03-05T11:58:35.000Z","dependencies_parsed_at":"2024-01-14T08:59:08.171Z","dependency_job_id":"7fdd539e-ffa3-4718-9665-32c17a50fcf9","html_url":"https://github.com/ivanvorobei/SPIndicator","commit_stats":{"total_commits":113,"total_committers":4,"mean_commits":28.25,"dds":0.09734513274336287,"last_synced_commit":"f9676f1d56239b1836587794923cb89cec8ae18a"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPIndicator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPIndicator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPIndicator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanvorobei%2FSPIndicator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanvorobei","download_url":"https://codeload.github.com/ivanvorobei/SPIndicator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974715,"owners_count":21026742,"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":["alert","animation","apple","banner","indicator","interface","iphone","mode","popover","popup","silent","silentmode","swift","switch","toast","toast-notifications","ui","uikit","xcode"],"created_at":"2024-10-14T21:30:16.635Z","updated_at":"2025-04-09T04:05:18.223Z","avatar_url":"https://github.com/ivanvorobei.png","language":"Swift","readme":"# SPIndicator\n\n\u003cp aligment=\"left\"\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spindicator/v1.6/animatable-presets.png?version=1\" height=\"180\"/\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spindicator/v1.6/customize.png?version=1\" height=\"180\"/\u003e\n    \u003cimg src=\"https://cdn.ivanvorobei.io/github/spindicator/v1.6/bottom-present.png?version=1\" height=\"180\"/\u003e\n\u003c/p\u003e\n\nMimicrate for the indicator which appears when silent mode is turned on / off. Availabe 2 animated presets: `done` \u0026 `error`.  Also supports custom images and presentations from top, center \u0026 bottom sides. \n\nTo get an alert like in Apple music, use this library instead [SPAlert](https://github.com/ivanvorobei/SPAlert).\n\n## Navigate\n\n- [Installation](#installation)\n    - [Swift Package Manager](#swift-package-manager)\n    - [CocoaPods](#cocoapods)\n    - [Manually](#manually)\n- [Quick Start](#quick-start)\n- [Usage](#usage)\n    - [Duration](#duration)\n    - [Layout](#layout)\n    - [Dismiss by Drag](#dismiss-by-drag)\n    - [Haptic](#haptic)\n    - [Present Side](#present-side)\n    - [Shared Configuration](#shared-configuration)\n- [Swift UI](#swiftui)\n- [Russian Community](#russian-community)\n\n## Installation\n\nReady for use on iOS 12+ \u0026 tvOS 12+.\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\nOnce you have your Swift package set up, adding as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ivanvorobei/SPIndicator\", .upToNextMajor(from: \"1.6.0\"))\n]\n```\n\n### CocoaPods:\n\n[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'SPIndicator'\n```\n\n### Manually\n\nIf you prefer not to use any of dependency managers, you can integrate manually. Put `Sources/SPIndicator` folder in your Xcode project. Make sure to enable `Copy items if needed` and `Create groups`.\n\n## Quick Start\n\nFor best experience, I recommend presenting indicator by calling the class functions `SPIndicator`. These functions are updated regularly and show the indicator as Apple way: \n\n```swift \n// Presets:\nSPIndicator.present(title: \"Error\", message: \"Try Again\", preset: .error)\n\n// For show with custom image:\nlet image = UIImage.init(systemName: \"sun.min.fill\")!.withTintColor(.systemYellow, renderingMode: .alwaysOriginal)\nSPIndicator.present(title: \"Custom Image\", message: \"With tint color\", preset: .custom(image))\n\n// For show text only:\nSPIndicator.present(title: \"Error\", haptic: .error)\n```\n\n## Usage\n\n### Duration\n\nTo change the presentation duration time, create the indicator view and call the method `present` with a custom duration:\n\n```swift\nlet indicatorView = SPIndicatorView(title: \"Complete\", preset: .done)\nindicatorView.present(duration: 3)\n```\n\n### Layout\n\nTo customise the layout \u0026 margins use the `layout` property. You can manage margins for each side, icon size and space between image and titles:\n\n```swift\nindicatorView.layout.iconSize = .init(width: 24, height: 24)\nindicatorView.layout.margins.top = 12\n```\n\n### Dismiss by Drag\n\nBy default, you can drag the indicator to hide it. While the indicator is dragging, dismiss is not working. This behaviour can be disabled:\n\n```swift\nindicatorView.dismissByDrag = false\n```\n\n### Haptic\n\nTo manage haptics, you shoud pass it in present method:\n\n```swift\nindicatorView.present(duration: 1.5, haptic: .success, completion: nil)\n```\n\nYou can remove the duration and completion parameters from the init. They have default values.\n\n### Present Side\n\nYou can change the presentation side: \n\n```swift\nSPIndicator.present(title: \"Error\", message: \"Try Again\", preset: .error, from: .bottom)\n\n// or for custom `SPIndicatorView`\n\nindicatorView.presentSide = .bottom\n```\nIn the case from above, the indicator will appear from bottom and will be attached to bottom. To manage the offset - check the property `offset`.\n\n### Shared Configuration\n\nAlso, you can change some default values for the alerts. For example, you can change the default duration for an alert with this code:\n\n```swift\nSPIndicatorView.appearance().duration = 2\n```\n\nIt will apply for all alerts. I recommend to set it in app delegate, but you can change it in runtime.\n\n## SwiftUI\n\nUse like system alert only show message tips:\n\n```swift\nButton(\"Show Indicator\") {\n    showIndicator = true\n}.SPIndicator(isPresent: $showIndicator, title: \"This is title only\")\n```\n\nor show message, title, image and other configuration:\n\n```swift\nButton(\"Show Indicator\") {\n    showIndicator = true\n}.SPIndicator(\n    isPresent: $showIndicator, \n    title: \"Title\", \n    message: \"Message\",\n    duration: 2.0, \n    presentSide: .top,\n    dismissByDrag: false, \n    preset: .custom(UIImage(systemName: \"heart\")!), \n    haptic: .success, \n    layout: .init(), \n    completion: {\n        print(\"Indicator is destoryed\")\n    })\n```\n\n## Russian Community\n\nЯ веду [телеграм-канал](https://sparrowcode.io/telegram), там публикую новости и туториалы.\u003cbr\u003e\nС проблемой помогут [в чате](https://sparrowcode.io/telegram/chat).\n\nВидео-туториалы выклыдываю на [YouTube](https://ivanvorobei.io/youtube):\n\n[![Tutorials on YouTube](https://cdn.ivanvorobei.io/github/readme/youtube-preview.jpg)](https://ivanvorobei.io/youtube)\n","funding_links":["https://github.com/sponsors/ivanvorobei","https://github.com/sponsors/sparrowcode"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvorobei%2Fspindicator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanvorobei%2Fspindicator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanvorobei%2Fspindicator/lists"}