Skip to content

grofers/Squircles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Squircles

Integration

To integrate Squircles into your app, follow these steps:

  1. Import ZSquirclesView folder into your project.
  2. For any view you wish to support a squircle shape, inherit it from ZSquircleView. ZSquircleView is a subclass of UIView, providing all the functionalities of a standard UIView.
  3. Instead of using the traditional view.addSubview(...), utilize the following approach:
view.squircleContentView.addSubview(containerView)
  1. When setting the corner radius, instead of view.layer.cornerRadius = x, use the following:
view.squircleCornerRadius = 8

Voila, you implemented your first squicle view.

In the case you are wondering how can one spot the difference between a normal view and squircle view, the following is an example.

Styling

Border Configuration

To set the border of the squircle view, employ the following code:

view.borderConfig = ZSquircleView.BorderConfig(width: 1.0, color: .green)

Shadow Configurations

To add shadow of the squircle view, employ the following code:

view.shadowConfig = ZSquircleView.ShadowConfig(color: .black, offset: CGSize(width: 0, height: 1), radius: 2, opacity: 0.08)

Customizing Specific Corners

If you wish to apply these properties to a specific corners, use the following:

view.squircleCorners = .topCorners // in case of top corners 

Available options for corners:

  • Top corners .topCorners
  • Top left .topLeft
  • Top right .topRight
  • Bottom corners .bottomCorners
  • Bottom left .bottomLeft
  • Bottom right .bottomRight
  • No corners noCorners
  • All corners allCorners

If you have any feedback or suggestions, please create an issue or raise a pull request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages