Migrating of AKFTheme AccountKit Facabook iOS

Simple AKFTheme solution for AccountKit newest SDK Facebook
The following code illustrates the the differences between the old customization and the new customization.
// old:
viewController.theme = [AKFTheme themeWithPrimaryColor:primaryColor
                                      primaryTextColor:primaryTextColor
                                      secondaryColor:secondaryColor
                                      secondaryTextColor:secondaryTextColor
                                      statusBarStyle:statusBarStyle];
viewController.theme.backgroundImage = bgImage;
viewController.theme.backgroundColor = bgColor;
...

// new:
viewController.uiManager = [[AKFSkinManager alloc]
                            initWithSkinType:AKFSkinTypeClassic
                            primaryColor:primaryColor
                            backgroundImage:bgImage
                            backgroundTint:AKFBackgroundTintWhite
                            tintIntensity:tintIntensity];

If you have specified an Advanced UI manager or specified multiple colors, check out below code.


import AccountKit

class FBUIManager: NSObject, AKFUIManager{
      
     func theme() -> AKFTheme? {
        
        let theme = AKFTheme(primaryColor: UIColor.white, 
                         primaryTextColor: UIColor.gray, 
                           secondaryColor: UIColor.blue, 
                       secondaryTextColor: UIColor.black,
                           statusBarStyle: .lightContent)
        
        theme.headerTextColor = UIColor.white
        theme.headerButtonTextColor = UIColor.blue
        theme.inputTextColor = UIColor.black
        theme.inputBorderColor = UIColor.gray
        theme.titleColor = UIColor.gray
        theme.textColor = UIColor.black
        theme.iconColor = UIColor.blue

        theme.headerTextType = .login
        
        theme.buttonTextColor = UIColor.white
        theme.buttonDisabledTextColor = UIColor.clear
        theme.buttonDisabledBackgroundColor = UIColor.clear
        theme.buttonDisabledBorderColor = UIColor.clear
        theme.buttonBackgroundColor = UIColor.gray
        theme.buttonBorderColor = UIColor.gray
        
        return theme
    }
}

Controller:

var loginViewController : AKFViewController 
loginViewController.uiManager = FBUIManager()

Comments

Popular Posts