Swiftpack.co -  DarthXoc/UIButtonFlat as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An extension to UIButton that allows for the easy creation of flat buttons and bordered buttons.
.package(url: "https://github.com/DarthXoc/UIButtonFlat.git", from: "v1.0.3")



This extension provides the ability to easily create a UIButton with a flat style, a border or both.

To learn more about this project, please visit it on GitHub.


Give UIButtonFlat a try without having to type a single line of code with the UIButtonFlat Demo.


Simply add UIButtonFlat via Swift Package Manager to your project... that's it!


You can choose to create a UIButtonFlat control in the same way that you would create a stock UIButton control, either via Storyboards, programmatically or through a mixture of the two.

Via Storyboards

  1. Select the UIButton that you wish to use
  2. Switch to the Identity Inspector
  3. Update the UIButton's class to 'UIButtonFlat'
  4. Switch to the Attributes Inspector
  5. Switch Type to 'Custom'
  6. You can find the configuration options under the Button Flat heading

Via Code

Import UIButtonFlat. Then create a UIButtonFlat control in the same way that you would create a UIButton control, except that instead of using UIButton, use the UIButtonFlat type. Because UIButtonFlat in an extension of UIButton, all of UIButton's functions will be inherited. Please note that if you are creating a UIButtonFlat from scratch and not connecting to a button that you've either fully or partially configured in a Storyboard, you will need to declare it's type as .custom like so:

let button: UIButtonFlat = UIButtonFlat(type: .custom)


Attribute Type Default Description
flatBackground Bool false Determines if a flat background will be drawn
border Bool false Determines if a border will be drawn
borderColor UIColor .clear The color of the border
borderWidth CGFloat 1 The width of the border
corner Bool false Determines if a rounded corner will be applied
cornerRadius CGFloat 0 The radius of the corner
tintColor UIColor self.view.tintColor The color used when drawing a flat background
titleLabel.textColor UIColor .white The color used by the title label; ignored if flatBackground is set to false

Known Issues

  • None


Stars: 0
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4 weeks ago

Improved support for legacy versions of iOS.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API