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

done #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

done #20

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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ xcuserdata
*.moved-aside
*.xcuserstate
*.xcscmblueprint

.DS_Store
## Obj-C/Swift specific
*.hmap
*.ipa
Expand Down
20 changes: 10 additions & 10 deletions FixaDaApp/FixaDaApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@
<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="263" width="600" height="337"/>
<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"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</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="255"/>
</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 firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" constant="8" id="829-uy-XA8"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="height" secondItem="BMq-V3-f2f" secondAttribute="height" multiplier="0.2" constant="187.59999999999999" 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"/>
Expand Down
11 changes: 10 additions & 1 deletion FixaDaApp/FixaDaApp/FoursquareAPIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
// Copyright © 2016 Michael Kavouras. All rights reserved.
//

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


#define kFoursquareAPIClientID @"GWKJBVWFYBJQ02T3TRBB4VBL24AIO4TCMJCGIQ5ADKVKJXGP"
#define kFoursquareAPIClientSecret @"2WMEZCDQNKNB5XAE5F4BY1VHBK1HITYRU1JEVCOAD2QRLXDJ"

@implementation FoursquareAPIManager

@implementation FoursquareAPIManager
/**

https://api.foursquare.com/v2/venues/search
Expand All @@ -25,10 +27,12 @@ @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];

Expand All @@ -39,6 +43,11 @@ + (void)findSomething:(NSString *)query
progress:nil
success:^(NSURLSessionTask *task, id responseObject)
{
NSDictionary *results = responseObject[@"response"];
NSArray *data = results[@"venues"];
completion(data);

NSLog(@"%@", responseObject);

} failure:^(NSURLSessionTask *operation, NSError *error)
{
Expand Down
8 changes: 6 additions & 2 deletions FixaDaApp/FixaDaApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ - (void)viewDidLoad {
self.mapView.delegate = self;

self.locationManager = [[CLLocationManager alloc] init];
[self.locationManager requestWhenInUseAuthorization];
[self.tableView reloadData];


}

- (void)viewDidAppear:(BOOL)animated
Expand All @@ -56,13 +60,13 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 0;
return self.venues.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BeepBoopCellIdentifier"];

NSDictionary *venue = self.venues[indexPath.row];
NSString *name = venue[@"name"];
cell.textLabel.text = name;
Expand Down