NSString(SKSensorType)

@interface NSString (SKSensorType)

NSString+SKSensorType is a category responsible for converting an SKSensorType enum into string.

  • Converts an SKSensorType enum into a string. This method is useful when you want to use the sensor name in the application’s User Interface. The returned string might contain spaces or special characters (such as ‘™’). For example, iBeacon™ Proximity sensor (enum iBeaconProximity) will be returned as “iBeacon™ Proximity”.

    Declaration

    Objective-C

    + (nonnull NSString *)stringWithSensorType:(SKSensorType)sensorType;

    Swift

    /*not inherited*/ init(sensorType: SKSensorType)

    Parameters

    sensorType

    The type of the sensor.

    Return Value

    A string with the sensor name. (e.g. “iBeacon™ Proximity”).

  • Converts an SKSensorType enum into a non-spaced string that does not include special characters. This method is useful when you want to use the sensor name in file or directory names. The returned string does not contain spaces or any special character (such as ‘™’). For example, iBeacon™ Proximity sensor (enum iBeaconProximity) will be returned as “iBeaconProximity”.

    Declaration

    Objective-C

    + (nonnull NSString *)nonspacedStringWithSensorType:(SKSensorType)sensorType;

    Swift

    class func nonspacedString(with sensorType: SKSensorType) -> String

    Parameters

    sensorType

    The type of the sensor.

    Return Value

    A non-spaced string with the sensor name. (e.g. “iBeaconProximity”).