Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Getter for variables #1

Closed
popcorno opened this Issue · 1 comment

2 participants

@popcorno

// I want to be able to get the value of variables.

// Create json file.
{
"Variables": {
"defaultBackgroundColor": "red"
},

"@Controllers": {
    "MyViewController": {
        "UITableView": {
            "backgroundColor": "$defaultBackgroundColor"
        }
    },   
}

}

// UISS init. And appearance is work.
UISS *uiss = [UISS configureWithDefaultJSONFile];
[UISS setSharedUISS:uiss];

// But sometimes I need write code
@implementation MyView

  • (void)drawRect:(CGRect)rect {
    UIColor *color = [[UISS sharedUISS] colorForVariable:@"defaultBackgroundColor"];

    UIBezierPath* bezier = [UIBezierPath bezierPath];
    // ... my bezier code
    [color setFill];
    [bezier fill];
    }

@end

// Other UISS methods

  • (id)valueForVariable:(NSString *)name;
  • (UIColor *)colorForVariable:(NSString *)name;
  • (UIFont *)fontForVariable:(NSString *)name;
  • (UIImage *)imageForVariable:(NSString *)name;
@robertwijas
Owner

You can achieve this by adding UIAppearance property to your class.
Here is an example: https://github.com/robertwijas/UISS/blob/master/Project/UISSDemo/Classes/UISSCustomView.h.

@robertwijas robertwijas was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.