June 26

AerisWeather iOS SDK 3.0 Now Available

Early this year, we teased the new major version of our AerisWeather iOS SDK, version 3.0, with several public betas to begin testing and experimenting with. We’re excited to announce that as of the end of May, the official 3.0 version has been released. In fact, we’re already up to version 3.0.2 as we’ve been releasing several bug fixes and improvements since the initial release of 3.0 at the end of May.

In case you missed it, here are the biggest changes in version 3.0:

Naming Changes for API Endpoint Classes

In version 2.0 of the iOS SDK, you would use a series of object loaders to request data from the AerisWeather API. Now in version 3.0, we’ve cleaned this up and changed these classes to be subclasses of AWFWeatherEndpoint and include one endpoint request class per API endpoint and/or sub endpoint.

For example, to request observation data in version 2.0 you would need to use AWFObservationsLoader. Now in version 3.0, you use the AWFObservations endpoint class to request the same data, both of which return instances of AWFObservation:

AWFPlace *place = [AWFPlace placeWithCity:@"seattle" state:@"wa" country:@"us"];
[[AWFObservations sharedService] getForPlace:place options:nil completion:^(AWFWeatherEndpointResult * _Nullable result) {
	if (result.error) {
		NSLog(@"error: %@", result.error.localizedDescription);
		return;
	}
	
	AWFObservation *obs = (AWFObservation *)[result.results firstObject];
}];

The endpoint request class will always be named as the plural form of the model class it returns in most cases. Refer to the endpoint documentation for AerisWeatherKit for the full set of endpoint request classes.

You’ll also find that our weather model classes in version 3.0, which are subclasses of AWFWeatherObject, use appropriate numerical value types, such as CGFloat and NSInteger, instead of storing all numerical values as NSNumber objects. This should make it easier to use without having to convert an NSNumber to the desired value types when working with them in your applications.

Refer to our Loading Data guide for more details and examples on requesting data from the AerisWeather API using the SDK.

Full Support for AerisWeather Mapping Platform (AMP) Features

Version 3.0 of the iOS SDK now supports the complete set of weather layers and features available with the AerisWeather Mapping Platform (AMP), such as adding layer modifiers, text values and/or image filters to specific layers. You can read more about these changes in our AMP usage guide.

Version 3.0 still supports the simple method for adding and removing weather layers on a map by using a series of enumerated layer type values. In version 2.0 these were

AWFLayerType

  enumerated integer values, such as

AWFLayerTypeRadar

  and

AWFLayerTypeTemperatures

 . In version 3.0 we’ve improved this to be

AWFMapLayer

  enumerated string values so that each value contains the appropriate AerisWeather Mapping Platform layer code. For example,

AWFMapLayerRadar

  corresponds to the

radar

  layer code, while

AWFMapLayerDewPoints

  corresponds to the

dew-points

  layer code. The benefit of this is even more evident when using the SDK in Swift, which allows you to refer to these types as

.radar

  and

.dewPoints

  instead of the full enumeration type name. Refer to the Managing Layers guide for more details regarding managing layers by enumerated values.

But since version 3.0 of the iOS SDK now supports the full feature set available with AMP, you have even more control over the appearance of your weather layers on your map. Instead of adding and removing layers by enumerated map layer values as described above, you can add instances of

AWFRasterMapLayer

  to your

AWFWeatherMap

  instance. Each AWFRasterMapLayer instance is associated with an individual AMP layer, which can either be provided using one of the supported AWFMapLayer enumerated values as above, or by using the actual AMP layer code string. Furthermore, you can set additional AMP options for this layer, such as setting its opacity, changing its style or adding modifiers, filters or masks.

For example, to simply display current temperatures:

let layer = AWFRasterMapLayer(layerType: .temperatures)
weatherMap.amp.addRasterLayer(layer)

But your want to remove the data over the water regions:

let layer = AWFRasterMapLayer(layerType: .temperatures)
layer.mask = .removeWater
weatherMap.amp.addRasterLayer(layer)

And to reduce the opacity:

let layer = AWFRasterMapLayer(layerType: .temperatures)
layer.mask = .removeWater
layer.alpha = 0.5
weatherMap.amp.addRasterLayer(layer)

Finally, you want to add temperature text labels on top of the data:

let layer = AWFRasterMapLayer(layerType: .temperatures)
layer.mask = .removeWater
layer.alpha = 0.5
weatherMap.amp.addRasterLayer(layer)
weatherMap.amp.addTextLayer(forRasterLayer: layer)

Refer to our AMP Usage guide for more details and examples using AWFRasterMapLayer for managing weather layers on your map.

Library Architecture Changes

Version 3.0 now requires iOS 9.0 or higher and Xcode 8 or higher as the libraries are compiled as dynamic frameworks. Static versions of the libraries are also available in case your project requires them, but it is not recommended. We’ve also removed the library’s dependency on AFNetworking, so you no longer need to load in additional third-party dependencies when using our SDK. The structure of the frameworks have also changed, which you can find out more about in our 3.0 migration guide.

Also, if you’re an existing version 2.0 user and require the built-in weather views in your projects, you’ll definitely want learn more about the removal of these built-in views from the core library in our 3.0 migration guide.

Improved Swift Interoperability

Our iOS SDK continues to be written in Objective-C since the original version, but Swift adoption has been increasing exponentially recently. And while our frameworks have always worked with Swift projects, we realized it could be a lot better. Version 3.0 now has vastly improved Swift interoperability, such as proper nullability annotations, modified method naming for Swift, widespread usage of lightweight generics where applicable, string enumeration values and more.

Support for Mapbox GL

We now support the full Mapbox GL SDK for iOS with version 3.0, meaning you can take advantage of Mapbox’s new mapping platform while still using data from our API and mapping services. Review our Mapbox SDK Support guide for more details on how to work with Mapbox using our SDK.

Get Started with AerisWeather iOS SDK 3.0

You can quickly get started with the latest version of our iOS SDK by using one of the various installation methods for your iOS projects. Also be sure to check out our demo application on Github that demonstrates much of the functionality built into the SDK. Not currently an AerisWeather API or AerisWeather Mapping Platform user? Check out our Free Developer Trial or contact our accounts team for assistance in getting started with an account.

Share this post:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

AerisWeather
{{page_content}}