-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
İzzet Öztürk
committed
Aug 3, 2018
1 parent
702b77a
commit e3792fb
Showing
9 changed files
with
148 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ target 'kimlic' do | |
pod 'Fabric' | ||
pod 'Crashlytics' | ||
pod 'CloudCore', '~> 2.0' | ||
pod 'GooglePlaces', '~> 2.7' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
<device id="retina4_7" orientation="portrait"> | ||
<adaptation id="fullscreen"/> | ||
</device> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--AddressVC--> | ||
<scene sceneID="944-KF-dFD"> | ||
<objects> | ||
<viewController storyboardIdentifier="AddressVC" id="OaL-xf-Qgx" customClass="AddressVC" customModule="kimlic" customModuleProvider="target" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="NIt-MV-gdf"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<subviews> | ||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZRh-fl-tl6"> | ||
<rect key="frame" x="164" y="318" width="46" height="30"/> | ||
<state key="normal" title="Button"/> | ||
<connections> | ||
<action selector="autocompleteClicked:" destination="OaL-xf-Qgx" eventType="touchUpInside" id="mK4-A7-DRB"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
<constraints> | ||
<constraint firstItem="ZRh-fl-tl6" firstAttribute="centerY" secondItem="NIt-MV-gdf" secondAttribute="centerY" id="cN6-Pk-kIR"/> | ||
<constraint firstItem="ZRh-fl-tl6" firstAttribute="centerX" secondItem="NIt-MV-gdf" secondAttribute="centerX" id="x1i-V4-jtY"/> | ||
</constraints> | ||
<viewLayoutGuide key="safeArea" id="4zd-aw-gbp"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="MFA-uL-aKU" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-287" y="107"/> | ||
</scene> | ||
</scenes> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// AddressVC.swift | ||
// kimlic | ||
// | ||
// Created by İzzet Öztürk on 3.08.2018. | ||
// Copyright © 2018 Kimlic. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import GooglePlaces | ||
|
||
class AddressVC: UIViewController { | ||
|
||
let googlePlaceAPIKey = "AIzaSyAhJoblJTjmCVjLKVmBAf2APWEhiqkbJWc" | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
GMSPlacesClient.provideAPIKey(googlePlaceAPIKey) | ||
} | ||
|
||
// Present the Autocomplete view controller when the button is pressed. | ||
@IBAction func autocompleteClicked(_ sender: UIButton) { | ||
let autocompleteController = GMSAutocompleteViewController() | ||
autocompleteController.delegate = self | ||
present(autocompleteController, animated: true, completion: nil) | ||
} | ||
|
||
} | ||
|
||
extension AddressVC: GMSAutocompleteViewControllerDelegate { | ||
|
||
// Handle the user's selection. | ||
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) { | ||
print("Place name: \(place.name)") | ||
dismiss(animated: true, completion: nil) | ||
} | ||
|
||
func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) { | ||
// TODO: handle the error. | ||
print("Error: ", error.localizedDescription) | ||
} | ||
|
||
// User canceled the operation. | ||
func wasCancelled(_ viewController: GMSAutocompleteViewController) { | ||
dismiss(animated: true, completion: nil) | ||
} | ||
|
||
// Turn the network activity indicator on and off again. | ||
func didRequestAutocompletePredictions(_ viewController: GMSAutocompleteViewController) { | ||
UIApplication.shared.isNetworkActivityIndicatorVisible = true | ||
} | ||
|
||
func didUpdateAutocompletePredictions(_ viewController: GMSAutocompleteViewController) { | ||
UIApplication.shared.isNetworkActivityIndicatorVisible = false | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters