# GoogleMaps Framework Reference

# GMSFeatureLayer


    @interface GMSFeatureLayer<__covariant T : id <https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSFeature.html>> : NSObject

A class representing a collection of all features of the same `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Type-Definitions/GMSFeatureType.html`, whose style can
be overridden on the client. Each `https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Type-Definitions/GMSFeatureType.html` will have one corresponding `GMSFeatureLayer`.
- `


  ### [featureType](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureLayer#/c:objc(cs)GMSFeatureLayer(py)featureType)


  ` The feature type associated with this layer. All features associated with the layer will be of
  this type.

  #### Declaration

  Swift

      var featureType: FeatureType { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Type-Definitions/GMSFeatureType.html _Nonnull featureType;

- `


  ### [available](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureLayer#/c:objc(cs)GMSFeatureLayer(py)available)


  ` Determines if the data-driven `GMSFeatureLayer` is available. Data-driven styling requires
  the Metal Framework, a valid map ID and that the feature type be applied.
  If `NO`, styling for the `GMSFeatureLayer` returns to the default and events are not triggered.

  #### Declaration

  Swift

      var isAvailable: Bool { get }

  Objective-C

      @property (nonatomic, readonly, getter=isAvailable) BOOL available;

- `


  ### [style](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureLayer#/c:objc(cs)GMSFeatureLayer(py)style)


  ` Styling block to be applied to all features in this layer.

  The style block is applied to all visible features in the viewport when the setter is called, and
  is run multiple times for the subsequent features entering the viewport.

  The function is required to be deterministic and return consistent results when it is applied
  over the map tiles. If any styling specs of any feature would be changed, `style` must be set
  again. Changing behavior of the style block without calling the `style` setter will result in
  undefined behavior, including stale and/or shattered map renderings. See the example below:

       var selectedPlaceIDs = Set<String>()
       var style = FeatureStyle(fill: .red, stroke: .clear, strokeWidth: 0)
       layer.style = { feature in
         selectedPlaceIDs.contains(feature.placeID) ? style : nil
       }


       selectedPlaceIDs.insert("foo")

       style = FeatureStyle(fill: .clear, stroke: .blue, strokeWidth: 1.5)


       layer.style = { feature in
         selectedPlaceIDs.contains(feature.placeID) ? style : nil
       }

  #### Declaration

  Swift

      var style: ((T) -> FeatureStyle?)? { get set }

  Objective-C

      @property (nonatomic, nullable) https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureStyle.html *_Nullable (^)(T _Nonnull) style;

- `


  ### [-initWithFeatureType:](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureLayer#/c:objc(cs)GMSFeatureLayer(im)initWithFeatureType:)


  ` Create a feature layer instance for testing.

  This method should be used for your unit tests only. In production, `GMSFeatureLayer` instances
  should only be created by the SDK.

  #### Declaration

  Swift

      convenience init(featureType: FeatureType)

  Objective-C

      - (nonnull instancetype)initWithFeatureType:(nonnull https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Type-Definitions/GMSFeatureType.html)featureType;

- `


  ### [-init](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSFeatureLayer#/c:objc(cs)GMSFeatureLayer(im)init)


  ` Unavailable

  #### Declaration

  Objective-C

      - (instancetype)init NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE;