Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-ios
Commits
06760b70
Commit
06760b70
authored
Feb 02, 2017
by
Patrick Murray
Browse files
added some text for the description lables, its naive and incomplete but its a start.
parent
b102a35b
Changes
2
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen/MainTableViewController.swift
View file @
06760b70
...
...
@@ -26,7 +26,7 @@ class MainTableViewController: UITableViewController {
SRCTNetworkController
.
performDownload
{
(
facilities
)
in
self
.
facilitiesArray
=
facilities
print
(
self
.
facilitiesArray
)
//
print(self.facilitiesArray)
DispatchQueue
.
main
.
async
{
self
.
tableView
.
reloadData
()
}
...
...
@@ -84,6 +84,8 @@ class MainTableViewController: UITableViewController {
cell
.
openClosedLabel
.
text
=
"Closed"
cell
.
openClosedLabel
.
backgroundColor
=
UIColor
.
red
}
cell
.
timeDescriptionLabel
.
text
=
Utilities
.
timeUntilFacility
(
facility
)
self
.
reloadInputViews
()
return
cell
...
...
WhatsOpen/WhatsOpen/SRCTUtilities.swift
View file @
06760b70
...
...
@@ -27,7 +27,7 @@ class Utilities: NSObject {
}
else
{
open
=
false
}
print
(
facility
.
mainSchedule
.
name
,
" is "
,
open
)
//
print(facility.mainSchedule
print
.name ," is ", open)
return
open
}
...
...
@@ -75,15 +75,21 @@ class Utilities: NSObject {
}
//TODO
static
func
timeUntil
CloseOf
Facility
(
_
facility
:
Facility
)
->
(
hours
:
Int
,
minutes
:
Int
)
?
{
static
func
timeUntilFacility
(
_
facility
:
Facility
)
->
String
?
{
//var currentTime = getCurrentTime()
let
dateComponentsFormatter
=
DateComponentsFormatter
()
dateComponentsFormatter
.
allowedUnits
=
[
.
year
,
.
month
,
.
weekOfYear
,
.
day
,
.
hour
,
.
minute
,
.
second
]
dateComponentsFormatter
.
maximumUnitCount
=
1
dateComponentsFormatter
.
unitsStyle
=
.
full
if
(
Utilities
.
isOpen
(
facility
:
facility
))
{
return
(
hours
:
0
,
minutes
:
0
)
}
else
{
return
nil
let
time
=
dateComponentsFormatter
.
string
(
from
:
getCurrentTime
(),
to
:
(
today
(
facility
:
facility
)?
.
endTime
)
!
)
return
"Open for
\(
time
!
)
."
}
else
{
let
time
=
dateComponentsFormatter
.
string
(
from
:
getCurrentTime
(),
to
:
(
today
(
facility
:
facility
)?
.
startTime
)
!
)
return
"Opens in
\(
time
!
)
."
}
}
// TODO: Function to check for special schedules?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment