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
3878b9d6
Unverified
Commit
3878b9d6
authored
Oct 30, 2017
by
Zach Knox
Browse files
Functional detail view!
parent
db05ad47
Changes
3
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen.xcodeproj/project.pbxproj
View file @
3878b9d6
...
...
@@ -109,6 +109,14 @@
path
=
Views
;
sourceTree
=
"<group>"
;
};
928794021FA27C8A008860FF
/* Recovered References */
=
{
isa
=
PBXGroup
;
children
=
(
7F4743261E11D1BC00E6E3D1
/* MainTableViewControllerTests.swift */
,
);
name
=
"Recovered References"
;
sourceTree
=
"<group>"
;
};
CD81F5101DC0334600009FBD
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -116,6 +124,7 @@
CD81F51A1DC0334600009FBD
/* Products */
,
2EAE8AD7B1F0ADDED5057982
/* Pods */
,
FD2AE174B8FDE3008F34206E
/* Frameworks */
,
928794021FA27C8A008860FF
/* Recovered References */
,
);
sourceTree
=
"<group>"
;
};
...
...
@@ -227,7 +236,7 @@
};
CD81F5181DC0334600009FBD
=
{
CreatedOnToolsVersion
=
8.0
;
DevelopmentTeam
=
HQSN7HX89U
;
DevelopmentTeam
=
N5GM564QWL
;
ProvisioningStyle
=
Automatic
;
};
};
...
...
@@ -542,14 +551,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
HQSN7HX89U
;
DEVELOPMENT_TEAM
=
N5GM564QWL
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(PROJECT_DIR)"
,
);
INFOPLIST_FILE
=
WhatsOpen/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.srct.
W
hats
O
pen
iOS
;
PRODUCT_BUNDLE_IDENTIFIER
=
space
.srct.
w
hats
o
pen
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SWIFT_VERSION
=
3.0
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
...
...
@@ -563,14 +572,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
HQSN7HX89U
;
DEVELOPMENT_TEAM
=
N5GM564QWL
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(PROJECT_DIR)"
,
);
INFOPLIST_FILE
=
WhatsOpen/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.srct.
W
hats
O
pen
iOS
;
PRODUCT_BUNDLE_IDENTIFIER
=
space
.srct.
w
hats
o
pen
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SWIFT_VERSION
=
3.0
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
...
...
WhatsOpen/WhatsOpen/SRCTUtilities.swift
View file @
3878b9d6
...
...
@@ -37,25 +37,48 @@ class Utilities: NSObject {
return
open
}
static
func
getDayOfWeek
(
_
day
:
Day
)
->
String
?
{
switch
day
{
case
.
Monday
:
return
"Monday"
case
.
Tuesday
:
return
"Tuesday"
case
.
Wednesday
:
return
"Wednesday"
case
.
Thursday
:
return
"Thursday"
case
.
Friday
:
return
"Friday"
case
.
Saturday
:
return
"Saturday"
case
.
Sunday
:
return
"Sunday"
default
:
return
nil
static
func
getDayOfWeek
(
_
day
:
Day
,
small
:
Bool
=
false
)
->
String
?
{
if
!
small
{
switch
day
{
case
.
Monday
:
return
"Monday"
case
.
Tuesday
:
return
"Tuesday"
case
.
Wednesday
:
return
"Wednesday"
case
.
Thursday
:
return
"Thursday"
case
.
Friday
:
return
"Friday"
case
.
Saturday
:
return
"Saturday"
case
.
Sunday
:
return
"Sunday"
default
:
return
nil
}
}
else
{
switch
day
{
case
.
Monday
:
return
"Mon"
case
.
Tuesday
:
return
"Tue"
case
.
Wednesday
:
return
"Wed"
case
.
Thursday
:
return
"Thu"
case
.
Friday
:
return
"Fri"
case
.
Saturday
:
return
"Sat"
case
.
Sunday
:
return
"Sun"
default
:
return
nil
}
}
}
static
func
getCurrentDayOfWeek
()
->
Int
?
{
...
...
@@ -118,7 +141,7 @@ class Utilities: NSObject {
static
func
time
(
_
facility
:
Facility
)
->
Bool
{
let
nowTime
=
getCurrentTime
()
guard
let
startEnd
=
getStartEndDates
(
facility
)
else
{
return
false
}
var
startTime
=
startEnd
.
startTime
let
startTime
=
startEnd
.
startTime
var
endTime
=
startEnd
.
endTime
if
endTime
<
startTime
{
endTime
=
Date
.
endOfCurrentDay
()
...
...
@@ -165,6 +188,26 @@ class Utilities: NSObject {
}
return
nil
}
static
func
getFormattedStartandEnd
(
_
openTime
:
OpenTimes
)
->
String
?
{
//Is it inelegant to go from string to date to string? maybe.
//Does it work? absolutely.
let
dateFormatter
=
DateFormatter
.
easternCoastTimeFormat
let
startTime
=
dateFormatter
.
date
(
from
:
openTime
.
startTime
)
let
endTime
=
dateFormatter
.
date
(
from
:
openTime
.
endTime
)
let
viewingFormatter
=
DateFormatter
.
easternCoastTimeFormatForViewing
var
returning
=
viewingFormatter
.
string
(
from
:
startTime
!
)
+
" - "
if
(
openTime
.
startDay
!=
openTime
.
endDay
)
{
returning
+=
getDayOfWeek
((
Day
(
rawValue
:
openTime
.
endDay
))
!
,
small
:
true
)
!
+
" "
}
returning
+=
viewingFormatter
.
string
(
from
:
endTime
!
)
return
returning
}
static
func
isSpecialSchedule
(
_
facility
:
Facility
)
->
Bool
{
return
facility
.
specialSchedule
!.
isValid
...
...
@@ -185,6 +228,14 @@ extension DateFormatter {
dateFormatter
.
dateFormat
=
"HH:mm:ss"
return
dateFormatter
}
public
static
var
easternCoastTimeFormatForViewing
:
DateFormatter
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
timeZone
=
TimeZone
.
current
dateFormatter
.
locale
=
Locale
.
current
dateFormatter
.
dateFormat
=
DateFormatter
.
dateFormat
(
fromTemplate
:
"hh:mm a"
,
options
:
0
,
locale
:
Locale
.
current
)
return
dateFormatter
}
}
...
...
WhatsOpen/WhatsOpen/Views/FacilityDetailViewController.swift
View file @
3878b9d6
...
...
@@ -79,7 +79,7 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
let
openTime
=
facility
.
mainSchedule
?
.
openTimes
[
indexPath
.
row
]
cell
.
textLabel
?
.
text
=
Utilities
.
getDayOfWeek
(
Day
(
rawValue
:
openTime
!.
startDay
)
!
)
cell
.
detailTextLabel
?
.
text
=
"12:00 AM - 11:59 PM"
cell
.
detailTextLabel
?
.
text
=
Utilities
.
getFormattedStartandEnd
(
openTime
!
)
// Configure the cell...
...
...
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