[6.0.0] - 2022-05-04
This major version has accompanying migration guides for Swift and Objective-C. Please see the guide for more information on updating to this version of the SDK, as the following is just a summary of the changes.
Note that Objective-C bridging types are prefixed by Objc, but that prefix is not exposed to code written in Objective-C. For example, changes listed to ObjcLDClient are changes to the class referred to as LDClient from within Objective-C.
Added
- Added the
LDValueclass to represent any data type that is allowed in JSON. This new type is used to provide more type safety when representing complex or non-statically determined data types. The SDK also provides the bridge typesObjcLDValueandObjcLDValueTypefor Objective-C interoperability. - Added the
UserAttributeclass which provides a less error-prone way to refer to user attribute names in configuration. - Added the type specific variation functions,
boolVariation,intVariation,doubleVariation,stringVariation, andjsonVariation, toLDClient. - Added the type specific detailed variation functions,
boolVariationDetail,intVariationDetail,doubleVariationDetail,stringVariationDetail, andjsonVariationDetail, toLDClient. - Added
jsonVariationandjsonVariationDetailtoObjcLDClient. These functions allow evaluating feature flags where the provideddefaultValueand the resulting variation can be any valid JSON data type. - Added
ObjcLDJSONEvaluationDetailfor retrieving the detailed evaluation information of arbitrary type flag variations. - Added
ObjcLDChangedFlagHandlertype alias for new non-type specific Objective-C flag observers.
Changed (API)
LDClient.track(key: data: metricValue:)no longerthrows.- The type of the
dataparameter ofLDClient.track(key: data: metricValue:)has changed fromAny?toLDValue?. ObjcLDClient.track(key: data:)andObjcLDClient.track(key: data: metricValue:)no longerthrows. In Objective-C this change means that thetrackfunctions no longer accept aerror:parameter.- The type of the
dataparameter ofObjcLDClient.track(key: data:)andObjcLDClient.track(key: data: metricValue)has changed fromAny?toObjLDValue?. In Objective-C this would be a change fromid _NullabletoLDValue * _Nullable. LDClient.allFlagsnow has the type[LDFlagKey: LDValue]?rather than[LDFlagKey: Any]?.ObjcLDClient.allFlagsnow has the type[String: ObjcLDValue]?rather than[String: Any]?. In Objective-C this would be a change fromNSDictionary<NSString*, id> * _NullabletoNSDictionary<NSString*, LDValue*> * _Nullable.- The type of the
LDUser.customdictionary, and the correspondingLDUser.initparameter has been changed from[String: Any]?to[String: LDValue]. - The type of the
ObjcLDUser.customproperty has been changed from[String: Any]?to[String: ObjcLDValue]. In Objective-C this would be a change fromNSDictionary<NSString*, id> * _NullabletoNSDictionary<NSString*, LDValue*> * _Nonnull. - The type of the
LDUser.privateAttributesproperty, and the correspondingLDUser.initparameter, have been changed from[String]?to[UserAttribute]. - The type of the
ObjcLDUser.privateAttributesproperty has been changed from[String]?to[String]. In Objective-C this would be a change fromNSArray<NSString*> * _NullabletoNSArray<NSString*> * _Nonnull. - The types of the properties
LDChangedFlag.oldValueandLDChangedFlag.newValuehave been changed fromAny?toLDValue. - The type of the
LDConfig.privateUserAttributesproperty has been changed from[String]?to[UserAttribute]. ObjcLDConfig.privateUserAttributesnow has the non-optional type[String]rather than[String]?. In Objective-C this would be a change fromNSArray<NSString*> * _NullabletoNSArray<NSString*> * _Nonnull.- The type of the
LDEvaluationDetail.reasonproperty has been changed from[String: Any]to[String: LDValue]. - The type of the
reasonproperty ofObjcLDBoolEvaluationDetail,ObjcLDIntegerEvaluationDetail,ObjcLDDoubleEvaluationDetail, andObjcLDStringEvaluationDetailhas been changed from[String: Any]?to[String: ObjcLDValue]?. In Objective-C this would be a change fromNSDictionary<NSString*, id> * _NullabletoNSDictionary<NSString*, LDValue*> * _Nullable.
Changed (behavioral)
- The
Equatableinstance forLDUserhas been changed to compare all user properties, rather than just thekeyproperty. - Using
"custom"as a private attribute name inLDConfig.privateUserAttributesorLDUser.privateAttributeswill no longer set allLDUsercustom attributes private. - The automatically set
deviceandoperatingSystemcustom attributes can now be set private. - SDK versions from 4.0.0 and less than 6.0.0 supported migration of cached flag data from any SDK version of at least 2.3.3. The 6.0.0 release only supports migration of cached flag data from SDK versions of at least 4.0.0.
Removed
- Removed
LDClient.variation(forKey: defaultValue:)andLDClient.variationDetail(forKey: defaultValue:)functions. Please use the new type-specific variation functions instead (e.g.LDClient.boolVariation(forKey: defaultValue:)). - Removed the
LDFlagValueConvertibleprotocol which was previously used to constrain the parameters and return types of the variation functions. LDErrorHandlerandLDClient.observeError(owner: handler:)have been removed. Please useConnectionInformationinstead.- Removed the
LDUser.init(userDictionary: )andObjcLDUser.init(userDictionary: )initializers, please use the explicit initializers instead. - Removed
LDUser.CodingKeys. To refer to user attributes, please useUserAttributeinstead. - Removed
LDUser.privatizableAttributesandObjcLDUser.privatizableAttributes. - Removed
ObjcLDUser.attributeCustom. - The
LDUser.deviceandLDUser.operatingSystemproperties, and the correspondingLDUser.initparameters have been removed. These fields will be included in theLDUser.customdictionary. - The
ObjcLDUser.deviceandObjcLDUser.operatingSystemproperties have been removed. These fields will be included in theObjcLDUser.customdictionary. - The
ObjcLDClientfunctions,arrayVariation,arrayVariationDetail,dictionaryVariation, anddictionaryVariationDetail, have been removed. Please useObjcLDClient.jsonVariationandObjcLDClient.jsonVariationDetailinstead. - The per-type instances of
ObjcLDChangedFlaghave been removed. Please use the base classObjcLDChangedFlag, which now providesoldValueandnewValueObjcLDValueproperties. The removed classes areObjcLDBoolChangedFlag,ObjcLDIntegerChangedFlag,ObjcLDDoubleChangedFlag,ObjcLDStringChangedFlag,ObjcLDArrayChangedFlag, andObjcLDDictionaryChangedFlag. - The classes
ObjcLDArrayEvaluationDetailandObjcLDDictionaryEvaluationDetailhave been removed. Please useObjcLDJSONEvaluationDetailinstead. - The type aliases,
ObjcLDBoolChangedFlagHandler,ObjcLDIntegerChangedFlagHandler,ObjcLDDoubleChangedFlagHandler,ObjcLDStringChangedFlagHandler,ObjcLDArrayChangedFlagHandler, andObjcLDDictionaryChangedFlagHandler, have been removed. Please useObjcLDChangedFlagHandlerinstead. - The
ObjcLDClientfunctions,observeBool,observeInteger,observeDouble,observeString,observeArray, andobserveDictionary, have been removed. Please use the non-type specificObjcLDClient.observe(key: owner: handler:)instead.