Description
Gaikan gives you powerful styling capabilities using a declarative DSL in Swift. Inspired by React: CSS in JS and CSS modules.
Gaikan alternatives and similar libraries
Based on the "UI" category.
Alternatively, view Gaikan alternatives based on common mentions on social networks and blogs.
-
Animated Tab Bar
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
Scrollable-GraphView
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift. -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
SlideMenuControllerSwift
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift. -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
TLYShyNavBar
DISCONTINUED. Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars! -
StarWars.iOS
This component implements transition animation to crumble view-controller into tiny pieces. -
KMNavigationBarTransition
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically. -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
PaperOnboarding
:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion -
CircleMenu
:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion -
RazzleDazzle
A simple keyframe-based animation framework for iOS, written in Swift. Perfect for scrolling app intros.
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Gaikan or a related project?
README
Gaikan gives you powerful styling capabilities using a declarative DSL in Swift. Inspired by React: CSS in JS and CSS modules.
To style UIView(s) just give them a StyleRule
object:
let myLabelStyle = StyleRule() { (inout style: StyleRule) -> () in
style.color = UIColor.redColor()
style.border = Border(width: 1, color: UIColor.greenColor())
style.font = UIFont(name: "Courier", size: 24)
}
self.label.styleInline = myLabelStyle
Check out the sample to see how to well integrate Gaikan into a project.
Features
- Apply a simple style using
styleInline
.... - ... or make theming using
styleClass
(see below for more information). - You can share styles using
extends
method to avoid repeating yourself. - You can style depending on your control state (enabled, highlighted, ...).
- You can style
NSAttributedString
!
Properties
Check out our page on [properties](Doc/Properties.md) to find which one to use to style your views.
Starting with 0.4, we also added VirtualView
. This allow you to apply style effects on some non UIView
attributes/objects:
NSObject | Virtual view | Description | Available since |
---|---|---|---|
UINavigationBar | titleStyle | Sets title navigation bar style | 0.4 |
Advanced usage
NSAttributedString
Just call NSAttributedString(string:"Hello", style: yourStyle)
to get a styled NSAttributedString
.
Alternatively you can use style.textAttributes
to transform StyleRule
into any NSAttributedString
compatible dictionary.
Theme
Theme
packages together multiple Style
definitions to make a whole set.
public class SampleTheme : Theme {
/// Non static is important if you want to reference them from InterfaceBuilder
lazy let logo = Style(...)
lazy let title = Style(...)
}
class CustomView: UIView {
typealias ThemeType = RailTheme
@IBOutlet weak var title: UILabel!
@IBOutlet weak var footnote: UILabel!
@IBOutlet weak var logo: UIImageView!
@IBOutlet weak var button: UIButton!
override func awakeFromNib() {
self.title.styleClass = SampleTheme().logo
self.logo.styleClass = SampleTheme().title
}
}
You can also apply themes right from InterfaceBuilder:
Extends
You can extend your styles to reuse common features:
func primary() -> Style {
return [
.Color: UIColor.greenColor()
]
}
func large() -> Style {
return [
.Font: UIFont.systemFontOfSize(18)
]
}
func merged() -> Style {
return Style().extends(primary(), large())
// color: green, font: 18
}
States
You can define styles for states. They'll extend from the default state :
func style() -> Style {
return Style() { (inout style: StyleRule) -> Void in
style.tintColor = UIColor.whiteColor()
}
.state(.Selected, attributes: [
.TintColor: UIColor.grayColor().colorWithAlphaComponent(0.6)
]
}
Don't hesitate to take a look at the sample to better understand how it works.
Contributing
This project was first developed by Xebia IT Architects in Paris, France. We will continue working and investing on it.
We encourage the community to contribute to the project by opening tickets and/or pull requests. Here a some of the subjects we are interested in:
- Add UIStackView attributes (distribution, spacing, ...).
- Support for multiple layout engines (AutoLayout, LayoutKit, Flexbox, ...)
- Allow to define 1+ borders and corner radius. Currently defining border and radius set the 4 of them (top, bottom, left, right).
- Better support for IBDesignable (if possible).
- Add debugging information (style name, inheritance, ...).
- Better integration with NSAttributedString.
- Support for traits.
- Anything you have in mind!
License
Gaikan is released under the MIT License. Please see the LICENSE file for details.
*Note that all licence references and agreements mentioned in the Gaikan README section above
are relevant to that project's source code only.