Basic Observation Request

Request observation data for a single location and display certain field values in text labels. The subviews have been setup as IBOutlets in the view controller.


@interface MyViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *tempTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *weatherTextLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;



#import <Aeris/Aeris.h>

@implementation MyViewController

- (void)viewDidAppear:(BOOL)animated {
	[super viewDidAppear:animated];

	AWFPlace *place = [AWFPlace placeWithCity:@"minneapolis" state:@"mn" country:@"us"];
	AWFObservationsLoader *loader = [[AWFObservationsLoader alloc] init];

	[loader getObservationForPlace:place options:nil completion:^(NSArray *objects, NSError *error) {
		if (error) {
			NSLog(@"Observation data failed to load! %@", error);

		if ([objects count] > 0) {
			AWFObservation *obs = (AWFObservation *)[objects objectAtIndex:0];

			self.tempTextLabel.text = [NSString stringWithFormat:@"%i%@", [obs.tempF integerValue], AWFDegree];
			self.weatherTextLabel.text =;
			self.iconImageView.image = [AWFImage weatherIconNamed:obs.icon];



let place = AWFPlace(city: "minneapolis", state: "mn", country: "us")
let loader = AWFObservationsLoader()

loader.getObservationFor(place, options: nil) { (objects, error) in
	if let error = error {
		print("Observation data failed to load! \(error)")
	if let obs = objects?.first as? AWFObservation {
		tempTextLabel.text = "\(obs.tempF.intValue)"
		weatherTextLabel.text =
		if let icon = obs.icon {
			iconImageView.image = AWFImage.weatherIconNamed(icon)

Last modified: November 02, 2017