Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<( . __ .)> 'hey' #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions FixaDaApp/FixaDaApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
3DFFAC771C790A8600A8CF01 /* Venue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DFFAC761C790A8600A8CF01 /* Venue.m */; };
79510F25E25C142657CE2DC4 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1C5BEFC8D1D1F43B84295A /* libPods.a */; };
8D4F05B61C710A8E003B3131 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D4F05B51C710A8E003B3131 /* main.m */; };
8D4F05B91C710A8E003B3131 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D4F05B81C710A8E003B3131 /* AppDelegate.m */; };
Expand All @@ -20,6 +21,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3DFFAC751C790A8600A8CF01 /* Venue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Venue.h; sourceTree = "<group>"; };
3DFFAC761C790A8600A8CF01 /* Venue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Venue.m; sourceTree = "<group>"; };
51DA72322BD0057FB2DF45ED /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
5C1C5BEFC8D1D1F43B84295A /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
8D4F05B11C710A8E003B3131 /* FixaDaApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FixaDaApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -91,6 +94,8 @@
8D4F05BB1C710A8E003B3131 /* ViewController.m */,
8DB9ED8E1C722B12003A03E0 /* FoursquareAPIManager.h */,
8DB9ED8F1C722B13003A03E0 /* FoursquareAPIManager.m */,
3DFFAC751C790A8600A8CF01 /* Venue.h */,
3DFFAC761C790A8600A8CF01 /* Venue.m */,
8D4F05BD1C710A8E003B3131 /* Main.storyboard */,
8D4F05C01C710A8E003B3131 /* Assets.xcassets */,
8D4F05C21C710A8E003B3131 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -239,6 +244,7 @@
files = (
8D4F05BC1C710A8E003B3131 /* ViewController.m in Sources */,
8D4F05B91C710A8E003B3131 /* AppDelegate.m in Sources */,
3DFFAC771C790A8600A8CF01 /* Venue.m in Sources */,
8D4F05B61C710A8E003B3131 /* main.m in Sources */,
8DB9ED901C722B13003A03E0 /* FoursquareAPIManager.m in Sources */,
);
Expand Down
36 changes: 18 additions & 18 deletions FixaDaApp/FixaDaApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
Expand All @@ -18,22 +18,19 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QhC-Y4-i8h">
<rect key="frame" x="0.0" y="0.0" width="600" height="100"/>
</mapView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="BMq-V3-f2f">
<rect key="frame" x="0.0" y="100" width="600" height="500"/>
<rect key="frame" x="0.0" y="240" width="600" height="360"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="4Wd-lS-p0j" style="IBUITableViewCellStyleDefault" id="5cm-8d-a5a">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="BeepBoopCellIdentifier" textLabel="4Wd-lS-p0j" style="IBUITableViewCellStyleDefault" id="5cm-8d-a5a">
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5cm-8d-a5a" id="cpW-0e-B2H">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Wd-lS-p0j">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
Expand All @@ -44,22 +41,25 @@
</tableViewCell>
</prototypes>
</tableView>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QhC-Y4-i8h">
<rect key="frame" x="0.0" y="0.0" width="600" height="240"/>
</mapView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" id="829-uy-XA8"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="height" secondItem="BMq-V3-f2f" secondAttribute="height" multiplier="0.2" id="DcL-ga-xdl"/>
<constraint firstAttribute="trailing" secondItem="BMq-V3-f2f" secondAttribute="trailing" id="Ddx-sp-gAW"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="PGd-F5-XwA"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="PS4-bX-CJK"/>
<constraint firstAttribute="trailing" secondItem="QhC-Y4-i8h" secondAttribute="trailing" id="mbZ-IW-xGJ"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="sq5-GT-TWp"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="BMq-V3-f2f" secondAttribute="bottom" id="vLg-lx-GXH"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="0ic-vw-4yy"/>
<constraint firstAttribute="trailing" secondItem="QhC-Y4-i8h" secondAttribute="trailing" id="G8I-pA-jIR"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="MUg-6y-bHe"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="Wov-ZV-CiC"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="BMq-V3-f2f" secondAttribute="bottom" id="iXu-5K-XAo"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" id="peE-qm-0bd"/>
<constraint firstAttribute="trailing" secondItem="BMq-V3-f2f" secondAttribute="trailing" id="rp0-TL-FLF"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.4" id="xa4-xD-Kih"/>
</constraints>
</view>
<connections>
<outlet property="mapView" destination="QhC-Y4-i8h" id="SMQ-g7-itJ"/>
<outlet property="tableView" destination="BMq-V3-f2f" id="AqN-lY-b3z"/>
<outlet property="tableView" destination="BMq-V3-f2f" id="WAJ-tw-Y5b"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand Down
4 changes: 3 additions & 1 deletion FixaDaApp/FixaDaApp/FoursquareAPIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

@interface FoursquareAPIManager : NSObject

@property (nonatomic) NSMutableArray *listOfPlaces;

+ (void)findSomething:(NSString *)query
atLocation:(CLLocation *)location
completion:(void(^)(NSArray *data))completion;
completion:(void(^)(NSMutableArray *data))completion;

@end
42 changes: 38 additions & 4 deletions FixaDaApp/FixaDaApp/FoursquareAPIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "FoursquareAPIManager.h"
#import <AFNetworking/AFNetworking.h>
#import "Venue.h"


#define kFoursquareAPIClientID @"GWKJBVWFYBJQ02T3TRBB4VBL24AIO4TCMJCGIQ5ADKVKJXGP"
#define kFoursquareAPIClientSecret @"2WMEZCDQNKNB5XAE5F4BY1VHBK1HITYRU1JEVCOAD2QRLXDJ"
Expand All @@ -27,10 +29,16 @@ @implementation FoursquareAPIManager

+ (void)findSomething:(NSString *)query
atLocation:(CLLocation *)location
completion:(void(^)(NSArray *data))completion
{
NSString *baseURL = @"https://api.foursquare.com/v2/venues/search";
NSString *url = [NSString stringWithFormat:@"%@?client_id=%@&client_secret=%@&v=20160215&ll=%f,%f&query=%@", baseURL, kFoursquareAPIClientID, kFoursquareAPIClientSecret, location.coordinate.latitude, location.coordinate.longitude, query];
completion:(void(^)(NSMutableArray *data))completion {



NSMutableArray *listOfPlaces = [[NSMutableArray alloc]init];


NSString *url = [NSString stringWithFormat:@"https://api.foursquare.com/v2/venues/search?client_id=%@&client_secret=%@&v=20160215&ll=%f,%f&query=%@", kFoursquareAPIClientID, kFoursquareAPIClientSecret, location.coordinate.latitude, location.coordinate.longitude, query];

NSLog(@"%@", url);

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

Expand All @@ -40,6 +48,32 @@ + (void)findSomething:(NSString *)query
success:^(NSURLSessionTask *task, id responseObject)
{

NSDictionary *response = [responseObject objectForKey:@"response"];
NSDictionary *venues = [response objectForKey:@"venues"];

for (NSDictionary *result in venues){

NSString *lngString = [[result objectForKey:@"location"] objectForKey:@"lng"];
NSString *latString = [[result objectForKey:@"location"] objectForKey:@"lat"];
double lat = [latString doubleValue];
double lng = [lngString doubleValue];

NSString *name = [result objectForKey:@"name"];
NSString *address = [[result objectForKey:@"location"]objectForKey:@"address"];

Venue *addThisVenue = [[Venue alloc]init];
addThisVenue.title = name;
addThisVenue.address = address;
addThisVenue.latitude = lat;
addThisVenue.longitude = lng;

NSLog(@"%@", addThisVenue.title);
[listOfPlaces addObject:addThisVenue];

}

completion(listOfPlaces);

} failure:^(NSURLSessionTask *operation, NSError *error)
{
NSLog(@"Error: %@", error);
Expand Down
5 changes: 5 additions & 0 deletions FixaDaApp/FixaDaApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Show you the places!</string>
<key>CFBundleDevelopmentRegion</key>
Expand Down
18 changes: 18 additions & 0 deletions FixaDaApp/FixaDaApp/Venue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Venue.h
// FixaDaApp
//
// Created by Fatima Zenine Villanueva on 2/20/16.
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Venue : NSObject

@property (nonatomic) NSString *title;
@property (nonatomic) NSString *address;
@property (nonatomic) double latitude;
@property (nonatomic) double longitude;

@end
13 changes: 13 additions & 0 deletions FixaDaApp/FixaDaApp/Venue.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Venue.m
// FixaDaApp
//
// Created by Fatima Zenine Villanueva on 2/20/16.
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

#import "Venue.h"

@implementation Venue

@end
Loading