Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from gobbl/feature/loading_indicator
Browse files Browse the repository at this point in the history
[Feature] Shared Loading indicator
  • Loading branch information
TorIsHere committed Jul 5, 2015
2 parents f34298b + b4f4325 commit eb3438f
Show file tree
Hide file tree
Showing 51 changed files with 383 additions and 5 deletions.
4 changes: 4 additions & 0 deletions adam.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
21D741281B21A9A9008A8EB5 /* DiscoverView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 21D741271B21A9A9008A8EB5 /* DiscoverView.xib */; };
21D7412A1B21AA4B008A8EB5 /* DiscoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D741291B21AA4B008A8EB5 /* DiscoverView.swift */; };
21D7412C1B21AD36008A8EB5 /* DiscoverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D7412B1B21AD36008A8EB5 /* DiscoverViewController.swift */; };
96157CD01B41AB240022E3F0 /* LoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */; };
9616799B1B2C72BA00A43AD3 /* LocationSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9616799A1B2C72BA00A43AD3 /* LocationSearchViewController.swift */; };
964690861B3308D800DB187D /* TutorialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964690851B3308D800DB187D /* TutorialViewController.swift */; };
9646908A1B3392F600DB187D /* PageContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964690891B3392F600DB187D /* PageContentViewController.swift */; };
Expand Down Expand Up @@ -71,6 +72,7 @@
21D741291B21AA4B008A8EB5 /* DiscoverView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoverView.swift; sourceTree = "<group>"; };
21D7412B1B21AD36008A8EB5 /* DiscoverViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoverViewController.swift; sourceTree = "<group>"; };
5BD10A0AA37B5DD5EB928422 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingIndicator.swift; sourceTree = "<group>"; };
9616799A1B2C72BA00A43AD3 /* LocationSearchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationSearchViewController.swift; sourceTree = "<group>"; };
964690851B3308D800DB187D /* TutorialViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TutorialViewController.swift; sourceTree = "<group>"; };
964690891B3392F600DB187D /* PageContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageContentViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -183,6 +185,7 @@
9656AD9B1AECC62800933A8E /* benri */ = {
isa = PBXGroup;
children = (
96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */,
21A29D331B3A6166009E0D0C /* MapViewController.swift */,
96E377191B35981100229684 /* Localizable.strings */,
21D741271B21A9A9008A8EB5 /* DiscoverView.xib */,
Expand Down Expand Up @@ -443,6 +446,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96157CD01B41AB240022E3F0 /* LoadingIndicator.swift in Sources */,
213997341B3907580027AB55 /* MenuDetailViewController.swift in Sources */,
964690861B3308D800DB187D /* TutorialViewController.swift in Sources */,
21AF14891B0601C800108190 /* Restaurant.swift in Sources */,
Expand Down
17 changes: 12 additions & 5 deletions benri/FirstViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
var locationService:LocationService = LocationService.sharedInstance
var restaurantCache:RestaurantCache = RestaurantCache.sharedInstance
var imgCache:ImageCache = ImageCache.sharedInstance
var ldIndicator:LoadingIndicator = LoadingIndicator.sharedInstance

let locationManager = CLLocationManager()
var populateLength = 5
Expand Down Expand Up @@ -113,7 +114,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateNotificationDiscoverSearch", name: discoverSearchNotificationKey, object: nil)

self.currentLoadedIndex = 0
self.populateLength = 5
self.populateLength = 10

self.menuTableView.delegate = self
self.menuTableView.dataSource = self
Expand All @@ -127,6 +128,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
isInitiated = true
self.populateMenu(true, tags: nil, location:locationService.locationToLonLat(locationService.getCurrentLocation()))
}

}

override func didReceiveMemoryWarning() {
Expand All @@ -139,7 +141,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
static var onceToken : dispatch_once_t = 0
}
dispatch_once(&Static.onceToken) {
self.populateMenu(false, tags: nil, location:self.locationService.locationToLonLat(self.locationService.getCurrentLocation()))
self.populateMenu(true, tags: nil, location:self.locationService.locationToLonLat(self.locationService.getCurrentLocation()))
}
}

Expand Down Expand Up @@ -167,8 +169,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
}
if isUserAnswered {
locationManager.startUpdatingLocation()
self.initMenu()
if !self.isInitiated {
self.initMenu()
self.isInitiated = true
}
}
Expand Down Expand Up @@ -235,6 +237,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
if isReset {
dispatch_async(dispatch_get_main_queue()) {
self.menuTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Bottom)
self.ldIndicator.activityImageView.stopAnimating()
self.ldIndicator.activityImageView.removeFromSuperview()
}
} else {
dispatch_async(dispatch_get_main_queue()) {
Expand All @@ -257,9 +261,10 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
if isReset {
self.currentLoadedIndex = 0
self.menuArray = []
self.menuTableView.reloadData()
self.ldIndicator.activityImageView.startAnimating()
self.view.addSubview(self.ldIndicator.activityImageView)
}
println("location")
println(location)
isPopulating = true
var menuSVAPI:MenuSVAPI = MenuSVAPI()
if let searchTag = tags {
Expand Down Expand Up @@ -288,6 +293,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll
if isReset {
dispatch_async(dispatch_get_main_queue()) {
self.menuTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Bottom)
self.ldIndicator.activityImageView.stopAnimating()
self.ldIndicator.activityImageView.removeFromSuperview()
}
} else {
dispatch_async(dispatch_get_main_queue()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_1-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_1-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_1.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_19-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_19-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_19.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_21-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_21-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_21.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_23-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_23-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_23.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_3-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_3-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_3.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_5-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_5-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_5.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_7-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_7-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_7.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_9-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_9-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_9.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_11-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_11-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_11.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_13-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_13-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_13.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "gobblLoading_15-2.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "gobblLoading_15-1.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "gobblLoading_15.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading

0 comments on commit eb3438f

Please sign in to comment.