[ios, macos] Sources, layers properties are immutable
If you need a mutable array of layers, use -mutableArrayValueForKey:.
This commit is contained in:
committed by
Minh Nguyễn
parent
188a61af55
commit
b6f7d03e5d
@@ -189,7 +189,7 @@ static const NSInteger MGLStyleDefaultVersion = 9;
|
||||
/**
|
||||
A set containing the style’s sources.
|
||||
*/
|
||||
@property (nonatomic, strong) NS_MUTABLE_SET_OF(MGLSource *) *sources;
|
||||
@property (nonatomic, strong) NS_SET_OF(MGLSource *) *sources;
|
||||
|
||||
/**
|
||||
Returns a source with the given identifier in the current style.
|
||||
@@ -240,7 +240,7 @@ static const NSInteger MGLStyleDefaultVersion = 9;
|
||||
The layers included in the style, arranged according to their back-to-front
|
||||
ordering on the screen.
|
||||
*/
|
||||
@property (nonatomic, strong) NS_MUTABLE_ARRAY_OF(MGLStyleLayer *) *layers;
|
||||
@property (nonatomic, strong) NS_ARRAY_OF(MGLStyleLayer *) *layers;
|
||||
|
||||
/**
|
||||
Returns a style layer with the given identifier in the current style.
|
||||
|
||||
@@ -127,7 +127,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
|
||||
#pragma mark Sources
|
||||
|
||||
- (NS_MUTABLE_SET_OF(MGLSource *) *)sources {
|
||||
- (NS_SET_OF(MGLSource *) *)sources {
|
||||
auto rawSources = self.mapView.mbglMap->getSources();
|
||||
NSMutableSet *sources = [NSMutableSet setWithCapacity:rawSources.size()];
|
||||
for (auto rawSource = rawSources.begin(); rawSource != rawSources.end(); ++rawSource) {
|
||||
@@ -137,7 +137,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
return sources;
|
||||
}
|
||||
|
||||
- (void)setSources:(NS_MUTABLE_SET_OF(MGLSource *) *)sources {
|
||||
- (void)setSources:(NS_SET_OF(MGLSource *) *)sources {
|
||||
for (MGLSource *source in self.sources) {
|
||||
[self removeSource:source];
|
||||
}
|
||||
@@ -222,7 +222,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
|
||||
#pragma mark Style layers
|
||||
|
||||
- (NS_MUTABLE_ARRAY_OF(MGLStyleLayer *) *)layers
|
||||
- (NS_ARRAY_OF(MGLStyleLayer *) *)layers
|
||||
{
|
||||
auto layers = self.mapView.mbglMap->getLayers();
|
||||
NSMutableArray *styleLayers = [NSMutableArray arrayWithCapacity:layers.size()];
|
||||
@@ -233,7 +233,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
return styleLayers;
|
||||
}
|
||||
|
||||
- (void)setLayers:(NS_MUTABLE_ARRAY_OF(MGLStyleLayer *) *)layers {
|
||||
- (void)setLayers:(NS_ARRAY_OF(MGLStyleLayer *) *)layers {
|
||||
for (MGLStyleLayer *layer in self.layers) {
|
||||
[self removeLayer:layer];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user