Convert Figma logo to code with AI

rnystrom logoRNFrostedSidebar

A Control Center-esque control with blurred background and toggle animations.

2,124
340
2,124
24

Top Related Projects

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

iOS 7/8 style side menu with parallax effect.

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !

Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

Animated side menu with customizable UI

A side menu controller written in Swift for iOS

Quick Overview

RNFrostedSidebar is an iOS library that provides a customizable, blurred sidebar menu for iOS applications. It offers a sleek, modern design with a frosted glass effect, enhancing the visual appeal and user experience of iOS apps.

Pros

  • Easy to implement and customize
  • Smooth animations and transitions
  • Supports both images and text for menu items
  • Compatible with various iOS versions

Cons

  • Limited documentation and examples
  • Not actively maintained (last update was several years ago)
  • May require additional work to integrate with modern iOS development practices
  • Potential performance issues on older devices due to blur effect

Code Examples

  1. Creating and showing the sidebar:
let sidebar = RNFrostedSidebar(itemImages: [UIImage(named: "gear"), UIImage(named: "globe"), UIImage(named: "profile")])
sidebar.show()
  1. Customizing the sidebar appearance:
sidebar.width = 200
sidebar.showFromRight = true
sidebar.isSingleSelect = false
sidebar.tintColor = UIColor.blue
sidebar.borderWidth = 2
  1. Handling item selection:
sidebar.delegate = self

// In the delegate method
func sidebar(_ sidebar: RNFrostedSidebar, didTapItemAtIndex index: Int) {
    print("Tapped item at index \(index)")
}

Getting Started

  1. Add the RNFrostedSidebar files to your project (manually or via CocoaPods).
  2. Import the library in your view controller:
import RNFrostedSidebar

class ViewController: UIViewController, RNFrostedSidebarDelegate {
    var sidebar: RNFrostedSidebar!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let images = [UIImage(named: "gear"), UIImage(named: "globe"), UIImage(named: "profile")]
        sidebar = RNFrostedSidebar(itemImages: images)
        sidebar.delegate = self
    }
    
    func showSidebar() {
        sidebar.show()
    }
    
    // Implement delegate methods as needed
}
  1. Call showSidebar() when you want to display the sidebar.

Competitor Comparisons

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Pros of SlideMenuControllerSwift

  • Written in Swift, providing better performance and safety features
  • Supports both left and right side menus
  • Customizable animation and gesture options

Cons of SlideMenuControllerSwift

  • Less visually appealing out-of-the-box compared to RNFrostedSidebar's frosted glass effect
  • Requires more setup and configuration to achieve a polished look
  • Limited to slide-out menu style, while RNFrostedSidebar offers a unique overlay approach

Code Comparison

SlideMenuControllerSwift:

let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
self.window?.rootViewController = slideMenuController
self.window?.makeKeyAndVisible()

RNFrostedSidebar:

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images selectedIndices:selectedIndices borderColors:colors];
callout.delegate = self;
[callout show];

SlideMenuControllerSwift uses a more modern Swift syntax and requires explicit setup of view controllers, while RNFrostedSidebar uses Objective-C and focuses on initializing with images and colors for a quick setup. SlideMenuControllerSwift offers more flexibility in terms of menu positioning and customization, whereas RNFrostedSidebar provides a simpler API for creating a visually appealing sidebar with less code.

iOS 7/8 style side menu with parallax effect.

Pros of RESideMenu

  • More customizable with various animation styles and transition options
  • Supports both left and right side menus
  • Includes built-in gesture recognition for opening/closing the menu

Cons of RESideMenu

  • Slightly more complex setup and configuration
  • May have a steeper learning curve for beginners
  • Less focused on the "frosted" visual effect

Code Comparison

RESideMenu:

RESideMenu *sideMenu = [[RESideMenu alloc] initWithContentViewController:contentViewController
                                                    leftMenuViewController:leftMenuViewController
                                                   rightMenuViewController:rightMenuViewController];
self.window.rootViewController = sideMenu;

RNFrostedSidebar:

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images selectedIndices:selectedIndices borderColors:colors];
[callout show];

RESideMenu offers more flexibility in terms of menu placement and content, while RNFrostedSidebar focuses on a simpler, visually appealing sidebar implementation. RESideMenu requires more setup but provides greater customization options, whereas RNFrostedSidebar offers a quicker implementation with a specific visual style. The choice between the two depends on the desired level of customization and the specific design requirements of the project.

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !

Pros of SWRevealViewController

  • More comprehensive and feature-rich, offering various reveal styles and customization options
  • Better documentation and extensive sample code provided
  • Actively maintained with regular updates and bug fixes

Cons of SWRevealViewController

  • Steeper learning curve due to its complexity and extensive features
  • Heavier implementation that may impact app performance for simpler use cases
  • Less visually striking out-of-the-box compared to RNFrostedSidebar's frosted glass effect

Code Comparison

SWRevealViewController:

SWRevealViewController *revealViewController = self.revealViewController;
if (revealViewController) {
    [self.sidebarButton setTarget: self.revealViewController];
    [self.sidebarButton setAction: @selector(revealToggle:)];
    [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}

RNFrostedSidebar:

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images];
callout.delegate = self;
[callout show];

SWRevealViewController offers more control and customization but requires more setup code, while RNFrostedSidebar provides a simpler implementation for basic sidebar functionality with a distinctive visual style.

Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

Pros of SideMenu

  • More customizable with various configuration options
  • Supports both left and right side menus
  • Actively maintained with regular updates

Cons of SideMenu

  • Larger codebase, potentially more complex to implement
  • May require more setup and configuration

Code Comparison

RNFrostedSidebar:

let frostedSidebar = RNFrostedSidebar(width: 280, style: .Dark)
frostedSidebar.show()

SideMenu:

let menu = SideMenuNavigationController(rootViewController: YourViewController())
menu.leftSide = true
SideMenuManager.default.leftMenuNavigationController = menu
present(menu, animated: true, completion: nil)

Summary

SideMenu offers more features and customization options compared to RNFrostedSidebar, including support for both left and right side menus. It's actively maintained, ensuring compatibility with the latest iOS versions. However, this comes at the cost of a larger codebase and potentially more complex implementation. RNFrostedSidebar, while simpler, may be easier to set up quickly but lacks some advanced features. The choice between the two depends on the specific requirements of your project and the level of customization needed.

Animated side menu with customizable UI

Pros of Side-Menu.iOS

  • More visually appealing and customizable animation effects
  • Supports both left and right side menus
  • Actively maintained with recent updates

Cons of Side-Menu.iOS

  • Slightly more complex implementation due to additional features
  • May require more setup time for basic functionality

Code Comparison

Side-Menu.iOS:

let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.leftMenuNavigationController = menuLeftNavigationController
SideMenuManager.default.addPanGestureToPresent(toView: self.navigationController!.navigationBar)

RNFrostedSidebar:

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithItems:@[item1, item2, item3]];
callout.delegate = self;
[callout show];

The Side-Menu.iOS implementation offers more configuration options and integration with navigation controllers, while RNFrostedSidebar provides a simpler, more straightforward approach for basic sidebar functionality.

Side-Menu.iOS allows for greater customization and control over the menu's behavior and appearance, making it suitable for more complex applications. RNFrostedSidebar, on the other hand, is easier to implement for simple use cases but may lack some advanced features.

Both libraries offer valuable solutions for implementing side menus in iOS applications, with the choice depending on the specific requirements and complexity of the project.

A side menu controller written in Swift for iOS

Pros of SideMenuController

  • More customizable with various animation options and styles
  • Supports both left and right side menus
  • Written in Swift, offering better performance and compatibility with modern iOS development

Cons of SideMenuController

  • Slightly more complex setup process
  • May require more configuration to achieve a specific look
  • Less focus on the frosted glass effect, which is RNFrostedSidebar's main feature

Code Comparison

SideMenuController:

let menuController = SideMenuController()
menuController.leftViewController = leftViewController
menuController.mainViewController = mainViewController

RNFrostedSidebar:

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithItems:@[...]];
[callout show];

SideMenuController offers a more flexible approach, allowing developers to set separate view controllers for the menu and main content. RNFrostedSidebar, on the other hand, focuses on creating a simple sidebar with a predefined set of items.

While both libraries serve the purpose of creating side menus, SideMenuController provides more options for customization and integration with modern iOS apps. RNFrostedSidebar excels in creating a specific frosted glass effect but may be less versatile for complex menu structures.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

RNFrostedSidebar

Add your own Control Center-esque UI to your app to work as navigation or even toggle different settings. Blend right into the new iOS 7 design with animated blurs, flat design, and custom animations.

This project is another UI control built after finding some inspiration on Dribbble. The original design was created by Jakub Antalik.

For some thoughts on live blur in iOS apps, check out my blog post.

You'll notice that this control's use of blur does not match Jakub's original design exactly. In the original design the background of the buttons is blurred, while the overlay of the control is simply shaded. There have been attempts at recreating this effect, but it is rumored that live-blurring takes place at a much lower level on the GPU and there would be security concerns were we to have access.

Apple is being a little deceptive with their use of blurring in iOS 7. Bottom line, don't animate blurs in your designs.

If you examine the source of this project you'll see that I'm actually cheating to get the blur layer to animate overtop the original view.

Installation

The preferred method of installation is with CocoaPods. Just add this line to your Podfile.

pod 'RNFrostedSidebar', '~> 0.2.0'

Or if you want to install manually, drag and drop the RNFrostedSidebar .h and .m files into your project. To get this working, you'll need to include the following frameworks in Link Binary with Libraries:

  • QuartzCore
  • Accelerate

Usage

The simplest usage is to create a list of images, initialize a RNFrostedSidebar object, then call the -show method.

NSArray *images = @[
                    [UIImage imageNamed:@"gear"],
                    [UIImage imageNamed:@"globe"],
                    [UIImage imageNamed:@"profile"],
                    [UIImage imageNamed:@"star"]
                    ];

RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images];
callout.delegate = self;
[callout show];

If you use RNFrostedSidebar with a UINavigationController, you can push another UIViewController after selecting a button. Simply initialize it in sidebar:didTapItemAtIndex:, then push it onto the navigation stack after dimissing the sidebar with -dismissAnimated:completion:.

- (void)sidebar:(RNFrostedSidebar *)sidebar didTapItemAtIndex:(NSUInteger)index {
    if (index == 1) {
        [sidebar dismissAnimated:YES completion:^(BOOL finished) {
            if (finished) {
                UIViewController *secondVC = [[UIViewController alloc] init];
                [self.navigationController pushViewController:secondVC animated:YES];
            }
        }];
    }
}

Customization

I've exposed a healthy amount of options for you to customize the appearance and animation of the control.

- (instancetype)initWithImages:(NSArray *)images selectedIndices:(NSIndexSet *)selectedIndices;

Use the parameter selectedIndices to add pre-selected options. Without using the init method below there wont be any visualization of selection. But, you will get the proper enabled/disabled BOOL in the delegate -sidebar:didEnable:itemAtIndex: method.

- (instancetype)initWithImages:(NSArray *)images selectedIndices:(NSIndexSet *)selectedIndices borderColors:(NSArray *)colors;

Use the parameter borderColors to add border effect animations when selecting and deselecting a view.

@property (nonatomic, assign) CGFloat width;

The width of the blurred region. Default 150.

@property (nonatomic, assign) BOOL showFromRight;

Toggle showing the control from the right side of the device. Default NO.

@property (nonatomic, assign) CGFloat animationDuration;

The duration of the show and dismiss animations. Default 0.25.

@property (nonatomic, assign) CGSize itemSize;

The size of the item views. Default is width: 75, height: 75.

@property (nonatomic, strong) UIColor *tintColor;

The tint color of the blur. This can be a tricky property to set. I recommend using the provided alpha. Avoid using solid colors with an alpha of 1. Default white: 0.2, alpha: 0.73.

@property (nonatomic, strong) UIColor *itemBackgroundColor;

The background color for item views. Note: This property must be set with either colorWithWhite:alpha or colorWithRed:green:blue:alpha or it will crash. This is for highlight effects on tapping so the control can derive a darker background when highlighted. Default white: 1, alpha 0.25.

@property (nonatomic, assign) NSUInteger borderWidth;

The border width for item views. Default 2.

@property (nonatomic, weak) id <RNFrostedSidebarDelegate> delegate;

An optional delegate to respond to selection of item views. Optional delegate methods, provided by George Villasboas, include:

- (void)sidebar:(RNFrostedSidebar *)sidebar willShowOnScreenAnimated:(BOOL)animatedYesOrNo;
- (void)sidebar:(RNFrostedSidebar *)sidebar didShowOnScreenAnimated:(BOOL)animatedYesOrNo;
- (void)sidebar:(RNFrostedSidebar *)sidebar willDismissFromScreenAnimated:(BOOL)animatedYesOrNo;
- (void)sidebar:(RNFrostedSidebar *)sidebar didDismissFromScreenAnimated:(BOOL)animatedYesOrNo;
- (void)sidebar:(RNFrostedSidebar *)sidebar didTapItemAtIndex:(NSUInteger)index;
- (void)sidebar:(RNFrostedSidebar *)sidebar didEnable:(BOOL)itemEnabled itemAtIndex:(NSUInteger)index;

Credits

UI Control structure and View Controller containment practices adopted from Matthias Tretter.

Sample icons provided by Pixeden.

The blur algorithm comes from WWDC 2013's session 208, "What's New in iOS User Interface Design".

Apps

If you've used this project in a live app, please let me know! Nothing makes me happier than seeing someone else take my work and go wild with it.

Contact

License

See LICENSE.