CRSUnit

Objective-C

@interface CRSUnit : NSObject <CRSIdentifiable>

Swift

class CRSUnit : NSObject, CRSIdentifiable

Unit

  • Unit Type

    Declaration

    Objective-C

    @property (nonatomic) enum CRSUnitType type;

    Swift

    var type: CRSUnitType { get set }
  • Name

    Declaration

    Objective-C

    @property (nonatomic, strong) NSString *name;

    Swift

    var name: String! { get set }
  • Conversion Factor

    Declaration

    Objective-C

    @property (nonatomic, strong) NSDecimalNumber *conversionFactor;

    Swift

    var conversionFactor: NSDecimalNumber! { get set }
  • Conversion Factor Text

    Declaration

    Objective-C

    @property (nonatomic, strong) NSString *conversionFactorText;

    Swift

    var conversionFactorText: String! { get set }
  • Identifiers

    Declaration

    Objective-C

    @property (nonatomic, strong) NSMutableArray<CRSIdentifier *> *identifiers;

    Swift

    var identifiers: NSMutableArray! { get set }
  • Create

    Declaration

    Objective-C

    + (CRSUnit *)create;

    Swift

    class func create() -> CRSUnit!

    Return Value

    new instance

  • Create

    Declaration

    Objective-C

    + (CRSUnit *)createWithType:(enum CRSUnitType)type andName:(NSString *)name;

    Swift

    class func create(with type: CRSUnitType, andName name: String!) -> CRSUnit!

    Parameters

    type

    unit type

    name

    name

    Return Value

    new instance

  • Create

    Declaration

    Objective-C

    + (CRSUnit *)createWithType:(enum CRSUnitType)type
                        andName:(NSString *)name
            andConversionFactor:(double)conversionFactor;

    Swift

    class func create(with type: CRSUnitType, andName name: String!, andConversionFactor conversionFactor: Double) -> CRSUnit!

    Parameters

    type

    unit type

    name

    name

    conversionFactor

    conversion factor

    Return Value

    new instance

  • Create

    Declaration

    Objective-C

    + (CRSUnit *)createWithType:(enum CRSUnitType)type
                        andName:(NSString *)name
        andConversionFactorText:(NSString *)conversionFactor;

    Swift

    class func create(with type: CRSUnitType, andName name: String!, andConversionFactorText conversionFactor: String!) -> CRSUnit!

    Parameters

    type

    unit type

    name

    name

    conversionFactor

    conversion factor

    Return Value

    new instance

  • Initialize

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()

    Return Value

    new instance

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithType:(enum CRSUnitType)type andName:(NSString *)name;

    Swift

    init!(type: CRSUnitType, andName name: String!)

    Parameters

    type

    unit type

    name

    name

    Return Value

    new instance

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithType:(enum CRSUnitType)type
                         andName:(NSString *)name
             andConversionFactor:(double)conversionFactor;

    Swift

    init!(type: CRSUnitType, andName name: String!, andConversionFactor conversionFactor: Double)

    Parameters

    type

    unit type

    name

    name

    conversionFactor

    conversion factor

    Return Value

    new instance

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithType:(enum CRSUnitType)type
                         andName:(NSString *)name
         andConversionFactorText:(NSString *)conversionFactor;

    Swift

    init!(type: CRSUnitType, andName name: String!, andConversionFactorText conversionFactor: String!)

    Parameters

    type

    unit type

    name

    name

    conversionFactor

    conversion factor

    Return Value

    new instance

  • Has a conversion factor

    Declaration

    Objective-C

    - (BOOL)hasConversionFactor;

    Swift

    func hasConversionFactor() -> Bool

    Return Value

    true if has conversion factor

  • Determine if the unit names are equal, ignoring case

    Declaration

    Objective-C

    - (BOOL)isEqualNameToUnit:(CRSUnit *)unit;

    Swift

    func isEqualName(to unit: CRSUnit!) -> Bool

    Return Value

    true if equal names