:octocat: AdaptiveController is a 'Progressive Reduction' Swift UI module for adding custom states to Native or Custom iOS UI elements. Swift UI component by @Ramotion

Related tags

Tab Bar swift ios library
Overview

ADAPTIVE TAB BAR

'Progressive Reduction' module for adding custom states to Native or Custom UI elements.


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:


CocoaPods CocoaPods Twitter Travis Donate

Tab Bar After Install

Animation

Tab Bar After Two Weeks

Animation

Tab Bar After a Month

Animation

Overview

AdaptiveController is module for adding custom states to Native or Custom UI elements. The UI elements evolve over time as the user becomes accustomed to them. An example AdaptiveTabBar is provided.

How to import the control to your project

  1. First, drag and drop the AdaptiveController project file into your project or select "add existing file" and choose the AdaptiveController project
  2. Add AdaptiveController to your Target Dependences in the Build Phase of your project.
  3. Add the AdaptiveController framework in Link Binary With Libraries in Build Phases
  4. Import AdaptiveController where needed.

Using AdaptiveController

First, you should set the install date, current date, count of days to transition to small text state, and count of days to transition to big image state. The AdaptiveDateState object automatically determines what UI state to show:

    var installDate = NSDate(dateString:"2014-09-18")
    var adaptiveState = AdaptiveDateState(installDate: installDate, currentDate:NSDate(), countDaysToSmallTextState:countDaysToSmallTextState, countDaysToImageState:countDaysToImageState)

Or count of launches for different state:

    var curentCountLaunches = 6
    var adaptiveState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches, countLaunchesToSmallTextState:5, countLaunchesToImageState:7)

And then you should setup an array of appearances. You should setup button images for each state for each apperance object:

    var buttonsAppearances = buttonsAppearancesGenerate() //func butonsAppearancesGenerate() -> [AdaptiveButtonApperance]

And then you should setup an array of items Appearance object. You should set the button's image for each state for each appearance object.

First, you should setup a dictionary for the extension of the image for each UI state:

    var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle", kImageAdaptiveState:"_bigimage", kSmallTitleAdaptiveState+selected :"_smalltitle", kImageAdaptiveState+selected:"_bigimage" ]

Then you should set the Appearance for each UITabBarItem title for each state, fonts for each state, a default image if you describe an extension for each state, or if you do not describe an extension, you should setup each image for each state.

First, init the appearance object and setup the text for each state. If the text is the same for each state, you can set text for the default state:

    var watchAppearance = AdaptiveButtonAppearance(); 
    watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
    watchAppearance.setButonTitle("watch", state: kSmallTitleAdaptiveState)
    watchAppearance.setButonTitle("", state: kImageAdaptiveState)

Then you should setup your fonts for each state:

    watchAppearance.setButonTitleFontForState(yourDefaultFont, state: kDefaultAdaptiveState)
    watchAppearance.setButonTitleFontForState(yourDefaultSmallTitleModeFont, state: kSmallTitleAdaptiveState)

Then you should set the default image and extensions for each state a function which automaticaly sets images for each state:

    watchAppearance.setImageNamesForStatesImageExtesions("watch", imageExtensionsForState:imageExtensionsForStates)

Then you should setup the appearance insets for each state:

    watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
    watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
    watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
    watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);

Then you should setup сustom UITabBarItems which conform to the AdaptiveButtonsProtocol:

    var arrayButtons = tabBar.items as [AdaptiveTabBarItem]

In your custom tab item, you should implement these methods from the protocol:

    @objc protocol AdaptiveApperanceProtocol {
        optional func setFontToAdaptiveButton(font: UIFont)
        optional func setTitleToAdaptiveButton(text: NSString)
        optional func setImageToAdaptiveButton(image: UIImage?)
        optional func setHighlightedToAdaptiveButton(image: UIImage?)
        optional func setBackgroundImageToAdaptiveButton(image: UIImage?)
        optional func setSelectedImageToAdaptiveButton(image: UIImage?)
        optional func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets)
        optional func setTitleOffsetToAdaptiveButton(offset: UIOffset)
        optional func setTitleColorToAdaptiveButton(titleColor: UIColor)
    }

An example implemetation of a protocol method from our custom tab bar item:

    func setTitleToAdaptiveButton(text: NSString) {
    	self.title = text
	}

Finally, you should init Adaptive State Manager with the objects you've setup:

	AdaptiveButtonsStateManager(state: adaptiveState, buttonsAray:arrayButtons, buttonsAppearance:butonsAppearances)

##Using Custom States For AdaptiveController

Like UITabBar for different custom applications states

We have a default AdaptiveState and with the help of inheritance, we can add new custom states to our state class. The new class in our situation is named AdaptiveDateState

In AdaptiveDateState, we can add new custom states like this:

	let kSmallTitleAdaptiveState = "kImageAdaptiveState"
	let kImageAdaptiveState = "kNormalImageAdaptiveState"

And add methods which decide how the state relates to input parameters:

	var adaptiveState = AdaptiveDateState(installDate: installDate,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)

In AdaptiveDateState, we add custom init methods which decided what states have the Adaptive state object according to the input parameters:

    private func stateRemainDays(remainDays:Int, countDaysToSmallTextState:Int, countDaysToImageState:Int)->String {
        var mode:String = kDefaultAdaptiveState
        print(" DAYS \(remainDays) ")
        if remainDays > countDaysToSmallTextState && remainDays < countDaysToImageState{
            mode = kSmallTitleAdaptiveState
        } else if remainDays > countDaysToImageState {
            mode = kImageAdaptiveState
        }
        print(mode)
        return mode
    }

You can customize different UI components if they adopt to the AdaptiveApperanceProtocol.

πŸ“„ License

Adaptive Tab Bar is released under the MIT license. See LICENSE for details.

This library is a part of a selection of our best UI open-source projects.

If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com

πŸ“± Get the Showroom App for iOS to give it a try

Try this UI component and more like this in our iOS app. Contact us if interested.



You might also like...
πŸ›  WormTabStrip ViewPager for iOS written in Swift, which gives continuous feedback to the user when scrolling
πŸ› WormTabStrip ViewPager for iOS written in Swift, which gives continuous feedback to the user when scrolling

Worm Tab Strip Worm Tab Strip is inspired by android SmartTabStrip, android view pager like library for iOS written in swift. Basically it was build u

A fun, easy-to-use tab bar navigation controller for iOS.
A fun, easy-to-use tab bar navigation controller for iOS.

CircleBar Don’t you, sometimes, miss fun user interfaces? Truth is, we do. Sure, you can't use them in enterprise apps for obvious reasons, but if you

Another UITabBar & UITabBarController (iOS Tab Bar) replacement, but uses Auto Layout for arranging it's views hierarchy.
Another UITabBar & UITabBarController (iOS Tab Bar) replacement, but uses Auto Layout for arranging it's views hierarchy.

GGTabBar GGTabBar is a simple UITabBar & UITabBarController replacement that uses Auto Layout for constructing the GUI. I created it for curiosity, bu

Android PagerTabStrip for iOS.
Android PagerTabStrip for iOS.

XLPagerTabStrip Made with ❀️ by XMARTLABS. Android PagerTabStrip for iOS! πŸ‘‰ Looking for a SwiftUI version? Check out PagerTabStripView, it's fully wr

Customisable iOS bottom menu works like Tabbar
Customisable iOS bottom menu works like Tabbar

SSCustomTabMenu Simple customizable iOS bottom menu works like Tabbar, in Swift. Features Simple and customizable iOS Tab Menu items, in Swift. Requir

Smooth customizable tabs for iOS apps.
Smooth customizable tabs for iOS apps.

SmoothTab Requirements iOS 11.0+ Swift 5.x Xcode 10+ Installation CocoaPods pod 'SmoothTab' How to use Complete screen To setup and customize the comp

iOS Top Tab Navigation
iOS Top Tab Navigation

iOS-Top-Tab-Navigation Good news for all our users out there! Now there are no boundaries to your convenience, you can pass as much words as you want

A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Aesthetic floating tab bar ––– SwiftUI & Combine ⛓️ Importable via Swift Package Manager πŸ“¦
Aesthetic floating tab bar ––– SwiftUI & Combine ⛓️ Importable via Swift Package Manager πŸ“¦

FloatingTabBar An aesthetic floating tab bar made with SwiftUI & Combine importabable via Swift Package Manager πŸ“¦ Based off BottomBar-SwiftUI Preview

Comments
  • Suggestion for usage, not time-based enhancement

    Suggestion for usage, not time-based enhancement

    This is a formal suggestion to allow usage-based, not time-based, progressive enhancement.

    Here's the issue: Lets say someone downloads your app, and only uses it once a month. They still get a ton of value out of that once a month usage, but still, only once a month. Within a month, they will see no menu text, and maybe they've only used it once before.

    If possible, usage based enhancement would be far more indicative of familiarity. I love the idea, but this would be a significant improvement.

    opened by hisnameisjimmy 1
  • Installation on a Framework

    Installation on a Framework

    Hi, I'm trying to install your beautiful component inside an existing framework, using cocoapods. After pod install I've copied AdaptiveController into the project (drag&drop -> copy if necessary) and added AdaptiveController into Target Dependences in the Build Phase of my project. In a framework, I can't add AdaptiveController into Target Dependences in the Build Phase, so I have this -obvious- compile error:

    Framework not found AdaptiveController

    How can I fix this?

    opened by velthune 0
  • Name inconstency

    Name inconstency

    The name of the project is adaptive-tab-bar, but the description says "AdaptiveController is a 'Progressive Reduction' Swift module for adding custom states to Native or Custom iOS UI elements"

    opened by lfarah 0
Owner
Ramotion
UI Engineering, UI/UX Design and Front-End Development Agency
Ramotion
CustomUI in SwiftUI - Full Native Custom SwiftUI NavBar, TabBar, SearchBar, Dark mode, a little bit animations

CustomUI_in_SwiftUI Full Native Custom SwiftUI NavBar, TabBar, SearchBar, Dark m

Alexander Ryakhin 1 Jun 5, 2022
ESTabBarController is a highly customizable TabBarController component, which is inherited from UITabBarController.

ESTabBarController is a highly customizable TabBarController component, which is inherited from UITabBarController. Why? In real-world developmen

Vincent Li 4.9k Jan 5, 2023
A custom tab bar controller for iOS written in Swift 4.2

A custom tab bar controller for iOS written in Swift 4.0 Screenshots Installation Cocoa Pods: pod 'AZTabBar' Swift Package Manager: You can use The Sw

Antonio Zaitoun 335 Dec 11, 2022
A custom tab bar controller for iOS.

ESTabBarController ESTabBarController is a custom tab bar controller for iOS. It has a tab indicator that moves animated along the bar when switching

null 122 Oct 6, 2022
CustomTabBar - A Custom TabBar Built Using Swift

CustomTabBar Thanks to Riccardo Cipolleschi for his awesome tutorial. The TabBar

SM Arif Ahmed 1 Feb 14, 2022
Different Styles of Custom Tab Bar

LightCardTabBar An expiremental project exploring different types of custom-tabbar styles, screenshots as below. Screenshots Implementation The implem

Hussein Ryalat 31 Dec 23, 2022
Custom segmented picker for SwiftUI

Custom segmented picker for SwiftUI

Sergey Kazakov 34 Dec 27, 2022
A prototype of custom tab bar using SwiftUI with techniques of mask + matchedGeometryEffect

SliderTabBar A prototype of custom tab bar using SwiftUI with techniques of mask

Ka Kui 1 Dec 24, 2021
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

ogaclejapan 7k Dec 30, 2022
youtube iOS app template written in swift 5

Youtube iOS Template Youtube iOS Template is developed by Haik Aslanyan and written in Swift 3. Purpose of this repo is to show how ViewControllers ca

Henry Aslanyan 2.5k Jan 4, 2023