{"id":2494,"url":"https://github.com/yannickl/DynamicButton","last_synced_at":"2025-08-03T00:31:49.959Z","repository":{"id":56909187,"uuid":"42578565","full_name":"yannickl/DynamicButton","owner":"yannickl","description":"Yet another animated flat buttons in Swift","archived":false,"fork":false,"pushed_at":"2019-09-28T09:26:11.000Z","size":278,"stargazers_count":1170,"open_issues_count":7,"forks_count":70,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-12-02T02:03:55.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://cocoadocs.org/docsets/DynamicButton","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/yannickl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-09-16T09:44:30.000Z","updated_at":"2024-12-01T18:58:18.000Z","dependencies_parsed_at":"2022-08-20T19:50:36.060Z","dependency_job_id":null,"html_url":"https://github.com/yannickl/DynamicButton","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FDynamicButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FDynamicButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FDynamicButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannickl%2FDynamicButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yannickl","download_url":"https://codeload.github.com/yannickl/DynamicButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228510706,"owners_count":17931752,"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":[],"created_at":"2024-01-05T20:16:15.129Z","updated_at":"2024-12-06T18:30:30.227Z","avatar_url":"https://github.com/yannickl.png","language":"Swift","funding_links":[],"categories":["UI","Button","Swift"],"sub_categories":["Button","Other free courses"],"readme":"![DynamicButton](http://yannickloriot.com/resources/dynamicbutton-header.png)\n\n[![Supported Platforms](https://cocoapod-badges.herokuapp.com/p/DynamicButton/badge.svg)](http://cocoadocs.org/docsets/DynamicButton/) [![Version](https://cocoapod-badges.herokuapp.com/v/DynamicButton/badge.svg)](http://cocoadocs.org/docsets/DynamicButton/) \u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg alt=\"Carthage compatible\" src=\"https://img.shields.io/badge/Carthage-%E2%9C%93-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/apple/swift-package-manager\"\u003e\u003cimg alt=\"Swift Package Manager compatible\" src=\"https://img.shields.io/badge/SPM-%E2%9C%93-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e [![Build Status](https://travis-ci.org/yannickl/DynamicButton.svg?branch=master)](https://travis-ci.org/yannickl/DynamicButton) [![codecov.io](http://codecov.io/github/yannickl/DynamicButton/coverage.svg?branch=master)](http://codecov.io/github/yannickl/DynamicButton?branch=master) [![codebeat badge](https://codebeat.co/badges/ed7210be-6c9d-43ff-87a0-a10c007fe1b4)](https://codebeat.co/projects/github-com-yannickl-dynamicbutton)\n\n**DynamicButton** is a powerful flat design button written in Swift to display *hamburger button* like with animated transitions between style updates. It also allows you to create your own custom symbol / style buttons!\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/798235/20039804/d4b533ca-a44a-11e6-8d4e-07aa45ef4a76.gif\" alt=\"DynamicButton\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#requirements\"\u003eRequirements\u003c/a\u003e • \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e • \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e • \u003ca href=\"#contribution\"\u003eContribution\u003c/a\u003e • \u003ca href=\"#contact\"\u003eContact\u003c/a\u003e • \u003ca href=\"#license-mit\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n## Requirements\n\n- iOS 8.0+ / tvOS 9.0+\n- Xcode 10.0+\n- Swift 5+\n\n## Usage\n\n### Basics\n\nHere is how to create a button and setting its style:\n\n```swift\nimport DynamicButton\n\nlet dynamicButton = DynamicButton(style: .hamburger)\n// Equivalent to\n// let dynamicButton   = DynamicButton()\n// dynamicButton.style = .hamburger\n\n// Animate the style update\ndynamicButton.setStyle(.close, animated: true)\n```\n\n### Customization\n\nButton appearance and behavior can be customized using different properties:\n\n```swift\nlet dynamicButton                 = DynamicButton()\ndynamicButton.lineWidth           = 3\ndynamicButton.strokeColor         = .black\ndynamicButton.highlightStokeColor = .gray\n```\n\n### Supported Symbol Styles\n\nHere is the symbol list (`DynamicButton.Style`) already implemented by the library:\n\n - `.arrowDown`: downwards arrow `↓`\n - `.arrowLeft`: leftwards arrow `←`\n - `.arrowRight`: rightwards arrow `→`\n - `.arrowUp`: upwards arrow `↑`\n - `.caretDown`: down caret `⌄`\n - `.caretLeft`: left caret `‹`\n - `.caretRight`: left caret `›`\n - `.caretUp`: up caret: `⌃`\n - `.checkMark`: check mark `✓`\n - `.circleClose`: close symbol surrounded by a circle\n - `.circlePlus`: plus symbol surrounded by a circle\n - `.close`: close symbol `X`\n - `.dot`: dot symbol `.`\n - `.download`: downwards triangle-headed arrow to bar `⤓`\n - `.fastForward`: fast forward `≫`\n - `.hamburger`: hamburger button `≡`\n - `.horizontalLine`: horizontal line `―`\n - `.horizontalMoreOptions`: horizontal more options `…`\n - `.none`: no style\n - `.pause`: pause symbol `‖`\n - `.play`: play symbol `►`\n - `.plus`: plus symbol `+`\n - `.stop`: stop symbol `◼`\n - `.reload`: reload symbol `↻`\n - `.rewind`: rewind `≪`\n - `.verticalLine`: vertical line `|`\n - `.verticalMoreOptions`: vertical more options `⋮`\n - `.location`: location symbol\n\n### Custom symbols\n\nTo create your own symbols you have to create an object (or struct) that conforms to the `DynamicButtonBuildableStyle` protocol:\n\n```swift\n/// Diagonal line style: \\\nstruct MyCustomLine: DynamicButtonBuildableStyle {\n  let pathVector: DynamicButtonPathVector\n\n  init(center: CGPoint, size: CGFloat, offset: CGPoint, lineWidth: CGFloat) {\n    let r = size / 2\n    let c = cos(CGFloat.pi * 0.3)\n    let s = sin(CGFloat.pi * 0.3)\n\n    let p1 = CGMutablePath()\n    p1.move(to: CGPoint(x: center.x + r * c, y: center.y + r * s))\n    p1.addLine(to: CGPoint(x: center.x - r * c, y: center.y - r * s))\n\n    pathVector = DynamicButtonPathVector(p1: p1, p2: p1, p3: p1, p4: p1)\n  }\n\n  /// \"MyCustomLine\" style.\n  static var styleName: String {\n    return \"MyCustomLine\"\n  }\n}\n\nmyButton.style = .custom(MyCustomLine.self)\n```\n\nNote that a symbol can not have more than 4 paths.\n\n### And many more...\n\nTo go further, take a look at the example project.\n\n## Installation\n\n#### CocoaPods\n\nInstall CocoaPods if not already available:\n\n``` bash\n$ [sudo] gem install cocoapods\n$ pod setup\n```\nGo to the directory of your Xcode project, and Create and Edit your Podfile and add _DynamicButton_:\n\n``` bash\n$ cd /path/to/MyProject\n$ touch Podfile\n$ edit Podfile\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n\nuse_frameworks!\npod 'DynamicButton', '~\u003e 6.2.1'\n```\n\nInstall into your project:\n\n``` bash\n$ pod install\n```\n\nOpen your project in Xcode from the .xcworkspace file (not the usual project file):\n\n``` bash\n$ open MyProject.xcworkspace\n```\n\nYou can now `import DynamicButton` framework into your files.\n\n#### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate `DynamicButton` into your Xcode project using Carthage, specify it in your `Cartfile` file:\n\n```ogdl\ngithub \"yannickl/DynamicButton\" \u003e= 6.2.1\n```\n\n#### Swift Package Manager\n\nYou can use [The Swift Package Manager](https://swift.org/package-manager) to install `DynamicButton` by adding the proper description to your `Package.swift` file:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    dependencies: [\n        .package(url: \"https://github.com/yannickl/DynamicButton.git\", from: \"6.2.1\")\n    ],\n    // ...\n)\n```\n\nNote that the [Swift Package Manager](https://swift.org/package-manager) is still in early design and development, for more information checkout its [GitHub Page](https://github.com/apple/swift-package-manager).\n\n#### Manually\n\n[Download](https://github.com/YannickL/DynamicButton/archive/master.zip) the project and copy the `DynamicButton` folder into your project to use it in.\n\n## Contribution\n\nContributions are welcomed and encouraged *♡*.\n\n## Contact\n\nYannick Loriot\n - [https://21.co/yannickl/](https://21.co/yannickl/)\n - [https://twitter.com/yannickloriot](https://twitter.com/yannickloriot)\n\n## License (MIT)\n\nCopyright (c) 2015-present - Yannick Loriot\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannickl%2FDynamicButton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyannickl%2FDynamicButton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannickl%2FDynamicButton/lists"}