GithubHelp home page GithubHelp logo

tolo / interfacss Goto Github PK

View Code? Open in Web Editor NEW
96.0 6.0 10.0 14.21 MB

The CSS-inspired styling and layout framework for iOS

License: MIT License

Objective-C 98.09% CSS 1.78% Ruby 0.14%
ios uikit ui styling stylesheet stylesheets theming objective-c css layout

interfacss's Introduction

InterfaCSS

Update: The work with a new and improved version of InterfaCSS is underway in the develop branch... ๐Ÿ˜ The latest version (Beta2) adds support for XML-based layout using Flexbox (powered by Facebook Yoga)!

Build Status

Everyone loves a beautifully designed app with a consistent UI, and getting there shouldn't take a huge effort. What if there was a way to do styling, theming and layout in a concise and powerful way, without constantly having to repeat yourself. What if things could be more like the web?

Welcome to InterfaCSS

Simple yet powerful styling

InterfaCSS uses an easy to understand styling syntax that is based on the the familiar CSS styling language used on the web (augmented with some Sass/Less-like features, such as nested declarations and variables), which means that you (and your designer) will probably feel right at home. InterfaCSS supports a rich selector syntax (type, class and element id selectors, selector combinators, pseudo classes, etc) and property names are what you expect them to be - i.e. the same as in UIKit, and you can set things like fonts, colors, images, transform, insets, offsets, rects, enums and much, much more.

#helloWorldButton {
  attributedText: "Hello " (foregroundColor: yellow), "World" (foregroundColor: #0000ff);
  backgroundColor: "patternImageAsColor.png";
  borderWidth: 3;
  borderColor: fadeout(magenta, 75%);
  cornerRadius: @numberVariable;
  clipsToBounds: YES;
  layout: size(100, 21), left(parent + 10), top(guide.top + 100);
  transform: rotate(15);
}

InterfaCSS can get you DRY

We all hate to duplicate code, so why should styling be any different? Sure, UIAppearance provides some help, but would you still want to write (and read) things like this:

[[UIButton appearanceWhenContainedIn:UITableViewCell.class, nil] setTitleColor:
    [UIColor colorWithRed:255 green:109 blue:16 alpha:1] forState:UIControlStateSelected];

when you instead can write it like this:

UITableViewCell UIButton {
    titleColor(selected): #ff6d10;
}

/* Or what if you actually needed a bit more fine-grained control: */
BraveNewViewController UITableViewCell UIButton.mySpecialButton {
    titleColor(selected): #ff6d10;
}

Flexible layouts, the easy way

InterfaCSS lets you define layouts based on values that depend on the position and size of other elements. Layouts are expressed directly in the stylesheet file, and the format is very easy to understand.

#view1 {
    layout: size(25, 25), left(parent.leftMargin), top(parent.topMargin);
}

#view2 {
    layout: size(view1, view1), left(view1.right + 10), top(view1.top);
}

In addition, using a view builder, setting up the UI in your view controllers is a breeze - gone are the days of writing tedious UI setup code or fiddling with unwieldy xib-files (but you can still use them just fine with InterfaCSS if you want of course) - simply define your UI in an XML file or do it in code, by using ISSViewBuilder.

XML:

<view id="rootView">
    <view id="view1"/>
    <view id="view2" layout="size(view1, view1), left(view1.right + 10), top(view1.top)"/> <!-- It's possible to define layouts here as well -->
</view>

In code (Swift):

self.view = ISSViewBuilder.rootViewWithId("rootView", withOwner: self, andSubViews: {
    return [
        ISSViewBuilder.viewWithId("view1"),
        ISSViewBuilder.viewWithId("view2"),
    ];
})

Style as you go

Styling isn't something you just do at startup of course - you can easily modify the styling any time by using methods defined in the category UIView+InterfaCSS.h, for example:

self.view.styleClassISS = @"groovyStyle anotherGroovyStyle"; // Supports multiple style classes separated by whitespace - TIP: This property is also IBInspectable
self.view.elementIdISS = @"groovyElement"; // To uniquely style a specific element
[self.view addStyleClassISS:@"anEvenMoreGroovyStyle"];
[self.view removeStyleClassISS:@"anEvenMoreGroovyStyle"];

Read more about how styling is applied on the Using InterfaCSS wiki page.

Stylesheets

For larger apps, it's usually a good idea to split up the styles on different stylesheet files - perhaps you want one for variables, one for common styles, and several stylesheets for different parts of the application for instance. You can also attach a scope when loading stylesheet (version 1.1), to make sure the styles it in are only processed for views under a particular view controller (for instance).

ISSStyleSheetScope* scope = [ISSStyleSheetScope scopeWithViewControllerClass:BraveNewViewController.class];
[[InterfaCSS sharedInstance] loadStyleSheetFromMainBundleFile:@"stylesForOnePartOfTheApp.css" withScope:scope];

Hot deployment of your stylesheets (for development)

To make development simpler and faster, try using an auto-refreshable stylesheet (in addition to your standard stylesheets) - load an auto-refreshable stylesheet from a (file/web) URL, launch your app on a device or in the sim, and watch how the UI updates itself before your very eyes, without having to wait for those frustrating compile/deploy/launch/returnToWhereYouWere-cycles. Note though that this feature is only intended for use during development. Checkout the snippet below for an example on how you add refreshable stylesheets (in your app delegate for instance). Also, checkout the properties stylesheetAutoRefreshInterval and processRefreshableStylesheetsLast in InterfaCSS, for more control over how refreshable stylesheets are managed.

/* For local (simulator) use, you can for instance load the actual css file used in your project as an auto-refreshable stylesheet: */
[[InterfaCSS sharedInstance] loadRefreshableStyleSheetFromLocalFile:@"/Users/username/myCoolXcodeProject/myDazzlingStyles.css"];
/* Or if you want to be able to run on a device, you can for instance simply upload the file to your cloud provider of choice: */
[[InterfaCSS sharedInstance] loadRefreshableStyleSheetFromURL:
   [NSURL URLWithString:@"http://www.mygroovycloudprovider.com/user/directory/mymyDazzlingStyles.css"]];

Getting started

Install

You can add InterfaCSS to your project in two ways:

  • The simplest way is to use CocoaPods.

  • Download the source and add the files in the InterfaCSS directory to your project.

Sample code

Checking out the sample code is a good way to get a feel for how InterfaCSS is used in an app. To run the sample code, do like this:

  • Run pod install in the Samples/SimpleSample directory.
  • Open SimpleSample.xcworkspace.
  • Build and run.

Setup InterfaCSS in your app

  • Load a stylesheet, like this: [[InterfaCSS sharedInstance] loadStyleSheetFromMainBundleFile:@"myDazzlingStyles.css"];. A good place to do this is in your app delegate, when your app is first launched, but if you have a lot of stylesheets it's better to defer loading of the stylesheets to when you actually need them (loadView of a particular view controller might be a better place in this case).

  • Start adding styles. As with most new things, it's best to start small. For instance, don't start with adding crazily complex selectors like UIView + UITableView:nthoftype(5n+1) UITableViewCell:odd .class1 > .class2:landscape.

  • Set up your view hierarchy and set some initial styles classes on your views. Check out the Using InterfaCSS page on the wiki for more details.

  • Update styles as you go - use the methods provided in UIView+InterfaCSS.h and UIView+InterfaCSS.h to control the styling of your views.

  • If you get stuck and starting feel the urge to break something, consider doing this first:

    • Try using -[InterfaCSS logMatchingStyleDeclarationsForUIElement:] to log the active style declarations for your view, and see if they are whay you expect them to be.

    • Enable more verbose logging by invoking [NSObject iss_setLogLevel:ISS_LOG_LEVEL_TRACE]; defined in NSObject+ISSLogSupport.h

Project status and background

Status

With the release of 1.0, InterfaCSS had finally reached the point where the most important stuff was there, and version 1.1 added a bunch of new handy features and fixes, to make InterfaCSS even more complete. But the work with refining the feature set, improving documentation and perfecting unit tests will of course continue. Also, work on a version 2.0 is currently in progress - this version will among other things focus on modularization and simplification.

And as always - all feedback is most welcome!

Background

InterfaCSS emerged out of frustration with the shortcomings of the available Interface Building tools, one of the most important being the constant need to repeat yourself when it comes to styling of user interface elements. There had to be a better way.

And out of that notion sprung the foundation of InterfaCSS, which after a spending a longish time fermenting in dark corners of various applications, finally has made a public appearance. During it's evolution into an open source project, other similar projects have popped up, although InterfaCSS still differs from most of them:

  • Property names are what you expect them to be and the list of supported properties is extensive
  • Powerful stylesheet syntax (selector chains, selector combinators, pseudo classes, nested declarations) that is based on the familiar CSS language used for the web
  • InterfaCSS is not just for styling - it helps you with view setup and layout as well

Apps using InterfaCSS

License

MIT license - see here.

interfacss's People

Contributors

chh51 avatar tbrannam avatar tolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

interfacss's Issues

Styling for NSAttributedString

It would be great if there was a way to style an NSAttributedString somehow. I know this might be a bit out of scope of this project, but I would love to be able to style a string I have in code with styles in stylesheet.css.

For example the text might look like:

<span class="bold">Some bold text</span> and some regular. and would result in

Some bold text and some regular.

Subclasses UITableViewCells don't receive reuse identifier, and are not reused

The ISSViewHierarchyParser treats subclasses of UITableViewCell as a custom view type, and therefore does not call the designated initializer -initWithStyle:reuseIdentifier: -- as a side effect - the UITableView's dequeueReusableCellWithIdentifier: is not able to recycled Subclassed UITableViewCells.

The Sample's PrototypeExampleCell exhibits this behavior.

UICollectionViewLayout style

Do you have an idea on how you'd like to see describing the style for a UICollectionViewFlowLayout? Or the ability to specify a concrete instance of an alternative layout?

It would be great to allow configuration of the default, but it would also be nice to be able to pass properties to the layout to allow it to be configured as well. Consider both UICollectionViewFlowLayout and the more generic UICollectionViewLayout. The later will likely require a much more flexible definition of properties.

Feature: Remote images

When parsing styles, it would be good to have a way to delegate the loading of images.

Specifically - I'm thinking about allowing remote images to be specified in the image style markup. This likely has implications for layout or layout managers.

Crash in ISSelector in v1.4

Hi!

I was using the latest master branch at v1.4 but it throws an exception in ISSelector.m when I'm dealing with textfields.
This does not happen in v1.3.2.
screen shot 2016-01-25 at 10 28 06

Aspect Ratio of Frame

Have you given thought on how to size a frame to maintain an aspect ratio of height vs width?

Example, you want a square view within a resizable parent frame.

example for custom property

Can you document the usage pattern around

- (ISSPropertyDefinition*) registerCustomProperty:(NSString*)propertyName propertyType:(ISSPropertyType)propertyType;

It looks like what I might need for supporting custom view attributes. It looks like it's parsing the attributes, but I don't understand how I am meant to register a setterBlock

Keep x and y values

Would be cool if you could set a frame or layout and tell it to keep its x and y value. Something like:

.offerRowView {
    frame: rect(current, current, 30, 100%);
}

Extendable ISSPseudoClass

I'm finding times when I'd like to style parts of a UIControl that aren't covered by the normal UIControlState values.

I'm playing with extending PseudoClasses, adding selected and highlighted. This allows me to change a wider number of style-able properties based on the state of the control.

    case ISSPseudoClassTypeControlStateSelected: return @"selected";
    case ISSPseudoClassTypeControlStateHighlighted: return @"highlighted";
    // similar treatment as enabled/disabled
    case ISSPseudoClassTypeStateEnabled: return @"enabled";
    case ISSPseudoClassTypeStateDisabled: return @"disabled";

I could see the being part of the default set of PseudoClasses - but it perhaps this is really a feature request for supporting an extensible ISSPseudoClass implementation?

Containing Styles

It would be good to enable a viewcontroller to namespace a stylesheet. I want to be able to ensure that styles associated with a stylesheet are not leaked into another viewcontroller.

I am setting my code up such that a viewcontroller load's and retains it's own stylesheet - and removes it when the viewcontroller is deallocated. I sometimes find that naming conventions of style classes in similar but different views sometime will cause styles to leak into another view's viewcontroller.

In a simple application global styles are nice, but as an application grows I think that being able to support some kind of non-global stylesheet would be helpful.

I think the web analog would be an iframe - but that's not exactly the same, as I'd expect global styles to still be inherited.

So perhaps if a stylesheet could be modified after being loaded, and all the selectors chains could be modified in be scoped inside a generated classname selector. And the viewcontroller could assign this classname to the ViewController.view.

[ISSViewBuilder switchWithId:] returns UIStepper

Hi,

This returns a UIStepper, not a UiSwitch :)

+ (UISwitch*) switchWithId:(NSString*)elementId {
    return [self setupView:[[UIStepper alloc] init] withId:elementId andStyleClass:nil];
}
+ (UISwitch*) switchWithStyle:(NSString*)styleClass {
    return [self setupView:[[UIStepper alloc] init] withStyleClass:styleClass];
}

Running version 1.5.

AutoLayout Support

@tolo Really fantastic work with this!

I noticed AutoLayout support is something that hasn't been implemented yet. Just wanted to hear your thoughts on why you chose to go with absolution positioning over AutoLayout (not that it was a bad choice). Is AutoLayout a direction you think this may take in the future?

This also ties in a bit to supporting multiple devices... I imagine in order to support multiple devices (or orientations) we'll either have to a) write additional layout code or b) create a separate CSS file. Usually different orientations have different layouts anyways so a separate file may not be a bad thing.

Prototype views seem to have a global namespace

On IOS UITableview and UICollectionView both seem to have a reuseIdentifier registry specific to the instance.

I would think that ISSViewHierarchParser should not call [[InterfaCSS interfaCSS] registerPrototype:currentPrototype]; but instead call UITableView/UICollectionView registerClass:reuseIdentifier:

I think there are still issues related to issue #7 which may require something more dynamic.

topLayoutGuide

Actual InterfaCSS question

Have you considered representing the top and bottom layout guide into the CSS styling?

I've noticed that embedding the PrototypeExampleViewController in a UINavigationController results in a clipped main title. This can be addressed by removing the Extend Edges under top bar, but it would be nice to be able to adjust the top or bottom margins to allow the current root view to add color under the navigation bar and/or tab bar.

Databinding

I am working on some ideas around data-binding of UI elements to models. I suspect that it will need some additional properties that are parsed from XML.

Similar to how AppKit on Mac supports data binding.

It might be helpful to include a parse delegate that can be consulted for the purpose of extending the parse model.

Or do you think this might be an area of interest in the core of InterfaCSS?

Stylesheet parser - multithreaded

I see that a singleton Stylesheet parser is kept by InterfaCSS - do you think it would be thread safe to create another instance if the Parser to parse data in a worker thread? I think the only thing lost in this case would be CSS constant definitions (@stuff: "stuff").

Clearly the UIView styling passes need to be in the UI thread - but do you think the parsing, factory stuff could be threaded safely?

Question & Feature Request: Using system font (iOS)

Environment: iOS 12.1.* , Xcode 10.1

Question: How do I use the iOS system font in the .css file reference font: ...;?

San Francisco font is the default iOS font. It is not accessible via name reference and needs to be installed as a resource to use and reference. This is not convenient and feels a little over the top to simply reference the default system font with a weight and size.

Normally a reference to the font name like font: AvenirNext-Regular 15 would be how to set the font for a label. However, using font: System-Regular 15 or font: SystemFont-Regular 15 returns the following error message:

InterfaCSS: ISSPropertyDeclaration[font] - Unable to set value on <UILabel...

This also causes a crash on attributed strings as the font is nil which is not permitted in arrays or dictionaries.

Two feature requests:

  1. There is an unknown property resolution in place for UIColor. Consider implementing a resolution for ISSPropertyDeclaration[font] - Unable to set value ... by returning the system font with passed in parameters of size and weight. Example:

if (!font) { return [UIFont systemFontOfSize:size weight:weight]; }

  1. Open up setting of the font size and font weight without declaring the font name Example:

/* fontName: FontName; (string) */ fontWeight: bold; // (enum) fontSize: 17; // (integer)

Any assistance in the interim would be greatly appreciated.

pseudo classes

I'd propose supporting pseudo classes that allow styling on device form factor.
as a minimum "phone". "tablet" -

I could see perhaps following the pattern of size-classes instead (width-compact, width-any, width-regular, height-compact, height-any, height-regular)?

It might also be helpful if the Pseudo Class Parse supported multiple Pseudo Classes in a style definition - or is there another way to express this already?

.simple:phone:landscape{
    backgroundColor: red;
}

.simple:phone:portrait{
    backgroundColor: blue;
}

.simple:tablet:portrait{
    backgroundColor: pink;
}
.simple:tablet:landscape{
    backgroundColor: green;
}

How to use division in stylesheet layouts

I want to use a division operator in my layout statement in a .css file,

#sbButtonLR {
  layout:           size( sbRoot.width/3, @buttonHeight ),right( parent.width -10 ), bottom( sbGuide.bottom );
}

Subtraction works fine, but not clear how to multiply or divide

#sbButtonUR {
  layout:           size( sbRoot.width-200, @buttonHeight ),right( parent.width -10 ), top( sbGuide.top );
}

For a working example of this bug see the sample program InterfaCSS-Example on GitHub.

UITextInputTraits' properties cannot be set using KVC

I'm getting errors when I try to set for example keyboardType (or other UITextInputTraits properties) from stylesheet. The error is that the UITextInput is not coding-compliant with the property's name (e.g. keyboardType). Is this a problem when using InterfaCSS with Swift or a bug even in ObjC?

Font names with spaces parse incorrectly

It appears that font names which contain spaces can not be specified in style. Adding quotes did not seem to help --- name is parsed as first token in font name

font: Times New Roman, 24

nor does an it help to use a constant

@timenewroman: Times New Roman;
 font: @timenewroman, 24

override or extend registered properties

I have been trying to extend some properties to support UIControlState (tintColor) for a custom control. But it appears that a duplicate custom property does not get called - it would be great if custom properties would get called - ideally with the setter block for the original implementation - so that the original implementation could get called in the event that the override's special doesn't have to reimplement the original version.

Option to hide the status bar in FCOverlayViewController request

In my presented view controllers I am hiding the status bar by returning YES from prefersStatusBarHidden. But FCOverlayViewController defaults to showing the status bar causing a 'jump' as the status bar hides itself and the presented view expands to fill the area.

Adding the following to FCOverlayViewController.m won't work because at the point it is called self.presentedViewController is nil.

- (BOOL)prefersStatusBarHidden
{
    return [self.presentedViewController prefersStatusBarHidden];
}

It seems the only way to support this would be add an extra parameter to presentOverlayWithViewController:windowLevel:animated:queued:completion: in FCOverlay.m and implement it in FCOverlayViewController.m too.

What are you thoughts on this?

Support for calc function.

It would be nice if we could do some calculations in the stylesheet. For example I have a constant called @gridStep and I would like to do something like cornerRadius: calc(@gridStep * 2);. Currently I could not find a way to do this in ISS. Is it possible? Or would that feature be possible to add? Thanks.

Custom Enumerated Property definition

While it is easy to support custom string properties by way of registerCustomProperty, it seems less clear how to support custom properties with enumerated types - as the implementation to create these is private and the the returned ISSPropertyDefinition consists of readonly fields. should these be promoted to a public interface? Should registerCustomProperty have a implementation that accepts a ISSPropertyDescription?

// Private initializer
- (id) initWithName:(NSString *)name aliases:(NSArray*)aliases type:(ISSPropertyType)type enumBlock:(NSDictionary*)enumValues enumBitMaskType:(BOOL)enumBitMaskType;

Using custom types as selectors.

In Classy (which we used until now) you can use a custom view name as a selector. As we have a lot of custom views (deriving from UIView), it is a pain to a class name every where. Would this feature be possible?

guide layout parameter - used but not well documented

In the HelloISSLayout example file layout.css has entry

#layoutGuideLabel {
    layout: top(guide.top + 1), centerX(parent); 
}  

I could not find anything in the Wiki that discussed guide. Is there also a guide.left, guide,right, guide.center ?

Huge amount of memory used

I have quite a large stylesheet file (2048 lines) and I found out that InterfaCSS takes awful lot of RAM. I run profiling and found out that InterfaCSS keeps allocated about 260MB of RAM. Most of the trace seems to be in [Parcoa parse].

Is this normal? And is it because of the large file? Even if I split it to multiple CSS files, I will still need to load them sooner or later and will get the memory usage that high again.

Any ideas?

layout options

I see that there's a pattern of using fixed or relative sizing - do you see it to be a valid use case to support auto sized labels (perhaps with a min/max size) - perhaps allowing easier integration of dynamic type?

Additionally - do you think having a block like layout would be useful?

TabBarItem in XML

Attempting to create a styled tabBarItem in xml, results in UIView being allocated and assigned to filesowner.tabBarItem - I suspect a similar situation might occur for navigationItem

<?xml version="1.0" encoding="UTF-8"?>
<view class="root">
    <tabbaritem property="tabBarItem" class="foo" add="NO"/>
</view>

Gradient UI color doesn't support named colors

UIColor - the wiki suggests that gradient can not be nested with other color functions, but I expected that named colors were treated as values, not functions. The gradient parser does not get called when passing named colors.

Fails
gradient(white, black)
Succeeds
gradient(rgb(255,255,255),rgb(0,0,0))

Expose NSAttributedString Parser

ISSParcoaStyleSheetParser's attributedString parser is handy. It would be nice to be able to use the attributed string format used the style sheets for non-style sheet delivered data.

Can parsePropertyValue:ofType: be a public method, or exposed some other way?

ISSParcoaStyleSheetParser *parser = [[InterfaCSS sharedInstance] parser];
NSAttributedString *attribuedString = [parser parsePropertyValue:@"\"Simple\" (foregroundColor: red), \" Sample \" (foregroundColor: #3f3f3f), \"Main\" (foregroundColor: #ab45ec)" ofType:ISSPropertyTypeAttributedString];
label.attributedText = attribuedString;

UICollectionViewCell cannot be targeted as a descendant/child and doesn't get styled properly.

I don't seem to get working this:

UICollectionViewCell {
    someProperty: value;
}

UIView.main {
    UICollectionViewCell {
        someProperty: otherValue;
    }
}

When doing this, the style does not get applied and also I need to call UIView#scheduleApplyStylingISS myself in the dequeue method of delegate. Is this a bug or something that cannot be fixed? Or is it something with my code?

PS: Applies to UITableView as well.

iOS8+ orientation issues

in the current SimpleSample example, the implementation used the methods

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

both of these are marked as deprecated in iOS8. InterfaCSS seems to depend on a trigger to restyle the views after rotation occurs (example shows the call being made in didRotateFromInterfaceOrienation)

Is there a suggested pattern to follow to ensure that styles are kept up to date in iOS8 or higher targets?

Imposible to use in extension target

When using InterfaCSS in a extension target, build fails:
Implementation often relies on UIApplication, and +sharedApplication and other methods got attribute NS_EXTENSION_UNAVAILABLE_IOS

Slow loading time iOS 8.4

Hey!

I'm experiencing some latency loading css with an iPhone 5.

`[[InterfaCSS interfaCSS] loadStyleSheetFromMainBundleFile:css];``

"Loaded stylesheet 'main.css' in 2.489952 seconds"

Is there any way to optimise it?

Variable declaration in 1.4

Whitespace after variable name causes error:
@stdColor1 : #356b91; -> Unrecognized property variable
@stdColor1: #356b91; -> No error

Support for RGBA hex string

Hi,

First of all, great library :)

I realised that there is no support for RGBA hex string although, with the following code it should be easy to support it.

+ (UIColor*) iss_colorWithHexString:(NSString*)hex {
    hex = [hex iss_trim];
    if ( hex.length == 6 ) {
        NSScanner* scanner = [NSScanner scannerWithString:hex];
        unsigned int cc = 0;

        if( [scanner scanHexInt:&cc] ) {
            NSInteger r = (cc >> 16) & 0xFF;
            NSInteger g = (cc >> 8) & 0xFF;
            NSInteger b = cc & 0xFF;
            return [self iss_colorWithR:r G:g B:b];
        }
    } else if ( hex.length == 8 ) {
        NSScanner* scanner = [NSScanner scannerWithString:hex];
        unsigned int cc = 0;

        if( [scanner scanHexInt:&cc] ) {
            NSInteger r = (cc >> 24) & 0xFF;
            NSInteger g = (cc >> 16) & 0xFF;
            NSInteger b = (cc >> 8)  & 0xFF;
            NSInteger a = cc & 0xFF;
            return [self iss_colorWithR:r G:g B:b A:a];
        }
    }
    return [UIColor magentaColor];
}

Could you integrate it into the master branch or do you want me to raise a pull request ?

BR,

Support for UIStoryboardSegue

Hi,

Is it possible to use an UIStoryboardSegue from a UIButton in Storyboard? It seems that InterfaCSS blocks my segue.
Code:

-(void)loadView
{
    [super loadView];
    self.view = [ISSViewBuilder rootViewWithStyle:@"sliderMainView" andSubViews:^NSArray *{
        return @[self.okBtn = [ISSViewBuilder buttonWithId:@"onboardingOkButton"]];
    }];


}

tvOS configuration

Apple added a few wrinkles to UIKit in the tvOS variation. Do you have a style preference for how to remove unsupported methods? Ifdef's - stub classes? macros?

I'll likely be sending a pull request in the next couple days with some of these edits as I get the rest of my project working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.