19 Commits

Author SHA1 Message Date
Artem Kislitsyn ba3bff40b9 clean code 2014-11-21 18:50:08 +03:00
Artem Kislitsyn e05ef556e5 fix stryboard 2014-11-20 15:55:51 +03:00
Artem Kislitsyn 17402d0428 fix readme 2014-11-20 15:51:12 +03:00
Artem Kislitsyn 503cde01a7 clean project 2014-11-20 15:31:59 +03:00
Artem Kislitsyn 21fc1772fb fix tests 2014-11-17 14:17:22 +03:00
Artem Kislitsyn 3d1a827e9e rewrite tests 2014-11-17 13:17:10 +03:00
Artem Kislitsyn db30943244 readme update 2014-11-16 23:30:14 +03:00
Artem Kislitsyn 4ab0a82143 fix bugs 2014-11-15 14:26:30 +03:00
Artem Kislitsyn e6f87041b0 add setting manager 2014-11-14 18:14:55 +03:00
Artem Kislitsyn 0feda491a2 fixes 2014-11-13 19:45:19 +03:00
Artem Kislitsyn 1103152e0d setup app delegate 2014-11-13 18:08:25 +03:00
Artem Kislitsyn d4e90e990c fix dictionary serializtion 2014-11-13 16:18:09 +03:00
Artem Kislitsyn 85ebb07599 minor 2014-11-13 15:29:12 +03:00
Artem Kislitsyn 9ffa4f0cb8 minor 2014-11-13 15:08:56 +03:00
Artem Kislitsyn 45c2406fbb clean cache 2014-11-13 14:35:12 +03:00
Artem Kislitsyn 700f98effe refactor 2014-11-13 14:34:09 +03:00
Artem Kislitsyn 3e56028ea4 refactor 2014-11-12 19:13:44 +03:00
Artem Kislitsyn dec3d91e42 refactor 2014-11-11 19:33:38 +03:00
Artem Kislitsyn c7c1acc741 refactor 2014-11-11 13:54:52 +03:00
33 changed files with 912 additions and 788 deletions
-6
View File
@@ -1,6 +0,0 @@
language: objective-c
script: "rake test:ios"
#xcode_project: AdaptiveController/AdaptiveController.xcodeproj # path to your xcodeproj folder
#xcode_scheme: AdaptiveController
#xcode_project: AdaptiveController/AdaptiveController.xcodeproj # path to your xcodeproj folder
#xcode_scheme: AdaptiveControllerTests
@@ -17,10 +17,10 @@
6AAE857819D329C6005672CA /* AdaptiveButtonsStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857419D329C6005672CA /* AdaptiveButtonsStateManager.swift */; };
6AAE857919D329C6005672CA /* AdaptiveDateState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857519D329C6005672CA /* AdaptiveDateState.swift */; };
6AAE857A19D329C6005672CA /* AdaptiveState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857619D329C6005672CA /* AdaptiveState.swift */; };
6ACDAABA1A1508BA0027A658 /* AppearenceSettingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ACDAAB91A1508BA0027A658 /* AppearenceSettingManager.swift */; };
6AD1EC2619EFA9BA003F36A4 /* ControlStateValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD1EC2519EFA9BA003F36A4 /* ControlStateValue.swift */; };
6AD1EC2919EFB8E2003F36A4 /* ControlStateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD1EC2819EFB8E2003F36A4 /* ControlStateProtocol.swift */; };
6AD1EC2B19F1165E003F36A4 /* TestTabBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD1EC2A19F1165E003F36A4 /* TestTabBarItem.swift */; };
6AD4002719F7896900630034 /* ButtonStateAppearanceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002619F7896900630034 /* ButtonStateAppearanceProtocol.swift */; };
6AD4002919F792FA00630034 /* ControlStateAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002819F792FA00630034 /* ControlStateAppearance.swift */; };
6AD4002B19F7A0B800630034 /* AppearanceSerializationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002A19F7A0B800630034 /* AppearanceSerializationProtocol.swift */; };
6AE723351A04EE6F003416B6 /* ControlStateAppearanceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AE723341A04EE6F003416B6 /* ControlStateAppearanceTest.swift */; };
@@ -29,13 +29,14 @@
6AE7233A1A04F7B4003416B6 /* AdaptiveButtonsStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857419D329C6005672CA /* AdaptiveButtonsStateManager.swift */; };
6AE7233B1A04F7B6003416B6 /* AdaptiveButtonAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857319D329C6005672CA /* AdaptiveButtonAppearance.swift */; };
6AE7233C1A04F7BA003416B6 /* ControlStateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD1EC2819EFB8E2003F36A4 /* ControlStateProtocol.swift */; };
6AE7233D1A04F7BD003416B6 /* ButtonStateAppearanceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002619F7896900630034 /* ButtonStateAppearanceProtocol.swift */; };
6AE7233E1A04F7BF003416B6 /* AppearanceSerializationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002A19F7A0B800630034 /* AppearanceSerializationProtocol.swift */; };
6AE7233F1A04F7C3003416B6 /* ControlStateValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD1EC2519EFA9BA003F36A4 /* ControlStateValue.swift */; };
6AE723401A04F7E5003416B6 /* AdaptiveState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AAE857619D329C6005672CA /* AdaptiveState.swift */; };
6AE723411A04F7ED003416B6 /* ControlStateAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AD4002819F792FA00630034 /* ControlStateAppearance.swift */; };
6AE723431A078071003416B6 /* ColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AE723421A078071003416B6 /* ColorExtension.swift */; };
6AE723451A07C8E1003416B6 /* AdaptiveButtonAppearanceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AE723441A07C8E1003416B6 /* AdaptiveButtonAppearanceTest.swift */; };
6AF450671A10F99A00AC30A4 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AF450661A10F99A00AC30A4 /* Constants.swift */; };
6AFB70291A19F53E00221E66 /* AppearenceSettingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ACDAAB91A1508BA0027A658 /* AppearenceSettingManager.swift */; };
6AFB702A1A19F54C00221E66 /* DictioanarySerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A156E3D1A08B38E002A69AD /* DictioanarySerializer.swift */; };
6AFBC6D719D313D600D42578 /* AdaptiveController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6AFBC6D619D313D600D42578 /* AdaptiveController.h */; settings = {ATTRIBUTES = (Public, ); }; };
6AFBC6E119D313D600D42578 /* AdaptiveControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AFBC6E019D313D600D42578 /* AdaptiveControllerTests.swift */; };
/* End PBXBuildFile section */
@@ -51,15 +52,15 @@
6AAE857419D329C6005672CA /* AdaptiveButtonsStateManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdaptiveButtonsStateManager.swift; sourceTree = "<group>"; };
6AAE857519D329C6005672CA /* AdaptiveDateState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdaptiveDateState.swift; sourceTree = "<group>"; };
6AAE857619D329C6005672CA /* AdaptiveState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdaptiveState.swift; sourceTree = "<group>"; };
6ACDAAB91A1508BA0027A658 /* AppearenceSettingManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearenceSettingManager.swift; sourceTree = "<group>"; };
6AD1EC2519EFA9BA003F36A4 /* ControlStateValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStateValue.swift; sourceTree = "<group>"; };
6AD1EC2819EFB8E2003F36A4 /* ControlStateProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStateProtocol.swift; sourceTree = "<group>"; };
6AD1EC2A19F1165E003F36A4 /* TestTabBarItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestTabBarItem.swift; sourceTree = "<group>"; };
6AD4002619F7896900630034 /* ButtonStateAppearanceProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonStateAppearanceProtocol.swift; sourceTree = "<group>"; };
6AD4002819F792FA00630034 /* ControlStateAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStateAppearance.swift; sourceTree = "<group>"; };
6AD4002A19F7A0B800630034 /* AppearanceSerializationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearanceSerializationProtocol.swift; sourceTree = "<group>"; };
6AE723341A04EE6F003416B6 /* ControlStateAppearanceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStateAppearanceTest.swift; sourceTree = "<group>"; };
6AE723421A078071003416B6 /* ColorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = "<group>"; };
6AE723441A07C8E1003416B6 /* AdaptiveButtonAppearanceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdaptiveButtonAppearanceTest.swift; sourceTree = "<group>"; };
6AF450661A10F99A00AC30A4 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
6AFBC6D119D313D600D42578 /* AdaptiveController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AdaptiveController.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6AFBC6D519D313D600D42578 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6AFBC6D619D313D600D42578 /* AdaptiveController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AdaptiveController.h; sourceTree = "<group>"; };
@@ -116,6 +117,7 @@
children = (
6AAE857319D329C6005672CA /* AdaptiveButtonAppearance.swift */,
6AAE857419D329C6005672CA /* AdaptiveButtonsStateManager.swift */,
6ACDAAB91A1508BA0027A658 /* AppearenceSettingManager.swift */,
);
name = Appearance;
sourceTree = "<group>";
@@ -133,7 +135,6 @@
isa = PBXGroup;
children = (
6AD4002A19F7A0B800630034 /* AppearanceSerializationProtocol.swift */,
6AD4002619F7896900630034 /* ButtonStateAppearanceProtocol.swift */,
6AD1EC2819EFB8E2003F36A4 /* ControlStateProtocol.swift */,
);
name = Protocols;
@@ -160,7 +161,7 @@
6AFBC6D319D313D600D42578 /* AdaptiveController */ = {
isa = PBXGroup;
children = (
6AE723421A078071003416B6 /* ColorExtension.swift */,
6AF450661A10F99A00AC30A4 /* Constants.swift */,
6A156E3C1A08B322002A69AD /* Serializator */,
6AD4002C19F7A12200630034 /* Protocols */,
6AD1EC2719EFB521003F36A4 /* ControlStates */,
@@ -311,6 +312,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6ACDAABA1A1508BA0027A658 /* AppearenceSettingManager.swift in Sources */,
6AAE857819D329C6005672CA /* AdaptiveButtonsStateManager.swift in Sources */,
6AD4002919F792FA00630034 /* ControlStateAppearance.swift in Sources */,
6A3E3A1C19E05E5B00C7504B /* AdaptiveLaunchesState.swift in Sources */,
@@ -318,11 +320,10 @@
6AD4002B19F7A0B800630034 /* AppearanceSerializationProtocol.swift in Sources */,
6AD1EC2619EFA9BA003F36A4 /* ControlStateValue.swift in Sources */,
6AAE857919D329C6005672CA /* AdaptiveDateState.swift in Sources */,
6AF450671A10F99A00AC30A4 /* Constants.swift in Sources */,
6AD1EC2919EFB8E2003F36A4 /* ControlStateProtocol.swift in Sources */,
6A156E3E1A08B38E002A69AD /* DictioanarySerializer.swift in Sources */,
6AAE857A19D329C6005672CA /* AdaptiveState.swift in Sources */,
6AE723431A078071003416B6 /* ColorExtension.swift in Sources */,
6AD4002719F7896900630034 /* ButtonStateAppearanceProtocol.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -334,12 +335,13 @@
6AE723351A04EE6F003416B6 /* ControlStateAppearanceTest.swift in Sources */,
6AE7233B1A04F7B6003416B6 /* AdaptiveButtonAppearance.swift in Sources */,
6AD1EC2B19F1165E003F36A4 /* TestTabBarItem.swift in Sources */,
6AE7233D1A04F7BD003416B6 /* ButtonStateAppearanceProtocol.swift in Sources */,
6AE723391A04F7B1003416B6 /* AdaptiveLaunchesState.swift in Sources */,
6A3ED0CE19ED05D8006F06DD /* AdaptiveLaunchesStateTest.swift in Sources */,
6AE7233F1A04F7C3003416B6 /* ControlStateValue.swift in Sources */,
6AFB70291A19F53E00221E66 /* AppearenceSettingManager.swift in Sources */,
6AE7233E1A04F7BF003416B6 /* AppearanceSerializationProtocol.swift in Sources */,
6AE723451A07C8E1003416B6 /* AdaptiveButtonAppearanceTest.swift in Sources */,
6AFB702A1A19F54C00221E66 /* DictioanarySerializer.swift in Sources */,
6A3ED0CA19ED02DA006F06DD /* DateExtension.swift in Sources */,
6A3ED0CC19ED058F006F06DD /* AdaptiveDateStateTest.swift in Sources */,
6AFBC6E119D313D600D42578 /* AdaptiveControllerTests.swift in Sources */,
@@ -8,358 +8,42 @@
import UIKit
public let defaultFont = UIFont(name: "Helvetica", size: 14.0)
public let kNotTitle = ""
public class AdaptiveButtonAppearance: NSObject,AppearanceSerializationProtocol {
public class AdaptiveButtonAppearance: AppearanceSerializationProtocol{
public typealias StateObject = ControlStateValue
public typealias DictionaryObject = Dictionary <String,AnyObject>
private var stateDictionary:Dictionary <String,ControlStateValue> = Dictionary<String,ControlStateValue>()
public var stateDictionary:Dictionary <StateKey,ControlStateValue> = Dictionary <StateKey,ControlStateValue>()
public func setAllCommonApperanceFrom(adaptiveButtonApperance:AdaptiveButtonAppearance){
for (state, object) in adaptiveButtonApperance.stateDictionary {
self.stateDictionary.updateValue(ControlStateValue(styleValueStates: object), forKey: state)
}
public init(){
}
public func setImageNamesForStatesImageExtesions(imageName :String ,imageExtensionsForState:Dictionary <String,String>){
setImageNamesForStatesImageExtesions(imageName, imageExtensionsForState: imageExtensionsForState, controlState:UIControlState.Normal)
setImageNamesForStatesImageExtesions(imageName, imageExtensionsForState: imageExtensionsForState, controlState:UIControlState.Highlighted)
setImageNamesForStatesImageExtesions(imageName, imageExtensionsForState: imageExtensionsForState, controlState:UIControlState.Selected)
}
public func setImageNamesForStatesImageExtesions(imageName :String ,imageExtensionsForState:Dictionary <String,String>, controlState:UIControlState) {
self.setButtonImage(UIImage(named: imageName)!, state: kDefaultAdaptiveState)
for (state,imageExtension) in imageExtensionsForState {
self.setButtonImage(UIImage(named: imageName+imageExtension)!, state: state ,controlState:controlState)
self.setButtonImageName(imageName,state: state ,controlState:controlState)
}
}
func getStateObjectForState(state:String) -> ControlStateValue!{
if let stateObject = stateDictionary[state] {
return stateObject
}else{
return nil
}
}
func getOrCreateStateObjectForState(state:String) -> ControlStateValue!{
if let stateObject = stateDictionary[state] {
return stateObject
}else{
var stateObject = ControlStateValue()
stateDictionary.updateValue(stateObject, forKey: state)
return stateObject
}
}
func getOrCreateStateAppearenceObject(controlStateValueObject:ControlStateValue, controlState:UIControlState)->ControlStateAppearance{
if let stateObject = controlStateValueObject.getControlApearenceFor(controlState) {
return stateObject
}else{
if let stateObject = controlStateValueObject.getControlApearenceFor(UIControlState.Normal) {
controlStateValueObject.setControlApearence(stateObject,state: controlState)
return stateObject
}else{
let stateObject = ControlStateAppearance()
stateObject.titleColor = nil
stateObject.title = nil
controlStateValueObject.setControlApearence(stateObject,state: controlState)
return stateObject
}
}
}
public func setButonTitle(title:NSString, state:String){
setButonTitle(title, state:state, controlState:UIControlState.Normal)
}
public func getButonTitleForState(state:NSString)->String!{
return getButonTitleForState(state, controlState: UIControlState.Normal)
}
public func setButonTitle(title:NSString, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.title = title
public init (values:Dictionary<StateKey,ControlStateValue>) {
stateDictionary = values
}
public func getButonTitleForState(state:NSString ,controlState:UIControlState)->String!{
public convenience init(states:Dictionary<StateKey,ControlStateValue>) {
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
if let title = controlStateAppearanceObject.title{
return title
}else{
let controlStateValueObject = getOrCreateStateObjectForState(kDefaultAdaptiveState)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.title!
}
self.init(values:states)
}
public func setButonTitleFontForState(font:UIFont, state:String){
setButonTitleFont(font, state: state, controlState: UIControlState.Normal)
}
public func getButonTitleFontForState(state:NSString)->UIFont{
if let font = getButonTitleFontForState(state, controlState: UIControlState.Normal){
return font
}else{
return defaultFont!
}
}
public func getButonTitleFontForState(state:NSString ,controlState:UIControlState)->UIFont!{
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.font!
}
public func setButonTitleFont(font:UIFont, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.font = font
}
public func setButtonImage(image:UIImage, state:String){
setButtonImage(image, state: state, controlState: UIControlState.Normal)
print("set State \(state)")
}
public func setButtonImage(image:UIImage, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.image = image
print("set State \(state)")
}
public func setButtonImageName(imageName:String, state:String){
setButtonImageName(imageName, state: state, controlState: UIControlState.Normal)
print("set State \(state)")
}
public func setButtonImageName(imageName:String, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.imageName = imageName
print("set State \(state)")
}
public func getButonImageForState(state:NSString)->UIImage!{
return getButonImageForState(state, controlState: UIControlState.Normal)
}
public func getButonImageForState(state:NSString, controlState:UIControlState)->UIImage?{
var controlStateValueObject = getOrCreateStateObjectForState(state)
if var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState){
if let image = controlStateAppearanceObject.image{
return image
}else{
var controlStateValueObject = getOrCreateStateObjectForState(kDefaultAdaptiveState)
var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
if let image = controlStateAppearanceObject.image{
return controlStateAppearanceObject.image!
}else{
controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(UIControlState.Normal)
return controlStateAppearanceObject.image!
}
}
}else{
return nil
}
}
public func getButonImageNameForState(state:NSString)->NSString!{
return getButonImageNameForState(state, controlState: UIControlState.Normal)
}
public func getButonImageNameForState(state:NSString, controlState:UIControlState)->NSString?{
var controlStateValueObject = getOrCreateStateObjectForState(state)
if var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState){
return controlStateAppearanceObject.imageName
}else{
return nil
}
}
public func setBackgroundButonImage(image:UIImage, state:String){
setBackgroundButonImage(image, state: state)
}
public func setBackgroundButtonImage(image:UIImage, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.backgroundImage = image
print("set State \(state)")
}
public func getBackgroundImageForState(state:NSString)->UIImage?{
return getBackgroundButonImageForState(state, controlState: UIControlState.Normal)
}
public func getBackgroundButonImageForState(state:NSString, controlState:UIControlState)->UIImage?{
var controlStateValueObject = getOrCreateStateObjectForState(state)
if var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState){
if let image = controlStateAppearanceObject.backgroundImage{
return image
}else{
var controlStateValueObject = getOrCreateStateObjectForState(kDefaultAdaptiveState)
var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.backgroundImage!
}
}else{
return nil
}
}
public func setImageInsets(insets:UIEdgeInsets, state:String){
setImageInsets(insets, state: state,controlState:UIControlState.Normal)
}
public func setImageInsets(insets:UIEdgeInsets, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.imageInsets = insets
}
public func getImageInsetsForState(state:NSString)->UIEdgeInsets!{
return getImageInsetsForState(state, controlState: UIControlState.Normal)
}
public func getImageInsetsForState(state:NSString ,controlState:UIControlState)->UIEdgeInsets!{
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.imageInsets!
}
public func setTitleOffset(offset:UIOffset, state:String){
setTitleOffset(offset, state: state, controlState: UIControlState.Normal)
}
public func setTitleOffset(offset:UIOffset, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.titleOffset = offset
}
public func getTitleOffsetForState(state:NSString)->UIOffset!{
return getTitleOffsetForState(state,controlState:UIControlState.Normal)
}
public func getTitleOffsetForState(state:NSString ,controlState:UIControlState)->UIOffset!{
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.titleOffset!
}
public func setTitleColor(color:UIColor, state:String){
setTitleColor(color, state: state,controlState:UIControlState.Normal)
setTitleColor(color, state: state,controlState:UIControlState.Highlighted)
setTitleColor(color, state: state,controlState:UIControlState.Selected)
}
public func setTitleColor(color:UIColor, state:String, controlState:UIControlState){
let controlStateValueObject = getOrCreateStateObjectForState(state)
let controlStateAppearanceObject = getOrCreateStateAppearenceObject(controlStateValueObject,controlState: controlState)
controlStateAppearanceObject.titleColor = color
}
public func getTitleColorForState(state:NSString)->UIColor!{
return getTitleColorForState(state, controlState: UIControlState.Normal)
}
public func getTitleColorForState(state:NSString ,controlState:UIControlState)->UIColor!{
var controlStateValueObject = getOrCreateStateObjectForState(state)
var controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
if let curentTitleColor = controlStateAppearanceObject.titleColor{
return curentTitleColor
}else{
let controlStateValueObject = getStateObjectForState(kDefaultAdaptiveState)
let controlStateAppearanceObject = controlStateValueObject.getControlApearenceFor(controlState)
return controlStateAppearanceObject.titleColor!
}
}
public func setObjectDictionary(dictionary:Dictionary <String,DictionaryObject>){
var controlStatesDictionary = Dictionary<StateKey,ControlStateValue>()
for (key,object ) in dictionary{
let appearanceDictionary = object as Dictionary <String,DictionaryObject>
let appearanceObject = ControlStateValue()
appearanceObject.setObjectDictionary(appearanceDictionary)
stateDictionary.updateValue(appearanceObject, forKey: key)
controlStatesDictionary.updateValue(appearanceObject, forKey: StateKey(rawValue: key)!)
}
stateDictionary = controlStatesDictionary
}
public func getObjectDictionary() -> Dictionary<String,DictionaryObject>{
@@ -369,7 +53,7 @@ public class AdaptiveButtonAppearance: NSObject,AppearanceSerializationProtocol
for (key,object ) in stateDictionary{
let appearance = object as ControlStateValue
let appearanceDictionary = appearance.getObjectDictionary()
controlStatesDictionary.updateValue(appearanceDictionary, forKey: key)
controlStatesDictionary.updateValue(appearanceDictionary, forKey: key.rawValue)
}
return controlStatesDictionary
@@ -8,21 +8,10 @@
import UIKit
public let countDaysToSmallTextState = 14
public let countDaysToImageState = 30
public let defaultInsets = UIEdgeInsetsMake(0, 0,0, 0)
public let defaultSmallTitleModeFont = UIFont(name: "Helvetica", size: 10.0)
public let defaultSmallTitleModeImageInsets = UIEdgeInsetsMake(0, 0, 0, 0)
public let defaultImageModeInsets = UIEdgeInsetsMake(6, 0, -6, 0)
public let defaultSmallTitleModeOffset = UIOffsetMake(0, 20)
public let defaultOffset = UIOffsetMake(0, 00)
public let tabColor = UIColor(red: 169/255, green: 79/255, blue: 152/255, alpha: 1.0)
@objc public protocol AdaptiveApperanceProtocol {
optional func setFontToAdaptiveButton(font: UIFont)
func setFontToAdaptiveButton(font: UIFont , controlState:UIControlState)
//optional func setFontToAdaptiveButton(font: UIFont)
optional func setTitleToAdaptiveButton(text: NSString)
optional func setImageToAdaptiveButton(image: UIImage?)
optional func setHighlightedToAdaptiveButton(image: UIImage?)
@@ -30,65 +19,67 @@ public let tabColor = UIColor(red: 169/255, green: 79/255, blue: 152/255, alpha:
optional func setSelectedImageToAdaptiveButton(image: UIImage?)
optional func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets)
optional func setTitleOffsetToAdaptiveButton(offset: UIOffset)
optional func setTitleColorToAdaptiveButton(titleColor: UIColor)
//optional func setTitleColorToAdaptiveButton(titleColor: UIColor)
optional func setTitleColorToAdaptiveButton(color: UIColor, controlState:UIControlState)
}
public let selected = "Selected"
public let highlighted = "Higlihted"
public class AdaptiveButtonsStateManager {
public class AdaptiveButtonsStateManager <AdaptiveStateClass: AdaptiveState> {
public class func setupButtonsAppearanceFromState(state:AdaptiveState,buttonsAray:[AdaptiveApperanceProtocol],buttonsAppearances:[AdaptiveButtonAppearance]){
var state:String = state.currentItemState!
public class func setupButtonsAppearanceFromState(adaptiveState:AdaptiveStateClass,buttonsAray:[AdaptiveApperanceProtocol],buttonsAppearances:[AdaptiveButtonAppearance]){
var state = adaptiveState.currentItemState
var countElements = buttonsAray.count > buttonsAppearances.count ? buttonsAppearances.count : buttonsAray.count
for var index = 0; index < countElements; ++index {
var button :AdaptiveApperanceProtocol = buttonsAray[index]
var buttonApperance = buttonsAppearances[index]
let title = buttonApperance.getButonTitleForState(state)
button.setTitleToAdaptiveButton!(title)
if let controlStateValue = buttonApperance.stateDictionary[state!] {
let normalStateAppearenceObject = controlStateValue.controlStates[UIControlState.Normal.rawValue]
button.setFontToAdaptiveButton!(buttonApperance.getButonTitleFontForState(state))
if let image = buttonApperance.getButonImageForState(state) {
button.setImageToAdaptiveButton?(image)
if let title = normalStateAppearenceObject?.title {
button.setTitleToAdaptiveButton?(title)
}
if let imageName = normalStateAppearenceObject?.imageName?{
if let image = UIImage(named: imageName) {
button.setImageToAdaptiveButton?(image)
}
}
if let backgroundImage = buttonApperance.getButonImageForState(state) {
if let backgroundImage = normalStateAppearenceObject?.backgroundImage {
button.setBackgroundImageToAdaptiveButton?(backgroundImage)
}
if let imageInset = buttonApperance.getImageInsetsForState(state) {
if let imageInset = normalStateAppearenceObject?.imageInsets{
button.setImageInsetsToAdaptiveButton?(imageInset)
}
if let titleOffset = buttonApperance.getTitleOffsetForState(state) {
if let titleOffset = normalStateAppearenceObject?.titleOffset {
button.setTitleOffsetToAdaptiveButton?(titleOffset)
}
if let titleColor = buttonApperance.getTitleColorForState(state) {
button.setTitleColorToAdaptiveButton?(titleColor)
}
if let selectedImage = buttonApperance.getButonImageForState(state,controlState:UIControlState.Selected){
button.setSelectedImageToAdaptiveButton?(selectedImage)
}else{
if let selectedImage = buttonApperance.getButonImageForState(state,controlState:UIControlState.Normal){
button.setSelectedImageToAdaptiveButton?(selectedImage)
for (key, controlStateValue) in controlStateValue.controlStates{
if let titleFont = controlStateValue.font{
button.setFontToAdaptiveButton(titleFont , controlState:UIControlState(key))
}
if let titleColor = controlStateValue.titleColor{
button.setTitleColorToAdaptiveButton?(titleColor, controlState:UIControlState(key) )
}
}
if let highlightedImage = buttonApperance.getButonImageForState(state,controlState:UIControlState.Highlighted) {
button.setHighlightedToAdaptiveButton?(highlightedImage)
}
}
@@ -14,17 +14,12 @@ public let kImageAdaptiveState = "kImageAdaptiveState"
public class AdaptiveDateState: AdaptiveState {
public override init(){
super.init()
super.addNewCustomAdaptiveStates([kSmallTitleAdaptiveState,kImageAdaptiveState])
}
public convenience init(installDate:NSDate, currentDate:NSDate,countDaysToSmallTextState:Int,countDaysToImageState:Int) {
self.init()
var remainsDays = self.daysBetweenDates(installDate,currentDate: currentDate)
self.currentItemState = self.stateRemainDays(remainsDays,countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
print(currentItemState)
}
@@ -39,16 +34,19 @@ public class AdaptiveDateState: AdaptiveState {
return components.day+1;
}
func stateRemainDays (remainDays:Int,countDaysToSmallTextState:Int,countDaysToImageState:Int)->String{
func stateRemainDays (remainDays:Int,countDaysToSmallTextState:Int,countDaysToImageState:Int)->StateType{
var mode:StateType = .DefaultAdaptiveState
var mode:String = kDefaultAdaptiveState
print(" DAYS \(remainDays) ")
if remainDays > countDaysToSmallTextState && remainDays < countDaysToImageState{
mode = kSmallTitleAdaptiveState
mode = .SmallTitleAdaptiveState
}else if remainDays > countDaysToImageState {
mode = kImageAdaptiveState
mode = .ImageAdaptiveState
}
print(mode)
return mode
}
}
@@ -5,16 +5,20 @@
// Created by Arcilite on 04.10.14.
// Copyright (c) 2014 Ramotion. All rights reserved.
//
public let countDaysForSmaltextState = 3
public let countDaysForImageModeState = 7
import UIKit
typealias StateType = AdaptiveStateEnum
public class AdaptiveLaunchesState : AdaptiveState {
public override init(){
super.init()
super.addNewCustomAdaptiveStates([kSmallTitleAdaptiveState,kImageAdaptiveState])
typealias StateType = AdaptiveStateEnum
override init(){
}
@@ -25,13 +29,13 @@ public class AdaptiveLaunchesState : AdaptiveState {
}
internal func stateRemainDays (curentCountLaunches:Int,countLaunchesToSmallTextState:Int,countLaunchesToImageState:Int)->String{
var mode:String = kDefaultAdaptiveState
internal func stateRemainDays (curentCountLaunches:Int,countLaunchesToSmallTextState:Int,countLaunchesToImageState:Int)->StateType{
var mode:StateType = .DefaultAdaptiveState
if curentCountLaunches > countLaunchesToSmallTextState && curentCountLaunches < countLaunchesToImageState{
mode = kSmallTitleAdaptiveState
mode = .SmallTitleAdaptiveState
}else if curentCountLaunches > countLaunchesToImageState {
mode = kImageAdaptiveState
mode = .ImageAdaptiveState
}
return mode;
@@ -11,28 +11,23 @@ import UIKit
public let kDefaultAdaptiveState:String = "kDefaultAdaptiveState"
public class AdaptiveState: NSObject {
var currentItemState:NSString?
var buttonStates:[String] = [String]()
public override init(){
super.init()
self.currentItemState = kDefaultAdaptiveState
self.addNewCustomAdaptiveStates([kDefaultAdaptiveState])
}
internal func addNewCustomAdaptiveStates(customAdaptiveStates:Array<String>){
self.buttonStates+customAdaptiveStates
}
public enum AdaptiveStateEnum:String{
case DefaultAdaptiveState = "kDefaultAdaptiveState"
case SmallTitleAdaptiveState = "kSmallTitleAdaptiveState"
case ImageAdaptiveState = "kImageAdaptiveState"
}
public typealias StateKey = AdaptiveStateEnum
public class AdaptiveState {
public typealias StateType = AdaptiveStateEnum
var currentItemState:StateType?
init(){
}
}
@@ -10,6 +10,7 @@ import Foundation
protocol AppearanceSerializationProtocol {
typealias DictionaryObject
func getObjectDictionary() -> Dictionary<String,DictionaryObject>
func setObjectDictionary(dictionary:Dictionary<String,DictionaryObject>)
@@ -0,0 +1,51 @@
//
// AppearenceSettingManager.swift
// AdaptiveController
//
// Created by Arcilite on 13.11.14.
// Copyright (c) 2014 Ramotion. All rights reserved.
//
import Foundation
import UIKit
public class AppearenceSettingManager{
private var defaultAppearencesStyles:Dictionary<StateKey,ControlStateValue>
public init(){
defaultAppearencesStyles = Dictionary<StateKey,ControlStateValue>()
}
public init(stylesAppearances:Dictionary<StateKey,ControlStateValue>){
defaultAppearencesStyles = stylesAppearances
}
public func defaultStyleSettingsForNormalState(state:StateKey, titleOffset:UIOffset, imageInsets:UIEdgeInsets, titleColor:UIColor, font:UIFont, backgroundColor:UIColor ){
var controlDefaultStyleStateAppearence = ControlStateAppearance()
controlDefaultStyleStateAppearence.titleColor = titleColor
controlDefaultStyleStateAppearence.imageInsets = imageInsets
controlDefaultStyleStateAppearence.font = font
controlDefaultStyleStateAppearence.backgroundColor = backgroundColor
controlDefaultStyleStateAppearence.titleOffset = titleOffset
let controlStatesValues = [UIControlState.Normal.rawValue:controlDefaultStyleStateAppearence]
let controlStateValue = ControlStateValue(values: controlStatesValues)
defaultAppearencesStyles.updateValue(controlStateValue,forKey:state)
}
public func defaultStyleValuesForNormalState(state:StateKey, title:String, imageName:String) -> ControlStateValue {
var defaultStateValue = defaultAppearencesStyles[state] as ControlStateValue?
var normalDefaultAppearance = defaultStateValue?.controlStates[UIControlState.Normal.rawValue]
var controlSmallTitleStyleStateAppearence = ControlStateAppearance(appearanceStyle:normalDefaultAppearance)
controlSmallTitleStyleStateAppearence.imageName = imageName
controlSmallTitleStyleStateAppearence.title = title
let controSmallTitleStatesValues = [UIControlState.Normal.rawValue:controlSmallTitleStyleStateAppearence]
let controlSmallTitleStateValue = ControlStateValue(values: controSmallTitleStatesValues)
return controlSmallTitleStateValue
}
}
@@ -1,24 +0,0 @@
//
// ButtonStateApparenceProtocol.swift
// AdaptiveController
//
// Created by Arcilite on 22.10.14.
// Copyright (c) 2014 Ramotion. All rights reserved.
//
import UIKit
protocol ButtonStateAppearanceProtocol :AppearanceSerializationProtocol{
var title: AnyObject?{get set}
var font: AnyObject?{get set}
var imageName: AnyObject?{get set}
var backgroundImageName:AnyObject?{get set}
var titleOffset:AnyObject?{get set}
var imageInsets:AnyObject?{get set}
var titleColor:AnyObject?{get set}
var backgroundColor:AnyObject?{get set}
var enabled:Bool?{get set}
}
@@ -1,20 +0,0 @@
//
// ColorExtension.swift
// AdaptiveController
//
// Created by Arcilite on 03.11.14.
// Copyright (c) 2014 Ramotion. All rights reserved.
//
import Foundation
extension UIColor {
convenience init(rgb: UInt) {
self.init(
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgb & 0x0000FF) / 255.0,
alpha: CGFloat(1.0)
)
}
}
@@ -0,0 +1,25 @@
//
// Constants.swift
// AdaptiveController
//
// Created by Arcilite on 10.11.14.
// Copyright (c) 2014 Ramotion. All rights reserved.
//
import Foundation
import UIKit
//Default apearence settings
public let countDaysForSmaltextState = 3
public let countDaysForImageModeState = 7
public let countDaysToSmallTextState = 14
public let countDaysToImageState = 30
public let defaultInsets = UIEdgeInsetsMake(0, 0,0, 0)
public let defaultSmallTitleModeFont = UIFont(name: "Helvetica", size: 10.0)
public let defaultSmallTitleModeImageInsets = UIEdgeInsetsMake(0, 0, 0, 0)
public let defaultImageModeInsets = UIEdgeInsetsMake(6, 0, -6, 0)
public let defaultSmallTitleModeOffset = UIOffsetMake(0, 20)
public let defaultOffset = UIOffsetMake(0, 00)
public let tabColor = UIColor(red: 169/255, green: 79/255, blue: 152/255, alpha: 1.0)
public let defaultFont = UIFont(name: "Helvetica", size: 14.0)
@@ -54,10 +54,10 @@ public class ControlStateAppearance: AppearanceSerializationProtocol{
public init(){
title = ""
font = defaultFont
titleOffset = defaultOffset
imageInsets = defaultImageModeInsets
titleColor = UIColor.blackColor()
//font = defaultFont
// titleOffset = defaultOffset
//imageInsets = defaultImageModeInsets
titleColor = UIColor.whiteColor()
backgroundColor = UIColor.clearColor()
}
public convenience init(appearanceFullStyle:ControlStateAppearance?){
@@ -80,7 +80,7 @@ public class ControlStateAppearance: AppearanceSerializationProtocol{
imageInsets = appearanceStyle?.imageInsets
titleColor = appearanceStyle?.titleColor
backgroundColor = appearanceStyle?.backgroundColor
title = nil
title = appearanceStyle?.title
}
@@ -103,7 +103,7 @@ public class ControlStateAppearance: AppearanceSerializationProtocol{
colorDictionary[blueColor] = components[2]
colorDictionary[alphaColor] = components[3]
}
print(colorDictionary)
return colorDictionary
}
@@ -11,7 +11,8 @@ import Foundation
protocol ControlStateProtocol:AppearanceSerializationProtocol {
typealias StateObject
typealias ControlStateType:Hashable
var controlStates: Dictionary <String,StateObject>{get set}
var controlStates: Dictionary <ControlStateType, StateObject>{get }
}
@@ -8,38 +8,63 @@
import UIKit
extension UIControlState {
init(string:StringLiteralType){
switch(string){
case "UIControlStateNormal" :
self = UIControlState.Normal
case "UIControlStateHighlighted":
self = UIControlState.Highlighted
case"UIControlStateHighlighted":
self = UIControlState.Selected
default:
self = UIControlState.Disabled
}
}
func getStringKey()->String{
switch(self){
case UIControlState.Normal: return "UIControlStateNormal"
case UIControlState.Highlighted: return "UIControlStateHighlighted"
case UIControlState.Selected: return "UIControlStateSelected"
default: return "None"
}
}
}
public class ControlStateValue:ControlStateProtocol{
public typealias ControlStateType = UInt
public typealias StateObject = ControlStateAppearance
public typealias DictionaryObject = Dictionary <String,AnyObject>
public var controlStates: Dictionary <String,StateObject> = Dictionary <String,ControlStateAppearance>()
public var controlStates :Dictionary <ControlStateType,ControlStateAppearance>
private var contolStatesMappingDictionary = ["\((UIControlState.Normal).rawValue)":"UIControlStateNormal",
"\((UIControlState.Highlighted).rawValue)":"UIControlStateHighlighted",
"\((UIControlState.Selected).rawValue)":"UIControlStateSelected"]
public init(){
self.controlStates = Dictionary<String,ControlStateAppearance>()
public init(){
self.controlStates = Dictionary<ControlStateType,ControlStateAppearance>()
}
public convenience init(valueForNormalState:ControlStateAppearance) {
public convenience init(values:Dictionary<ControlStateType,ControlStateAppearance>) {
self.init()
self.setControlApearence(valueForNormalState, state: UIControlState.Normal)
self.setControlApearence(valueForNormalState, state: UIControlState.Highlighted)
self.setControlApearence(valueForNormalState, state: UIControlState.Selected)
controlStates = values
}
public convenience init(styleValueStates:ControlStateValue) {
self.init()
for (state, object) in styleValueStates.controlStates {
self.controlStates.updateValue( ControlStateAppearance(appearanceStyle: object), forKey: state)
}
// self.setControlApearence(valueForNormalState!, state: UIControlState.Normal)
}
@@ -50,7 +75,8 @@ public class ControlStateValue:ControlStateProtocol{
for (key,object ) in controlStates{
var appearance = object as ControlStateAppearance
var appearanceDictionary = appearance.getObjectDictionary()
controlStatesDictionary.updateValue(appearanceDictionary, forKey: key)
let controlKey = UIControlState(key).getStringKey()
controlStatesDictionary.updateValue(appearanceDictionary, forKey:controlKey )
}
return controlStatesDictionary
@@ -59,29 +85,18 @@ public class ControlStateValue:ControlStateProtocol{
public func setObjectDictionary(dictionary:Dictionary <String,DictionaryObject>){
var controlStatesDictionary = Dictionary<ControlStateType,ControlStateAppearance>()
for (key,object ) in dictionary{
var appearanceDictionary = object as Dictionary <String,AnyObject>
var appearanceObject = ControlStateAppearance()
appearanceObject.setObjectDictionary(appearanceDictionary)
controlStates.updateValue(appearanceObject, forKey: key)
controlStatesDictionary.updateValue(appearanceObject, forKey: UIControlState(string:key).rawValue)
}
}
public func setControlApearence(appearance:ControlStateAppearance,state:UIControlState){
var stateKey = "\(state.rawValue)"
var mapedKey = contolStatesMappingDictionary[stateKey]
self.controlStates.updateValue(appearance, forKey: mapedKey!)
self.controlStates = controlStatesDictionary
}
public func getControlApearenceFor(state:UIControlState) -> ControlStateAppearance!{
var stateKey:String = "\(state.rawValue)"
var mapedKey = contolStatesMappingDictionary[stateKey]
var stateObject = self.controlStates[mapedKey!]
return stateObject
}
}
@@ -9,7 +9,7 @@
import UIKit
public class DictioanarySerializer: NSObject {
let rootKey:NSString = "Root"
public typealias DictionaryObject = Dictionary <String,AnyObject>
@@ -9,46 +9,37 @@
import XCTest
import UIKit
import AdaptiveController
class AdaptiveButtonAppearanceTest: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle",
kImageAdaptiveState:"_bigimage",
kSmallTitleAdaptiveState+selected :"_smalltitle",
kImageAdaptiveState+selected:"_bigimage" ]
func testAppearanceSetup() {
var settingsManager = AppearenceSettingManager()
//
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.DefaultAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultInsets, titleColor:UIColor(red: 1, green: 1, blue: 1, alpha: 1), font:defaultFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultSmallTitleModeImageInsets, titleColor:UIColor.whiteColor(), font:defaultSmallTitleModeFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.ImageAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultImageModeInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
var watchAppearance = AdaptiveButtonAppearance();
watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
watchAppearance.setButonTitle("watch2", state: kSmallTitleAdaptiveState)
watchAppearance.setButonTitle("", state: kImageAdaptiveState)
watchAppearance.setTitleColor(UIColor.whiteColor(), state: kDefaultAdaptiveState)
watchAppearance.setTitleColor(UIColor.whiteColor(), state: kSmallTitleAdaptiveState)
watchAppearance.setTitleColor(UIColor.whiteColor(), state: kImageAdaptiveState)
watchAppearance.setButonTitleFontForState(defaultFont!, state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(defaultSmallTitleModeFont!, state: kSmallTitleAdaptiveState)
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
var watchControlDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"watch", imageName:"watch")
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);
var watchControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"watch", imageName:"watch_smalltitle")
var watchControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"watch_bigimage")
let watchAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:watchControlDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:watchControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:watchControlImageStateValue]
var watchAppearance = AdaptiveButtonAppearance(states:watchAppearanceStates)
var appearanceDictionary = watchAppearance.getObjectDictionary()
@@ -56,21 +47,26 @@ class AdaptiveButtonAppearanceTest: XCTestCase {
testAppearance.setObjectDictionary(appearanceDictionary)
// XCTAssert(testAppearance.getTitleColorForState(kDefaultAdaptiveState) == UIColor.whiteColor(), "Fail color")
XCTAssert(UIOffsetEqualToOffset(testAppearance.getTitleOffsetForState(kDefaultAdaptiveState),defaultOffset), "Fail offset")
XCTAssert(UIEdgeInsetsEqualToEdgeInsets(defaultInsets, testAppearance.getImageInsetsForState(kDefaultAdaptiveState)), "Fail insets")
//
// XCTAssert(tabBarItem.text!.isEqualToString(""), "Fail text")
// XCTAssert(tabBarItem.font!.isEqual(defaultFont), "Fail font")
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
if let controlStateValue = testAppearance.stateDictionary[AdaptiveStateEnum.DefaultAdaptiveState]{
if let normalStateAppearenceObject = controlStateValue.controlStates[UIControlState.Normal.rawValue]{
XCTAssert(normalStateAppearenceObject.titleColor == UIColor(red: 1, green: 1, blue: 1, alpha: 1), "Fail color")
XCTAssert(UIOffsetEqualToOffset(normalStateAppearenceObject.titleOffset!,defaultOffset), "Fail offset")
XCTAssert(UIEdgeInsetsEqualToEdgeInsets(defaultInsets, normalStateAppearenceObject.imageInsets!), "Fail insets")
}
}
}
}
@@ -46,7 +46,7 @@ class AdaptiveControllerTests: XCTestCase {
var arrayButtons = [tabBarItem]
AdaptiveButtonsStateManager(state: adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearance: buttonsAppearances)
AdaptiveButtonsStateManager.setupButtonsAppearanceFromState(adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearances: buttonsAppearances)
//assert
@@ -54,8 +54,8 @@ class AdaptiveControllerTests: XCTestCase {
XCTAssert(UIOffsetEqualToOffset(tabBarItem.offset!,defaultOffset), "Fail offset")
XCTAssert(UIEdgeInsetsEqualToEdgeInsets(defaultInsets, tabBarItem.insets!), "Fail insets")
let bundle = NSBundle(forClass: AdaptiveButtonAppearance.self)
var image:MockUIImage = tabBarItem.image as MockUIImage
XCTAssert(image.checkImageString!.isEqual("default Image"), "Fail image")
// var image:MockUIImage = tabBarItem.image as MockUIImage
//XCTAssert(image.checkImageString!.isEqual("default Image"), "Fail image")
XCTAssert(tabBarItem.text!.isEqualToString("watch"), "Fail text")
XCTAssert(tabBarItem.font!.isEqual(defaultFont), "Fail font")
}
@@ -67,7 +67,7 @@ class AdaptiveControllerTests: XCTestCase {
var adaptiveDateState = AdaptiveDateState(installDate: installDate,currentDate:currentDate,countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
XCTAssert(!adaptiveDateState.isEqual(kSmallTitleAdaptiveState), "Fail SmallTitleState")
// XCTAssert(!adaptiveDateState.isEqual(kSmallTitleAdaptiveState), "Fail SmallTitleState")
var buttonsAppearances = buttonsAppearancesGenerate()
var tabBarItem = TestTabBarItem()
@@ -75,13 +75,14 @@ class AdaptiveControllerTests: XCTestCase {
var arrayButtons = [tabBarItem]
AdaptiveButtonsStateManager(state: adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearance: buttonsAppearances)
// AdaptiveButtonsStateManager(state: adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearance: buttonsAppearances)
AdaptiveButtonsStateManager.setupButtonsAppearanceFromState(adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearances: buttonsAppearances)
XCTAssert(tabBarItem.color!.isEqual(UIColor.whiteColor()), "Fail color")
XCTAssert(UIOffsetEqualToOffset(tabBarItem.offset!,defaultOffset), "Fail offset")
XCTAssert(UIEdgeInsetsEqualToEdgeInsets(defaultInsets, tabBarItem.insets!), "Fail insets")
var image:MockUIImage = tabBarItem.image as MockUIImage
XCTAssert(image.checkImageString!.isEqual("smalltitle Image"), "Fail image")
//var image:MockUIImage = tabBarItem.image as MockUIImage
//XCTAssert(image.checkImageString!.isEqual("smalltitle Image"), "Fail image")
XCTAssert(tabBarItem.font!.isEqual(defaultSmallTitleModeFont), "Fail font")
}
@@ -93,7 +94,7 @@ class AdaptiveControllerTests: XCTestCase {
var adaptiveDateState = AdaptiveDateState(installDate: installDate,currentDate:currentDate,countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
XCTAssert(!adaptiveDateState.isEqual(kImageAdaptiveState), "Fail ImageAdaptiveState")
//XCTAssert(!adaptiveDateState.isEqual(kImageAdaptiveState), "Fail ImageAdaptiveState")
var buttonsAppearances = buttonsAppearancesGenerate()
var tabBarItem = TestTabBarItem()
@@ -101,14 +102,14 @@ class AdaptiveControllerTests: XCTestCase {
var arrayButtons = [tabBarItem]
AdaptiveButtonsStateManager(state: adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearance: buttonsAppearances)
// AdaptiveButtonsStateManager(state: adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearance: buttonsAppearances)
AdaptiveButtonsStateManager.setupButtonsAppearanceFromState(adaptiveDateState,buttonsAray:arrayButtons ,buttonsAppearances: buttonsAppearances)
XCTAssert(tabBarItem.color!.isEqual(UIColor.whiteColor()), "Fail color")
XCTAssert(UIOffsetEqualToOffset(tabBarItem.offset!,defaultOffset), "Fail offset")
XCTAssert(UIEdgeInsetsEqualToEdgeInsets(defaultImageModeInsets, tabBarItem.insets!), "Fail insets")
var image:MockUIImage = tabBarItem.image as MockUIImage
XCTAssert(image.checkImageString!.isEqual("big Image"), "Fail image")
// var image:MockUIImage = tabBarItem.image as MockUIImage
// XCTAssert(image.checkImageString!.isEqual("big Image"), "Fail image")
XCTAssert(tabBarItem.text!.isEqualToString(""), "Fail text")
XCTAssert(tabBarItem.font!.isEqual(defaultFont), "Fail font")
}
@@ -117,46 +118,28 @@ class AdaptiveControllerTests: XCTestCase {
func buttonsAppearancesGenerate() -> [AdaptiveButtonAppearance]{
var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle",
kImageAdaptiveState:"_bigimage",
kSmallTitleAdaptiveState+selected :"_smalltitle",
kImageAdaptiveState+selected:"_bigimage" ]
var settingsManager = AppearenceSettingManager()
//
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.DefaultAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultSmallTitleModeImageInsets, titleColor:UIColor.whiteColor(), font:defaultSmallTitleModeFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.ImageAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultImageModeInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
var watchAppearance = AdaptiveButtonAppearance();
watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
watchAppearance.setButonTitle("", state: kImageAdaptiveState)
watchAppearance.setTitleColor(UIColor.whiteColor(), state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(defaultFont!, state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(defaultSmallTitleModeFont!, state: kSmallTitleAdaptiveState)
let mockImage = MockUIImage()
mockImage.checkImageString = "default Image"
var watchControlDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"watch", imageName:"watch")
watchAppearance.setButtonImage(mockImage, state: kDefaultAdaptiveState)
var watchControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"watch", imageName:"watch_smalltitle")
var watchControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"watch_bigimage")
let watchAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:watchControlDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:watchControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:watchControlImageStateValue]
let mockSmallTitleImage = MockUIImage()
mockSmallTitleImage.checkImageString = "smalltitle Image"
watchAppearance.setButtonImage(mockSmallTitleImage, state: kSmallTitleAdaptiveState)
let mockBigImageStateImage = MockUIImage()
mockBigImageStateImage.checkImageString = "big Image"
watchAppearance.setButtonImage(mockBigImageStateImage, state: kImageAdaptiveState)
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);
var watchAppearance = AdaptiveButtonAppearance(states:watchAppearanceStates)
return [watchAppearance]
@@ -20,9 +20,9 @@ class AdaptiveDateStateTest: XCTestCase {
super.setUp()
installDate = NSDate(dateString:"2014-07-7")
var currentDate = NSDate(dateString:"2014-07-7")
var currentDate = NSDate(dateString:"2014-07-8")
adaptiveDateState = AdaptiveDateState(installDate: installDate!,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
adaptiveDateState = AdaptiveDateState(installDate: installDate!,currentDate:currentDate,countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
// Put setup code here. This method is called before the invocation of each test method in the class.
}
@@ -34,16 +34,16 @@ class AdaptiveDateStateTest: XCTestCase {
func testDefaultState() {
// This is an example of a functional test case.
XCTAssert(!adaptiveDateState!.isEqual(kDefaultAdaptiveState), "Fail DefaultState")
XCTAssert(adaptiveDateState?.currentItemState?.rawValue == AdaptiveStateEnum.DefaultAdaptiveState.rawValue, "Fail DefaultState")
}
func testSmallTextState() {
// This is an example of a functional test case.
var currentDate = NSDate(dateString:"2014-07-21")
adaptiveDateState = AdaptiveDateState(installDate: installDate!,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
adaptiveDateState = AdaptiveDateState(installDate: installDate!,currentDate:currentDate,countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
XCTAssert(!adaptiveDateState!.isEqual(kSmallTitleAdaptiveState), "Fail SmallTitleState")
XCTAssert(adaptiveDateState?.currentItemState?.rawValue == AdaptiveStateEnum.SmallTitleAdaptiveState.rawValue, "Fail SmallTitleState")
}
func testImageState() {
@@ -52,7 +52,7 @@ class AdaptiveDateStateTest: XCTestCase {
adaptiveDateState = AdaptiveDateState(installDate: installDate!,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
XCTAssert(!adaptiveDateState!.isEqual(kImageAdaptiveState), "Fail ImageAdaptiveState")
XCTAssert(adaptiveDateState?.currentItemState?.rawValue == AdaptiveStateEnum.ImageAdaptiveState.rawValue, "Fail ImageAdaptiveState")
}
@@ -29,7 +29,8 @@ class AdaptiveLaunchesStateTest: XCTestCase {
adaptiveLaunchState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches,countLaunchesToSmallTextState:countDaysForSmaltextState,countLaunchesToImageState:countDaysForImageModeState)
// This is an example of a functional test case.
XCTAssert(!adaptiveLaunchState!.isEqual(kDefaultAdaptiveState), "Fail DefaultState")
// This is an example of a functional test case.
XCTAssert(adaptiveLaunchState?.currentItemState?.rawValue == AdaptiveStateEnum.DefaultAdaptiveState.rawValue, "Fail DefaultState")
}
func testSmallTextState() {
@@ -38,18 +39,17 @@ class AdaptiveLaunchesStateTest: XCTestCase {
adaptiveLaunchState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches,countLaunchesToSmallTextState:countDaysForSmaltextState,countLaunchesToImageState:countDaysForImageModeState)
XCTAssert(!adaptiveLaunchState!.isEqual(kSmallTitleAdaptiveState), "Fail SmallTitleState")
XCTAssert(adaptiveLaunchState?.currentItemState?.rawValue == AdaptiveStateEnum.SmallTitleAdaptiveState.rawValue, "Fail SmaltitleState")
}
func testImageState() {
// This is an example of a functional test case.
var curentCountLaunches = 7
var curentCountLaunches = 10
adaptiveLaunchState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches,countLaunchesToSmallTextState:countDaysForSmaltextState,countLaunchesToImageState:countDaysForImageModeState)
XCTAssert(!adaptiveLaunchState!.isEqual(kImageAdaptiveState), "Fail ImageAdaptiveState")
XCTAssert(adaptiveLaunchState?.currentItemState?.rawValue == AdaptiveStateEnum.ImageAdaptiveState.rawValue, "Fail ImageAdaptiveState")
}
@@ -31,9 +31,10 @@ class ControlStateValueTest: XCTestCase {
appearance.titleColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
appearance.backgroundColor = UIColor(red: 0, green: 7, blue: 0, alpha: 1)
var value = ControlStateValue(valueForNormalState: appearance)
value.setControlApearence(appearance,state:UIControlState.Normal)
var object:ControlStateAppearance = value.getControlApearenceFor(UIControlState.Normal)
var value = ControlStateValue(values: [UIControlState.Normal.rawValue:appearance])
// value.setControlApearence(appearance,state:UIControlState.Normal)
var object:ControlStateAppearance = value.controlStates[UIControlState.Normal.rawValue]!
XCTAssert(object.title! == appearance.title , "Pass")
@@ -50,16 +51,16 @@ class ControlStateValueTest: XCTestCase {
appearance.titleOffset = UIOffsetMake(2, 2)
appearance.titleColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
appearance.backgroundColor = UIColor(red: 0, green: 7, blue: 0, alpha: 1)
var value = ControlStateValue(valueForNormalState: appearance)
value.setControlApearence(appearance,state:UIControlState.Normal)
var object:ControlStateAppearance = value.getControlApearenceFor(UIControlState.Normal)
//
var value = ControlStateValue(values: [UIControlState.Normal.rawValue:appearance])
var object:ControlStateAppearance = value.controlStates[UIControlState.Normal.rawValue]!
XCTAssert(object.title! == appearance.title , "Pass")
var value1 = ControlStateValue()
value1.setObjectDictionary(value.getObjectDictionary())
var object1:ControlStateAppearance = value.getControlApearenceFor(UIControlState.Normal)
var object1:ControlStateAppearance = value.controlStates[UIControlState.Normal.rawValue]!
XCTAssert(object1.title! == appearance.title , "Pass")
@@ -11,7 +11,7 @@ import UIKit
import AdaptiveController
import XCTest
class TestTabBarItem: AdaptiveApperanceProtocol {
public class TestTabBarItem: AdaptiveApperanceProtocol {
var font:UIFont?
var text:NSString?
@@ -30,13 +30,13 @@ class TestTabBarItem: AdaptiveApperanceProtocol {
self.font = font
}
func setTitleToAdaptiveButton(text: NSString){
public func setTitleToAdaptiveButton(text: NSString){
self.text = text;
}
func setImageToAdaptiveButton(image: UIImage?){
public func setImageToAdaptiveButton(image: UIImage?){
// XCTAssertNotNil(image)
self.image = image
@@ -47,12 +47,12 @@ class TestTabBarItem: AdaptiveApperanceProtocol {
}
func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets){
public func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets){
self.insets = insets
}
func setTitleOffsetToAdaptiveButton(offset: UIOffset){
public func setTitleOffsetToAdaptiveButton(offset: UIOffset){
self.offset = offset;
@@ -64,5 +64,14 @@ class TestTabBarItem: AdaptiveApperanceProtocol {
}
public func setFontToAdaptiveButton(font: UIFont , controlState:UIControlState){
self.font = font
}
public func setTitleColorToAdaptiveButton(color: UIColor, controlState:UIControlState){
self.color = color;
}
}
+18 -38
View File
@@ -49,51 +49,31 @@ And then you should setup an array of appearances. You should setup button image
And then you should setup an array of items Appearance object. You should set the button's image for each state for each appearance object.
First, you should setup a dictionary for the extension of the image for each UI state:
First, you should setup a style for each UI state:
```swift
var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle", kImageAdaptiveState:"_bigimage"]
```swift
var settingsManager = AppearenceSettingManager()
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.DefaultAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultSmallTitleModeImageInsets, titleColor:UIColor.whiteColor(), font:defaultSmallTitleModeFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.ImageAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultImageModeInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
```
Then you should set the Appearance for each UITabBarItem title for each state, fonts for each state, a default image if you describe an extension for each state, or if you do not describe an extension, you should setup each image for each state.
Then you should set the Appearance for each UITabBarItem title for each state and image for each state
First, init the appearance object and setup the text for each state. If the text is the same for each state, you can set text for the default state:
First, init the appearance values with title and image with presetes appearances style :
```swift
var watchAppearance = AdaptiveButtonAppearance();
watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
watchAppearance.setButonTitle("watch", state: kSmallTitleAdaptiveState)
watchAppearance.setButonTitle("", state: kImageAdaptiveState)
```swift
var messageСontrolDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"messages", imageName:"messages")
var messageControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"messages", imageName:"messages_smalltitle")
var messageControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"messages_bigimage")
```
Then you should setup your fonts for each state:
then init appearace opject with aprerance object for each state
```swift
watchAppearance.setButonTitleFontForState(yourDefaultFont, state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(yourDefaultSmallTitleModeFont, state: kSmallTitleAdaptiveState)
```
Then you should set the default image and extensions for each state a function which automaticaly sets images for each state:
```swift
watchAppearance.setImageNamesForStatesImageExtesions("watch", imageExtensionsForState:imageExtensionsForStates)
```
Then you should setup the appearance insets for each state:
```swift
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);
```
And you can setup the appearance insets for each Control state but this setting is optional:
```swift
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState controlState:UIControlState.Highlighted);
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState controlState:UIControlState.Highlighted)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState controlState:UIControlState.Highlighted)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState controlState:UIControlState.Highlighted);
let messageAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:messageСontrolDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:messageControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:messageControlImageStateValue]
var messageAperance = AdaptiveButtonAppearance(states:messageAppearanceStates)
es)
```
In alternative way you can setup all appearances settings in plist like on image
-14
View File
@@ -1,14 +0,0 @@
def run(command)
system(command) or raise "RAKE TASK FAILED: #{command}"
end
namespace "test" do
desc "Run unit tests for all iOS targets"
task :ios do |t|
run "xcodebuild -project AdaptiveController/AdaptiveController.xcodeproj -scheme AdaptiveController"
run "xcodebuild -project AdaptiveController/AdaptiveController.xcodeproj -scheme AdaptiveControllerTests test"
end
end
task default: ["test:ios"]
@@ -37,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
tabBar.barTintColor = tabColor
tabBar.clipsToBounds = true
var installDate = NSDate(dateString:"2014-9-22")
var installDate = NSDate(dateString:"2014-10-22")
var adaptiveState = AdaptiveDateState(installDate: installDate,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)
@@ -47,7 +47,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var serializer = DictioanarySerializer()
var butonsApperances = serializer.parseFromPlistToButtonApperances(path!)
var butonsApperances = serializer.parseFromPlistToButtonAppearances(path!)
var arrayButtons = tabBar.items as [UITabBarItem]
@@ -19,11 +19,7 @@ extension UITabBarItem : AdaptiveApperanceProtocol {
//
// }
public func setFontToAdaptiveButton(font: UIFont){
self.setTitleTextAttributes(NSDictionary(objects: [font], forKeys: [NSFontAttributeName]), forState: UIControlState.Normal)
}
public func setTitleToAdaptiveButton(text: NSString){
self.title = text
@@ -45,12 +41,29 @@ extension UITabBarItem : AdaptiveApperanceProtocol {
self.setTitlePositionAdjustment(offset)
}
public func setTitleColorToAdaptiveButton(color: UIColor){
var dictionary = self.titleTextAttributesForState(UIControlState.Normal)
dictionary.updateValue(color, forKey: NSForegroundColorAttributeName)
self.setTitleTextAttributes(dictionary, forState: UIControlState.Normal)
// public func setTitleColorToAdaptiveButton(color: UIColor){
// var dictionary = self.titleTextAttributesForState(UIControlState.Normal)
// dictionary.updateValue(color, forKey: NSForegroundColorAttributeName)
// self.setTitleTextAttributes(dictionary, forState: UIControlState.Normal)
// }
//
// public func setFontToAdaptiveButton(font: UIFont){
//
// self.setTitleTextAttributes(NSDictionary(objects: [font], forKeys: [NSFontAttributeName]), forState: UIControlState.Normal)
//
// }
//
public func setFontToAdaptiveButton(font: UIFont , controlState:UIControlState){
self.setTitleTextAttributes(NSDictionary(objects: [font], forKeys: [NSFontAttributeName]), forState: controlState)
}
public func setTitleColorToAdaptiveButton(color: UIColor, controlState:UIControlState){
var dictionary = self.titleTextAttributesForState(controlState)
dictionary.updateValue(color, forKey: NSForegroundColorAttributeName)
self.setTitleTextAttributes(dictionary, forState: controlState)
}
}
@@ -56,84 +56,104 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func buttonsAppearancesGenerate() -> [AdaptiveButtonAppearance]{
var settingsManager = AppearenceSettingManager()
//
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.DefaultAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultSmallTitleModeImageInsets, titleColor:UIColor.whiteColor(), font:defaultSmallTitleModeFont!, backgroundColor:UIColor.clearColor())
var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle",
kImageAdaptiveState:"_bigimage",
kSmallTitleAdaptiveState+selected :"_smalltitle",
kImageAdaptiveState+selected:"_bigimage" ]
settingsManager.defaultStyleSettingsForNormalState(AdaptiveStateEnum.ImageAdaptiveState,titleOffset:defaultOffset, imageInsets:defaultImageModeInsets, titleColor:UIColor.whiteColor(), font:defaultFont!, backgroundColor:UIColor.clearColor())
var watchAppearance = AdaptiveButtonAppearance();
watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
var watchControlDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"watch", imageName:"watch")
var watchControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"watch", imageName:"watch_smalltitle")
var watchControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"watch_bigimage")
let watchAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:watchControlDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:watchControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:watchControlImageStateValue]
watchAppearance.setButonTitle("", state: kImageAdaptiveState)
watchAppearance.setTitleColor(UIColor.whiteColor(), state: kDefaultAdaptiveState)
watchAppearance.setButonTitleFontForState(defaultFont!, state: kDefaultAdaptiveState)
var watchAppearance = AdaptiveButtonAppearance(states:watchAppearanceStates)
watchAppearance.setButonTitleFontForState(defaultSmallTitleModeFont!, state: kSmallTitleAdaptiveState)
var userСontrolDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"user", imageName:"man")
var userControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"user", imageName:"man_smalltitle")
watchAppearance.setImageNamesForStatesImageExtesions("watch", imageExtensionsForState:imageExtensionsForStates)
var userControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"man_bigimage")
let userappearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:watchControlDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:watchControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:watchControlImageStateValue]
watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
let userAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:userСontrolDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:userControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:userControlImageStateValue]
watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);
var userAperance = AdaptiveButtonAppearance();
userAperance.setAllCommonApperanceFrom(watchAppearance)
userAperance.setButonTitle("user", state: kDefaultAdaptiveState)
userAperance.setButonTitle("", state: kImageAdaptiveState)
userAperance.setImageNamesForStatesImageExtesions("man", imageExtensionsForState:imageExtensionsForStates)
var messageAperance = AdaptiveButtonAppearance();
messageAperance.setAllCommonApperanceFrom((watchAppearance))
messageAperance.setButonTitle("message", state: kDefaultAdaptiveState)
messageAperance.setButonTitle("", state: kImageAdaptiveState)
messageAperance.setImageNamesForStatesImageExtesions("messages", imageExtensionsForState:imageExtensionsForStates)
var userAperance = AdaptiveButtonAppearance(states:userAppearanceStates)
var menuAperance = AdaptiveButtonAppearance();
var messageСontrolDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"messages", imageName:"messages")
var messageControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"messages", imageName:"messages_smalltitle")
var messageControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"messages_bigimage")
menuAperance.setAllCommonApperanceFrom((watchAppearance))
let messageAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:messageСontrolDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:messageControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:messageControlImageStateValue]
menuAperance.setButonTitle("dial", state: kDefaultAdaptiveState)
menuAperance.setButonTitle("", state: kImageAdaptiveState)
menuAperance.setImageNamesForStatesImageExtesions("menu", imageExtensionsForState:imageExtensionsForStates)
var messageAperance = AdaptiveButtonAppearance(states:messageAppearanceStates)
var moreAperance = AdaptiveButtonAppearance();
moreAperance.setAllCommonApperanceFrom((watchAppearance))
moreAperance.setButonTitle("more", state: kDefaultAdaptiveState)
moreAperance.setButonTitle("", state: kImageAdaptiveState)
moreAperance.setImageNamesForStatesImageExtesions("more", imageExtensionsForState:imageExtensionsForStates)
var menuСontrolDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"dial", imageName:"menu")
var menuControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"dial", imageName:"menu_smalltitle")
var menuControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"menu_bigimage")
let menuAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:menuСontrolDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:menuControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:menuControlImageStateValue]
var menuAperance = AdaptiveButtonAppearance(states:menuAppearanceStates)
var moreСontrolDefaultStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.DefaultAdaptiveState, title:"more", imageName:"more")
var moreControlSmallTitleStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.SmallTitleAdaptiveState, title:"more", imageName:"more_smalltitle")
var moreControlImageStateValue = settingsManager.defaultStyleValuesForNormalState(AdaptiveStateEnum.ImageAdaptiveState, title:"", imageName:"more_bigimage")
let moreAppearanceStates = [AdaptiveStateEnum.DefaultAdaptiveState:moreСontrolDefaultStateValue,
AdaptiveStateEnum.SmallTitleAdaptiveState:moreControlSmallTitleStateValue,
AdaptiveStateEnum.ImageAdaptiveState:moreControlImageStateValue]
var moreAperance = AdaptiveButtonAppearance(states:moreAppearanceStates)
return [watchAppearance ,messageAperance,userAperance,menuAperance,moreAperance]
}
@@ -8,7 +8,7 @@
<!--First-->
<scene sceneID="hNz-n2-bh7">
<objects>
<viewController id="9pv-A4-QxB" customClass="WatchViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="9pv-A4-QxB" customClass="WatchViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ia1-K6-d13"/>
<viewControllerLayoutGuide type="bottom" id="4ug-Mw-9AY"/>
@@ -46,7 +46,7 @@
<constraint firstItem="bTY-b5-lYl" firstAttribute="leading" secondItem="tsR-hK-woN" secondAttribute="leading" id="ueh-EO-Puf"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="First" id="acW-dT-cKf" customClass="AdaptiveTabBarItem" customModule="example_date_adaptive_tab_bar" customModuleProvider="target"/>
<tabBarItem key="tabBarItem" title="First" id="acW-dT-cKf" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
</objects>
@@ -55,7 +55,7 @@
<!--Second-->
<scene sceneID="wg7-f3-ORb">
<objects>
<viewController id="8rJ-Kc-sve" customClass="MessageViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="8rJ-Kc-sve" customClass="MessageViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="L7p-HK-0SC"/>
<viewControllerLayoutGuide type="bottom" id="Djb-ko-YwX"/>
@@ -93,7 +93,7 @@
<constraint firstItem="Djb-ko-YwX" firstAttribute="top" secondItem="d3m-k5-qah" secondAttribute="bottom" id="zws-Zn-RsZ"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Second" image="second" id="cPa-gy-q4n" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar"/>
<tabBarItem key="tabBarItem" title="Second" id="cPa-gy-q4n" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
@@ -102,7 +102,7 @@
<!--Tab Bar View Controller-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController id="49e-Tb-3d3" customClass="TabBarViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<tabBarController id="49e-Tb-3d3" customClass="TabBarViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
@@ -124,7 +124,7 @@
<!--Item-->
<scene sceneID="60i-zg-cAx">
<objects>
<viewController id="BiK-DX-JK5" customClass="UserViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BiK-DX-JK5" customClass="UserViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="oSS-7K-rER"/>
<viewControllerLayoutGuide type="bottom" id="Ba7-rp-yUE"/>
@@ -145,7 +145,7 @@
<constraint firstItem="jtr-dW-8XE" firstAttribute="top" secondItem="Z9a-At-6Ll" secondAttribute="top" id="zds-Uy-hOW"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Item" id="g86-Lf-lWF" customClass="AdaptiveTabBarItem" customModule="example_date_adaptive_tab_bar" customModuleProvider="target"/>
<tabBarItem key="tabBarItem" title="Item" id="g86-Lf-lWF" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ds1-lP-WuT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -154,7 +154,7 @@
<!--Item-->
<scene sceneID="RUI-wr-KlE">
<objects>
<viewController id="aXk-96-nwf" customClass="MenuViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="aXk-96-nwf" customClass="MenuViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Aha-rh-ib6"/>
<viewControllerLayoutGuide type="bottom" id="aNR-L8-QaD"/>
@@ -176,7 +176,7 @@
<constraint firstItem="aNR-L8-QaD" firstAttribute="top" secondItem="GGw-pn-6CX" secondAttribute="bottom" id="nys-sX-kRN"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Item" id="RnB-fU-3RS" customClass="AdaptiveTabBarItem" customModule="example_date_adaptive_tab_bar" customModuleProvider="target"/>
<tabBarItem key="tabBarItem" title="Item" id="RnB-fU-3RS" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Hsc-p3-elF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -185,7 +185,7 @@
<!--Item-->
<scene sceneID="B98-FR-Rjt">
<objects>
<viewController id="BgE-dr-gW8" customClass="MoreViewController" customModule="example_date_adaptive_tab_bar" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BgE-dr-gW8" customClass="MoreViewController" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="r9s-DG-v8Y"/>
<viewControllerLayoutGuide type="bottom" id="mju-qR-F4m"/>
@@ -195,18 +195,18 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="background" translatesAutoresizingMaskIntoConstraints="NO" id="fel-JW-y8K">
<rect key="frame" x="16" y="0.0" width="568" height="551"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="551"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="mju-qR-F4m" firstAttribute="top" secondItem="fel-JW-y8K" secondAttribute="bottom" id="czL-kW-Gi5"/>
<constraint firstItem="fel-JW-y8K" firstAttribute="top" secondItem="dgq-yB-Neb" secondAttribute="top" id="h6H-Nt-0EU"/>
<constraint firstItem="fel-JW-y8K" firstAttribute="leading" secondItem="dgq-yB-Neb" secondAttribute="leading" constant="16" id="lvq-kK-shl"/>
<constraint firstAttribute="trailing" secondItem="fel-JW-y8K" secondAttribute="trailing" constant="16" id="mnN-oR-w60"/>
<constraint firstItem="fel-JW-y8K" firstAttribute="leading" secondItem="dgq-yB-Neb" secondAttribute="leading" id="lvq-kK-shl"/>
<constraint firstAttribute="trailing" secondItem="fel-JW-y8K" secondAttribute="trailing" id="mnN-oR-w60"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Item" id="uWZ-JL-cND" customClass="AdaptiveTabBarItem" customModule="example_date_adaptive_tab_bar" customModuleProvider="target"/>
<tabBarItem key="tabBarItem" title="Item" id="uWZ-JL-cND" customClass="AdaptiveTabBarItem" customModule="example_count_launches_adaptive_tabbar" customModuleProvider="target"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="xAq-zT-Wnn" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@@ -215,6 +215,5 @@
</scenes>
<resources>
<image name="background" width="640" height="1136"/>
<image name="second" width="30" height="30"/>
</resources>
</document>
@@ -17,12 +17,19 @@ class AdaptiveTabBarItem: UITabBarItem , AdaptiveApperanceProtocol {
}
func setFontToAdaptiveButton(font: UIFont){
func setFontToAdaptiveButton(font: UIFont , controlState:UIControlState){
self.setTitleTextAttributes(NSDictionary(objects: [font], forKeys: [NSFontAttributeName]), forState: UIControlState.Normal)
self.setTitleTextAttributes(NSDictionary(objects: [font], forKeys: [NSFontAttributeName]), forState: controlState)
}
func setTitleColorToAdaptiveButton(color: UIColor, controlState:UIControlState){
var dictionary = self.titleTextAttributesForState(UIControlState.Normal)
dictionary.updateValue(color, forKey: NSForegroundColorAttributeName)
self.setTitleTextAttributes(dictionary, forState: controlState)
}
func setTitleToAdaptiveButton(text: NSString){
self.title = text
}
@@ -43,11 +50,7 @@ class AdaptiveTabBarItem: UITabBarItem , AdaptiveApperanceProtocol {
self.setTitlePositionAdjustment(offset)
}
func setTitleColorToAdaptiveButton(color: UIColor){
var dictionary = self.titleTextAttributesForState(UIControlState.Normal)
dictionary.updateValue(color, forKey: NSForegroundColorAttributeName)
self.setTitleTextAttributes(dictionary, forState: UIControlState.Normal)
}
@@ -2,9 +2,23 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildLocationStyle</key>
<string>UseAppPreferences</string>
<key>CustomBuildLocationType</key>
<string>RelativeToDerivedData</string>
<key>DerivedDataCustomLocation</key>
<string>DerivedData</string>
<key>DerivedDataLocationStyle</key>
<string>WorkspaceRelativePath</string>
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>IssueFilterStyle</key>
<string>ShowActiveSchemeOnly</string>
<key>LiveSourceIssuesEnabled</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<true/>
<key>SnapshotLocationStyle</key>
<string>Default</string>
</dict>
</plist>
@@ -9,12 +9,72 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/DictioanarySerializer.swift"
timestampString = "437068109.505856"
filePath = "AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437574364.516451"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "25"
endingLineNumber = "25">
startingLineNumber = "54"
endingLineNumber = "54"
landmarkName = "setupButtonsAppearanceFromState(_:buttonsAray:buttonsAppearances:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveController.AdaptiveButtonsStateManager.setupButtonsAppearanceFromState &lt;A&gt;(AdaptiveController.AdaptiveButtonsStateManager&lt;A&gt;.Type)(A, buttonsAray : Swift.Array&lt;AdaptiveController.AdaptiveApperanceProtocol&gt;, buttonsAppearances : Swift.Array&lt;AdaptiveController.AdaptiveButtonAppearance&gt;) -&gt; ()"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437511910.467646"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "62"
endingLineNumber = "62"
offsetFromSymbolStart = "6790">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "reabstraction thunk helper &lt;T_0_0 where T_0_0: AdaptiveController.AdaptiveState&gt; from @callee_owned (@unowned Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@unowned ()) to @callee_owned (@owned Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@unowned ())"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437511910.467845"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "62"
endingLineNumber = "62"
offsetFromSymbolStart = "15">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "reabstraction thunk helper &lt;T_0_0 where T_0_0: AdaptiveController.AdaptiveState&gt; from @callee_owned (@owned Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@unowned ()) to @callee_owned (@in Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@out ())"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437511910.468033"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "62"
endingLineNumber = "62"
offsetFromSymbolStart = "22">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "reabstraction thunk helper &lt;T_0_0 where T_0_0: AdaptiveController.AdaptiveState&gt; from @callee_owned (@in Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@out ()) to @callee_owned (@owned Swift.Optional&lt;ObjectiveC.UIImage&gt;) -&gt; (@unowned ())"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437511910.468154"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "62"
endingLineNumber = "62"
offsetFromSymbolStart = "27">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
@@ -23,12 +83,220 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/DictioanarySerializer.swift"
timestampString = "437068109.505856"
filePath = "Samples/adaptive-launches-tabbar/adaptive-launches-tabbar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437511146.16835"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "38"
endingLineNumber = "38"
landmarkName = "setImageToAdaptiveButton(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Samples/adaptive-launches-tabbar/adaptive-launches-tabbar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437556805.775899"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
landmarkName = "setFontToAdaptiveButton(_:controlState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Samples/adaptive-launches-tabbar/adaptive-launches-tabbar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437556819.298386"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "21"
endingLineNumber = "21"
landmarkName = "setFontToAdaptiveButton(_:controlState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Samples/adaptive-launches-tabbar/adaptive-launches-tabbar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437556837.150922"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "29"
endingLineNumber = "29"
landmarkName = "setTitleColorToAdaptiveButton(_:controlState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Samples/adaptive-launches-tabbar/adaptive-launches-tabbar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437556844.951962"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "27"
endingLineNumber = "27">
endingLineNumber = "27"
landmarkName = "setTitleColorToAdaptiveButton(_:controlState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/ControlStateAppearance.swift"
timestampString = "437572295.023066"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "209"
endingLineNumber = "209"
landmarkName = "setObjectDictionary(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437573877.33263"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "33"
endingLineNumber = "33"
landmarkName = "setupButtonsAppearanceFromState(_:buttonsAray:buttonsAppearances:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveDateState.swift"
timestampString = "437573962.85138"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
landmarkName = "stateRemainDays(_:countDaysToSmallTextState:countDaysToImageState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveDateState.swift"
timestampString = "437573964.596475"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "46"
endingLineNumber = "46"
landmarkName = "stateRemainDays(_:countDaysToSmallTextState:countDaysToImageState:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveDateState.swift"
timestampString = "437573967.947855"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "22"
endingLineNumber = "22"
landmarkName = "init(installDate:currentDate:countDaysToSmallTextState:countDaysToImageState:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveController.AdaptiveDateState.init (AdaptiveController.AdaptiveDateState.Type)(installDate : ObjectiveC.NSDate, currentDate : ObjectiveC.NSDate, countDaysToSmallTextState : Swift.Int, countDaysToImageState : Swift.Int) -&gt; AdaptiveController.AdaptiveDateState"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveDateState.swift"
timestampString = "437574130.940246"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "23"
endingLineNumber = "23"
offsetFromSymbolStart = "261">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveController.AdaptiveDateState.init (AdaptiveController.AdaptiveDateState.Type)(installDate : ObjectiveC.NSDate, currentDate : ObjectiveC.NSDate, countDaysToSmallTextState : Swift.Int, countDaysToImageState : Swift.Int) -&gt; AdaptiveController.AdaptiveDateState"
moduleName = "AdaptiveController"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveController/AdaptiveDateState.swift"
timestampString = "437574130.940351"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "23"
endingLineNumber = "23"
offsetFromSymbolStart = "283">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437574364.516451"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "setupButtonsAppearanceFromState(_:buttonsAray:buttonsAppearances:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveButtonsStateManager.swift"
timestampString = "437574360.622633"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "40"
endingLineNumber = "40"
landmarkName = "setupButtonsAppearanceFromState(_:buttonsAray:buttonsAppearances:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
@@ -38,14 +306,154 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveController/AdaptiveButtonAppearance.swift"
timestampString = "436988297.48616"
timestampString = "437574477.784606"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "113"
endingLineNumber = "113"
landmarkName = "getButonTitleForState(_:controlState:)"
startingLineNumber = "46"
endingLineNumber = "46"
landmarkName = "setObjectDictionary(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Samples/adaptive-dates-tabbar/adaptive-tab-bar/CustomTabBar/AdaptiveTabBarItem.swift"
timestampString = "437677746.631783"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "29"
endingLineNumber = "29"
landmarkName = "setImageToAdaptiveButton(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveControllerTests/AdaptiveButtonAppearanceTest.swift"
timestampString = "438276611.63638"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "21"
endingLineNumber = "21"
landmarkName = "testAppearanceSetup()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveControllerTests/AdaptiveDateStateTest.swift"
timestampString = "437905449.96838"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "37"
endingLineNumber = "37"
landmarkName = "testDefaultState()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveControllerTests.AdaptiveDateStateTest.testDefaultState (AdaptiveControllerTests.AdaptiveDateStateTest)() -&gt; ()"
moduleName = "AdaptiveControllerTests"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveControllerTests/AdaptiveDateStateTest.swift"
timestampString = "437915565.762825"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "37"
endingLineNumber = "37"
offsetFromSymbolStart = "46">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveControllerTests.AdaptiveDateStateTest.(testDefaultState (AdaptiveControllerTests.AdaptiveDateStateTest) -&gt; () -&gt; ()).(implicit closure #1)"
moduleName = "AdaptiveControllerTests"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveControllerTests/AdaptiveDateStateTest.swift"
timestampString = "437915565.763012"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "37"
endingLineNumber = "37"
offsetFromSymbolStart = "45">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveControllerTests/AdaptiveLaunchesStateTest.swift"
timestampString = "437915542.065597"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "52"
endingLineNumber = "52"
landmarkName = "testImageState()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "AdaptiveController/AdaptiveControllerTests/AdaptiveButtonAppearanceTest.swift"
timestampString = "438277726.218459"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "55"
endingLineNumber = "55"
landmarkName = "testAppearanceSetup()"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveControllerTests.AdaptiveButtonAppearanceTest.testAppearanceSetup (AdaptiveControllerTests.AdaptiveButtonAppearanceTest)() -&gt; ()"
moduleName = "AdaptiveControllerTests"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveControllerTests/AdaptiveButtonAppearanceTest.swift"
timestampString = "438277726.876122"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "55"
endingLineNumber = "55"
offsetFromSymbolStart = "4712">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "AdaptiveControllerTests.AdaptiveButtonAppearanceTest.(testAppearanceSetup (AdaptiveControllerTests.AdaptiveButtonAppearanceTest) -&gt; () -&gt; ()).(implicit closure #2)"
moduleName = "AdaptiveControllerTests"
urlString = "file:///Users/arcilite/adaptive-tab-bar/AdaptiveController/AdaptiveControllerTests/AdaptiveButtonAppearanceTest.swift"
timestampString = "438277726.876251"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "55"
endingLineNumber = "55"
offsetFromSymbolStart = "24">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
-5
View File
@@ -1,5 +0,0 @@
language: objective-c
before_install: git submodule update --init --recursive
script: "rake test:ios"
#xcode_workspace: adaptive-tab-bar/SamplesAdaptiveController.xcworkspace # path to your xcodeproj folder
#xcode_scheme: AdaptiveControllerTests