Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Swift and setGlobalThemeUsingPrimaryColor #115

Closed
DavidGagne opened this issue Apr 28, 2016 · 13 comments
Closed

Swift and setGlobalThemeUsingPrimaryColor #115

DavidGagne opened this issue Apr 28, 2016 · 13 comments
Labels

Comments

@DavidGagne
Copy link

Is there a way to implement the setGlobalThemeUsingPrimaryColor feature in Swift or is that only available in Obj-C?

@bre7
Copy link
Collaborator

bre7 commented Apr 28, 2016

You can use objc code in swift.

E.g:

Chameleon.setGlobalThemeUsingPrimaryColor(FlatPlum(), withContentStyle: .Light)

@bre7 bre7 added the Question label Apr 28, 2016
@DavidGagne
Copy link
Author

Oh, awesome. And ... Would you drop that into the AppDelegate didFinishLaunchingWithOptions? How can you set it to apply to the entire app?

@bre7
Copy link
Collaborator

bre7 commented Apr 28, 2016

Yeah, you can use the method in didFinishLaunchingWithOptions

@bre7 bre7 closed this as completed Apr 28, 2016
@DavidGagne
Copy link
Author

Using FlatPlum() doesn't work, but when I tried with UIColor.flatSandColor() it does compile.
Thanks!

@bre7
Copy link
Collaborator

bre7 commented Apr 28, 2016

Follow the Installation instructions, FlatPlum() is a shorthand method located in the swift file.

@DavidGagne
Copy link
Author

Ah. I used pod 'ChameleonFramework' instead of pod 'ChameleonFramework/Swift'.

Now the shorthand methods are working.

@bre7
Copy link
Collaborator

bre7 commented Apr 28, 2016

😉

@Dharin-shah
Copy link

Dharin-shah commented Sep 1, 2016

Hey @bre7 I cant seem to be able to call setGlobalThemeUsingPrimaryColor using the viewcontroller's instance (self) in swift. It gives me no function error

@bre7
Copy link
Collaborator

bre7 commented Sep 1, 2016

Hi, just to be sure: have you followed the installation instructions ? Are you able to call FlatPlum() for instance ?

@Dharin-shah
Copy link

Yup, i have been using flat colors for months, i decided to use the theme feature and got this, Although i can set the theme globally however since i have a tab navigation to other view controllers this messes up my ui

@bre7
Copy link
Collaborator

bre7 commented Sep 1, 2016

https://github.com/ViccAlexander/Chameleon#theme-methods

setGlobalThemeUsingPrimaryColor is a static method on Chameleon.
setThemeUsingPrimaryColor is an instance method of UIViewController.

@Dharin-shah
Copy link

Oops oops, I am really sorry for my ignorance, that was stupid. Thank You. Just another question, how do I set the font name but its attribute (i.e bold ,italic) could be inferred from the IB

@bre7
Copy link
Collaborator

bre7 commented Sep 1, 2016

What do you mean ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants