Skip to content

Commit

Permalink
Version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Krivoblotsky committed Nov 11, 2013
1 parent b044493 commit 71787e0
Show file tree
Hide file tree
Showing 36 changed files with 1,156 additions and 2 deletions.
4 changes: 2 additions & 2 deletions APTimeZones.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'APTimeZones'
s.version = '1.0.1'
s.version = '1.1'
s.platform = :ios, '6.0'
s.homepage = 'https://github.com/Alterplay/APTimeZones'
s.license = { :type => 'MIT', :file => 'LICENSE.txt' }
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
}
s.source = {
:git => 'https://github.com/Alterplay/APTimeZones.git',
:tag => '1.0.1'
:tag => '1.1'
}
s.source_files = 'APTimeZones/*.{h,m}'
s.requires_arc = true
Expand Down
2 changes: 2 additions & 0 deletions APTimeZones/APTimeZones.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "CLLocation+APTimeZones.h"
#import "CLPlacemark+APTimeZones.h"

@interface APTimeZones : NSObject

Expand Down
13 changes: 13 additions & 0 deletions APTimeZones/Categories/CLLocation+APTimeZones.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CLLocation+APTimeZones.h
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import <CoreLocation/CoreLocation.h>

@interface CLLocation (APTimeZones)
- (NSTimeZone *)timeZone;
@end
20 changes: 20 additions & 0 deletions APTimeZones/Categories/CLLocation+APTimeZones.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// CLLocation+APTimeZones.m
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import "CLLocation+APTimeZones.h"
#import "APTimeZones.h"

@implementation CLLocation (APTimeZones)

- (NSTimeZone *)timeZone {
NSTimeZone *timeZone = [[APTimeZones sharedInstance] timeZoneWithLocation:self];
return timeZone;

}

@end
13 changes: 13 additions & 0 deletions APTimeZones/Categories/CLPlacemark+APTimeZones.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CLPlacemark+APTimeZones.h
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import <CoreLocation/CoreLocation.h>

@interface CLPlacemark (APTimeZones)
- (NSTimeZone *)timeZone;
@end
23 changes: 23 additions & 0 deletions APTimeZones/Categories/CLPlacemark+APTimeZones.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// CLPlacemark+APTimeZones.m
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import "CLPlacemark+APTimeZones.h"
#import "APTimeZones.h"

@implementation CLPlacemark (APTimeZones)

- (NSTimeZone *)timeZone {
CLLocation *location = self.location;

NSString *countryCode = self.addressDictionary[@"CountryCode"];
NSTimeZone *timeZone = [[APTimeZones sharedInstance] timeZoneWithLocation:location
countryCode:countryCode];
return timeZone;
}

@end
542 changes: 542 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Example/Example/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
17 changes: 17 additions & 0 deletions Example/Example/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.m
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}

@end
146 changes: 146 additions & 0 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="maJ-kK-IUM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="I15-u1-Lkd">
<objects>
<navigationController definesPresentationContext="YES" id="maJ-kK-IUM" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="kiO-Tk-sur">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="yiS-o9-INR" kind="relationship" relationship="rootViewController" id="VFN-vv-Hw8"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eyd-Su-Owo" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-365" y="58"/>
</scene>
<!--View Controller - Select Example-->
<scene sceneID="mSc-JW-MKg">
<objects>
<viewController id="yiS-o9-INR" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="IwP-n5-Nf5">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="mFm-2H-Elw">
<rect key="frame" x="49" y="208" width="223" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<state key="normal" title="Using Coordinates">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<segue destination="BE9-TM-ICB" kind="push" id="EEg-5d-ohQ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="uac-0e-a9Q">
<rect key="frame" x="49" y="353" width="223" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<state key="normal" title="Using CLGeocoder">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<segue destination="f4u-Ua-0T2" kind="push" id="c3p-7l-Ox4"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="Select Example" id="bm0-t9-JEm"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rbr-am-ALl" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="146" y="44"/>
</scene>
<!--Geo Coder View Controller - Geo Coder-->
<scene sceneID="9CF-gJ-4bG">
<objects>
<viewController id="f4u-Ua-0T2" customClass="GeoCoderViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="kDg-qX-yfx">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter city name" minimumFontSize="17" id="vBN-tZ-HkL">
<rect key="frame" x="20" y="78" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="go"/>
<connections>
<outlet property="delegate" destination="f4u-Ua-0T2" id="9p4-YL-236"/>
</connections>
</textField>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" id="EXt-g0-p5V">
<rect key="frame" x="0.0" y="116" width="320" height="186"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<inset key="contentInset" minX="16" minY="0.0" maxX="32" maxY="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="Geo Coder" id="eXT-7k-ovN"/>
<connections>
<outlet property="textField" destination="vBN-tZ-HkL" id="YgK-JD-Ys2"/>
<outlet property="textView" destination="EXt-g0-p5V" id="XsX-wk-7Ua"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="d6A-Vd-YyM" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="654" y="460"/>
</scene>
<!--Map View Controller - Time Zones-->
<scene sceneID="wwT-Mt-iY2">
<objects>
<viewController id="BE9-TM-ICB" customClass="MapViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="MJq-Hr-EUZ">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" id="k3G-tt-c9M">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<connections>
<outlet property="delegate" destination="BE9-TM-ICB" id="iIt-ce-0bd"/>
</connections>
</mapView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="T8D-sj-WE7">
<rect key="frame" x="0.0" y="527" width="320" height="41"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" white="0.80903477822580661" alpha="0.73999999999999999" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="center" image="aimImage" id="JO6-UI-bsN">
<rect key="frame" x="130" y="254" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" title="Time Zones" id="22q-Hc-ago"/>
<connections>
<outlet property="mapView" destination="k3G-tt-c9M" id="flL-hU-xCP"/>
<outlet property="timeZoneLabel" destination="T8D-sj-WE7" id="aBv-zl-UhW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lOn-fO-93b" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="658" y="-360"/>
</scene>
</scenes>
<resources>
<image name="aimImage" width="60" height="60"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
40 changes: 40 additions & 0 deletions Example/Example/Example-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.alterplay.timezonesexample.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Example/Example/Example-Prefix.pch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
16 changes: 16 additions & 0 deletions Example/Example/GeoCoderViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// GeoCoderViewController.h
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface GeoCoderViewController : UIViewController <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UITextView *textView;

@end
34 changes: 34 additions & 0 deletions Example/Example/GeoCoderViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// GeoCoderViewController.m
// Example
//
// Created by Sergii Kryvoblotskyi on 11/11/13.
// Copyright (c) 2013 Alterplay. All rights reserved.
//

#import "GeoCoderViewController.h"
#import "APTimeZones.h"

@implementation GeoCoderViewController

#pragma mark - UIText Field Delegates
- (BOOL)textFieldShouldReturn:(UITextField *)textField {

//Start geocoding
[self geocodeCityZoneWithText:textField.text];
return YES;
}

- (void)geocodeCityZoneWithText:(NSString *)text {

CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:text completionHandler:^(NSArray *placemarks, NSError *error) {
if (placemarks.count) {
CLPlacemark *placemark = placemarks[0];
_textView.text = placemark.timeZone.description;
}
}];

}

@end
Loading

0 comments on commit 71787e0

Please sign in to comment.