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
6386ca1b
Commit
6386ca1b
authored
Feb 16, 2018
by
Zac Wood
Browse files
Fixes toggles and retain cycles
parent
00756a75
Changes
2
Show whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen/Views/FacilitiesListViewController.swift
View file @
6386ca1b
...
...
@@ -405,10 +405,9 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
updateFiltersLists
()
reloadWithFilters
()
refreshControl
.
endRefreshing
()
}
...
...
@@ -812,7 +811,9 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
let
filterView
=
destination
.
topViewController
as!
FiltersTableViewController
filterView
.
facilities
=
self
.
facilitiesArray
filterView
.
filters
=
self
.
filters
filterView
.
updateFacilities
=
reloadWithFilters
filterView
.
updateFacilities
=
{
[
weak
self
]
in
self
?
.
reloadWithFilters
()
}
}
// Pass the selected object to the new view controller.
...
...
WhatsOpen/WhatsOpen/Views/FiltersTableViewController.swift
View file @
6386ca1b
...
...
@@ -55,6 +55,7 @@ class FiltersTableViewController: UITableViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
tableView
.
estimatedRowHeight
=
50
tableView
.
rowHeight
=
UITableViewAutomaticDimension
/*
...
...
@@ -129,13 +130,21 @@ class FiltersTableViewController: UITableViewController {
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"Switching"
,
for
:
indexPath
)
as!
SwitchingTableViewCell
cell
.
textLabel
!.
text
=
"Show Open Locations"
cell
.
switchControl
.
isOn
=
filters
.
showOpen
cell
.
toggleFunc
=
updateOpenFirstEnabledState
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
updateOpenFirstEnabledState
(
isOn
)
self
.
updateFacilities
()
return
result
}
//self.showOpen = cell
case
1
:
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"Switching"
,
for
:
indexPath
)
as!
SwitchingTableViewCell
cell
.
textLabel
!.
text
=
"Show Closed Locations"
cell
.
switchControl
.
isOn
=
filters
.
showClosed
cell
.
toggleFunc
=
filters
.
setShowClosed
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
filters
.
setShowClosed
(
isOn
)
self
.
updateFacilities
()
return
result
}
//self.showClosed = cell
default
:
cell
=
UITableViewCell
()
as!
SwitchingTableViewCell
//this is bad don't let this happen
...
...
@@ -146,7 +155,11 @@ class FiltersTableViewController: UITableViewController {
cell
.
textLabel
!.
text
=
"Show Open Facilities First"
cell
.
switchControl
.
isEnabled
=
filters
.
showOpen
cell
.
switchControl
.
isOn
=
filters
.
openFirst
cell
.
toggleFunc
=
filters
.
setOpenFirst
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
filters
.
setOpenFirst
(
isOn
)
self
.
updateFacilities
()
return
result
}
return
cell
case
2
:
let
method
:
SortMethod
...
...
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