Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Memri
iOS application
Commits
a889b6e0
Commit
a889b6e0
authored
4 years ago
by
Ruben Daniels
Browse files
Options
Download
Email Patches
Plain Diff
Rename CascadingView to CascadableView
parent
0ec7848b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
memri.xcodeproj/project.pbxproj
+4
-4
memri.xcodeproj/project.pbxproj
memri/context/MemriContext.swift
+7
-7
memri/context/MemriContext.swift
memri/cvu/defaults/macro_views.json
+2
-2
memri/cvu/defaults/macro_views.json
memri/cvu/defaults/named_views.json
+2
-2
memri/cvu/defaults/named_views.json
memri/cvu/views/Action.swift
+7
-7
memri/cvu/views/Action.swift
memri/cvu/views/CascadableView.swift
+3
-3
memri/cvu/views/CascadableView.swift
memri/cvu/views/Renderers.swift
+1
-1
memri/cvu/views/Renderers.swift
memri/cvu/views/ViewDebugger.swift
+7
-7
memri/cvu/views/ViewDebugger.swift
memri/cvu/views/Views.swift
+3
-3
memri/cvu/views/Views.swift
memri/gui/browser/Browser.swift
+1
-1
memri/gui/browser/Browser.swift
memri/gui/browser/FilterPanel.swift
+8
-8
memri/gui/browser/FilterPanel.swift
memri/gui/common/SubView.swift
+2
-2
memri/gui/common/SubView.swift
memri/sessions/Session.swift
+5
-5
memri/sessions/Session.swift
memri/sessions/Sessions.swift
+1
-1
memri/sessions/Sessions.swift
memriTests/context/contextTest.swift
+2
-2
memriTests/context/contextTest.swift
with
55 additions
and
55 deletions
+55
-55
memri.xcodeproj/project.pbxproj
+
4
-
4
View file @
a889b6e0
...
...
@@ -95,7 +95,7 @@
5DB66FB52431DD41007736D6
/* contextTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB66FB42431DD41007736D6
/* contextTest.swift */
;
};
5DB66FB72431DEB0007736D6
/* realmTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB66FB62431DEB0007736D6
/* realmTest.swift */
;
};
5DB8EBFF24598E1E0028FD2E
/* ViewsTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB8EBFE24598E1E0028FD2E
/* ViewsTest.swift */
;
};
5DB8EC0424598FA30028FD2E
/* Cascad
ing
View.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB8EC0324598FA30028FD2E
/* Cascad
ing
View.swift */
;
};
5DB8EC0424598FA30028FD2E
/* Cascad
able
View.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB8EC0324598FA30028FD2E
/* Cascad
able
View.swift */
;
};
5DB8EC0B24599A080028FD2E
/* ComputedViewTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB8EC0A24599A080028FD2E
/* ComputedViewTest.swift */
;
};
5DB8EC0D24599A280028FD2E
/* DynamicViewTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DB8EC0C24599A280028FD2E
/* DynamicViewTest.swift */
;
};
5DC1692724093C3900367905
/* sessions_manually_single.json in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
5DC1692624093C3900367905
/* sessions_manually_single.json */
;
};
...
...
@@ -375,7 +375,7 @@
5DB66FB42431DD41007736D6
/* contextTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
contextTest.swift
;
sourceTree
=
"<group>"
;
};
5DB66FB62431DEB0007736D6
/* realmTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
realmTest.swift
;
sourceTree
=
"<group>"
;
};
5DB8EBFE24598E1E0028FD2E
/* ViewsTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewsTest.swift
;
sourceTree
=
"<group>"
;
};
5DB8EC0324598FA30028FD2E
/* Cascad
ing
View.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Cascad
ing
View.swift
;
sourceTree
=
"<group>"
;
wrapsLines
=
0
;
};
5DB8EC0324598FA30028FD2E
/* Cascad
able
View.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Cascad
able
View.swift
;
sourceTree
=
"<group>"
;
wrapsLines
=
0
;
};
5DB8EC0A24599A080028FD2E
/* ComputedViewTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ComputedViewTest.swift
;
sourceTree
=
"<group>"
;
};
5DB8EC0C24599A280028FD2E
/* DynamicViewTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DynamicViewTest.swift
;
sourceTree
=
"<group>"
;
};
5DC1692524093BD300367905
/* sessions_manually_expanded.json */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.json
;
path
=
sessions_manually_expanded.json
;
sourceTree
=
"<group>"
;
};
...
...
@@ -889,7 +889,7 @@
5DFB0CBE24179FA6002FBDE7
/* Sessions.swift */
,
86C6D895246EC33A001B87D0
/* Session.swift */
,
5D38DE18240577BA00FF9B70
/* Views.swift */
,
5DB8EC0324598FA30028FD2E
/* Cascad
ing
View.swift */
,
5DB8EC0324598FA30028FD2E
/* Cascad
able
View.swift */
,
86911E8124C543C3009AC8B1
/* CascadableDict.swift */
,
86911E8324C543CD009AC8B1
/* CascadableContextPane.swift */
,
86DDB360247AAD030051A92F
/* Cascadable.swift */
,
...
...
@@ -1662,7 +1662,7 @@
5D3D961F24164B240004040E
/* CodeExtended.swift in Sources */
,
B88AAB3224A1AEBB0007C9EB
/* LineChartView.swift in Sources */
,
5DD28B772417BAF900CE9F6A
/* ThumbnailRendererView.swift in Sources */
,
5DB8EC0424598FA30028FD2E
/* Cascad
ing
View.swift in Sources */
,
5DB8EC0424598FA30028FD2E
/* Cascad
able
View.swift in Sources */
,
5D3D9621241675100004040E
/* util.swift in Sources */
,
B88AAB2D24A1AEBB0007C9EB
/* ChartModel.swift in Sources */
,
B89A268324A70358009119E4
/* MapView.swift in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
memri/context/MemriContext.swift
+
7
-
7
View file @
a889b6e0
...
...
@@ -34,7 +34,7 @@ public class MemriContext: ObservableObject, Subscriptable {
sessions
.
currentSession
}
public
var
currentView
:
Cascad
ing
View
?
{
public
var
currentView
:
Cascad
able
View
?
{
sessions
.
currentSession
?
.
currentView
}
...
...
@@ -88,8 +88,8 @@ public class MemriContext: ObservableObject, Subscriptable {
private
var
uiUpdateSubject
=
PassthroughSubject
<
Void
,
Never
>
()
private
var
uiUpdateCancellable
:
AnyCancellable
?
private
var
cascad
ing
ViewUpdateSubject
=
PassthroughSubject
<
Void
,
Never
>
()
private
var
cascad
ing
ViewUpdateCancellable
:
AnyCancellable
?
private
var
cascad
able
ViewUpdateSubject
=
PassthroughSubject
<
Void
,
Never
>
()
private
var
cascad
able
ViewUpdateCancellable
:
AnyCancellable
?
func
scheduleUIUpdate
(
immediate
:
Bool
=
false
,
_
check
:
((
_
context
:
MemriContext
)
->
Bool
)?
=
nil
)
{
// Update UI
if
immediate
{
...
...
@@ -110,18 +110,18 @@ public class MemriContext: ObservableObject, Subscriptable {
uiUpdateSubject
.
send
()
}
func
scheduleCascad
ing
ViewUpdate
(
immediate
:
Bool
=
false
)
{
func
scheduleCascad
able
ViewUpdate
(
immediate
:
Bool
=
false
)
{
if
immediate
{
// Do this straight away, usually for the sake of correct animation
do
{
try
self
.
currentSession
?
.
setCurrentView
()
}
catch
{
// TODO: User error handling
// TODO: Error Handling
debugHistory
.
error
(
"Could not update Cascad
ing
View:
\(
error
)
"
)
debugHistory
.
error
(
"Could not update Cascad
able
View:
\(
error
)
"
)
}
return
}
else
{
cascad
ing
ViewUpdateSubject
.
send
()
cascad
able
ViewUpdateSubject
.
send
()
}
}
...
...
@@ -235,7 +235,7 @@ public class MemriContext: ObservableObject, Subscriptable {
}
// Setup update publishers
self
.
cascad
ing
ViewUpdateCancellable
=
cascad
ing
ViewUpdateSubject
self
.
cascad
able
ViewUpdateCancellable
=
cascad
able
ViewUpdateSubject
.
throttle
(
for
:
.
milliseconds
(
500
),
scheduler
:
RunLoop
.
main
,
latest
:
true
)
.
receive
(
on
:
DispatchQueue
.
main
)
.
sink
{
[
weak
self
]
in
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/defaults/macro_views.json
+
2
-
2
View file @
a889b6e0
...
...
@@ -3,9 +3,9 @@
"name"
:
"filter-starred"
,
"fromTemplate"
:
"{view}"
,
"datasource"
:
{
"query"
:
"{cascad
ing
View.datasource.query} AND starred = true"
"query"
:
"{cascad
able
View.datasource.query} AND starred = true"
},
"title"
:
"Starred {cascad
ing
View.title}"
"title"
:
"Starred {cascad
able
View.title}"
},
{
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/defaults/named_views.json
+
2
-
2
View file @
a889b6e0
...
...
@@ -3,9 +3,9 @@
"name"
:
"filter-starred"
,
"fromTemplate"
:
"{view}"
,
"datasource"
:
{
"query"
:
"{cascad
ing
View.datasource.query} AND starred = true"
"query"
:
"{cascad
able
View.datasource.query} AND starred = true"
},
"title"
:
"Starred {cascad
ing
View.title}"
"title"
:
"Starred {cascad
able
View.title}"
},
{
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/views/Action.swift
+
7
-
7
View file @
a889b6e0
...
...
@@ -441,7 +441,7 @@ class ActionBack: Action, ActionExec {
print
(
"Warn: Can't go back. Already at earliest view in session"
)
}
else
{
session
.
currentViewIndex
-=
1
context
.
scheduleCascad
ing
ViewUpdate
()
context
.
scheduleCascad
able
ViewUpdate
()
}
}
else
{
// TODO: Error Handling?
...
...
@@ -528,7 +528,7 @@ class ActionOpenView: Action, ActionExec {
}
func
exec
(
_
arguments
:
[
String
:
Any
?])
throws
{
// let selection = context.cascad
ing
View.userState.get("selection") as? [Item]
// let selection = context.cascad
able
View.userState.get("selection") as? [Item]
let
item
=
arguments
[
"item"
]
as?
Item
let
viewArguments
=
arguments
[
"viewArguments"
]
as?
ViewArguments
...
...
@@ -644,7 +644,7 @@ class ActionStar: Action, ActionExec {
// TODO: selection handling for binding
func
exec
(
_
:
[
String
:
Any
?])
throws
{
// if let item = arguments["item"] as? Item {
// var selection:[Item] = context.cascad
ing
View.userState.get("selection") ?? []
// var selection:[Item] = context.cascad
able
View.userState.get("selection") ?? []
// let toValue = !item.starred
//
// if !selection.contains(item) {
...
...
@@ -794,7 +794,7 @@ class ActionForward: Action, ActionExec {
print
(
"Warn: Can't go forward. Already at last view in session"
)
}
else
{
session
.
currentViewIndex
+=
1
context
.
scheduleCascad
ing
ViewUpdate
()
context
.
scheduleCascad
able
ViewUpdate
()
}
}
else
{
// TODO: Error handling?
...
...
@@ -818,7 +818,7 @@ class ActionForwardToFront: Action, ActionExec {
func
exec
(
_
:
[
String
:
Any
?])
throws
{
if
let
session
=
context
.
currentSession
{
session
.
currentViewIndex
=
session
.
views
.
count
-
1
context
.
scheduleCascad
ing
ViewUpdate
()
context
.
scheduleCascad
able
ViewUpdate
()
}
else
{
// TODO: Error handling
}
...
...
@@ -992,10 +992,10 @@ class ActionDelete: Action, ActionExec {
selection
.
count
>
0
{
context
.
cache
.
delete
(
selection
)
context
.
scheduleCascad
ing
ViewUpdate
(
immediate
:
true
)
context
.
scheduleCascad
able
ViewUpdate
(
immediate
:
true
)
}
else
if
let
dataItem
=
arguments
[
"item"
]
as?
Item
{
context
.
cache
.
delete
(
dataItem
)
context
.
scheduleCascad
ing
ViewUpdate
(
immediate
:
true
)
context
.
scheduleCascad
able
ViewUpdate
(
immediate
:
true
)
}
else
{
// TODO: Erorr handling
}
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/views/Cascad
ing
View.swift
→
memri/cvu/views/Cascad
able
View.swift
+
3
-
3
View file @
a889b6e0
...
...
@@ -8,7 +8,7 @@ import Foundation
import
SwiftUI
import
RealmSwift
public
class
Cascad
ing
View
:
Cascadable
,
ObservableObject
,
Subscriptable
{
public
class
Cascad
able
View
:
Cascadable
,
ObservableObject
,
Subscriptable
{
var
context
:
MemriContext
?
var
session
:
Session
?
=
nil
...
...
@@ -324,7 +324,7 @@ public class CascadingView: Cascadable, ObservableObject, Subscriptable {
super
.
init
(
head
,
[])
}
/// This init should only be called to create an empty Cascad
ing
View when needed inside a SwiftUI View
/// This init should only be called to create an empty Cascad
able
View when needed inside a SwiftUI View
required
init
(
_
head
:
CVUParsedDefinition
?
=
nil
,
_
tail
:
[
CVUParsedDefinition
]?
=
nil
,
...
...
@@ -480,7 +480,7 @@ public class CascadingView: Cascadable, ObservableObject, Subscriptable {
else
{
throw
"Exception: could not parse view:
\(
viewName
)
"
}
}
else
if
let
view
=
result
as?
Cascad
ing
View
{
}
else
if
let
view
=
result
as?
Cascad
able
View
{
let
parsed
=
CVUParsedViewDefinition
(
parsed
:
view
.
head
.
parsed
)
try
include
(
parsed
,
domain
)
}
else
{
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/views/Renderers.swift
+
1
-
1
View file @
a889b6e0
...
...
@@ -87,7 +87,7 @@ class FilterPanelRendererButton: Action, ActionExec {
func
exec
(
_
:
[
String
:
Any
?])
{
context
.
currentView
?
.
activeRenderer
=
rendererName
context
.
scheduleUIUpdate
{
_
in
true
}
// scheduleCascad
ing
ViewUpdate() // TODO why are userState not kept?
context
.
scheduleUIUpdate
{
_
in
true
}
// scheduleCascad
able
ViewUpdate() // TODO why are userState not kept?
}
}
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/views/ViewDebugger.swift
+
7
-
7
View file @
a889b6e0
...
...
@@ -67,7 +67,7 @@ class InfoState: Hashable {
var
displayMessage
:
String
=
""
var
messageCount
:
Int
=
1
var
type
:
InfoType
=
.
info
// var cascad
ing
View: ComputedView
// var cascad
able
View: ComputedView
init
(
displayMessage
m
:
String
)
{
displayMessage
=
m
...
...
@@ -109,42 +109,42 @@ class DebugHistory: ObservableObject {
return
"[
\(
dateFormatter
.
string
(
from
:
d
)
)
]"
}
func
info
(
_
message
:
String
/* , _ cascad
ing
View:ComputedView */
)
{
func
info
(
_
message
:
String
/* , _ cascad
able
View:ComputedView */
)
{
// if same view
if
log
.
last
?
.
displayMessage
==
message
{
log
[
log
.
count
-
1
]
.
messageCount
+=
1
}
else
{
log
.
append
(
InfoState
(
displayMessage
:
message
// cascad
ing
View: cascad
ing
View
// cascad
able
View: cascad
able
View
))
}
print
(
"
\(
time
()
)
INFO:
\(
message
.
replace
(
"
\n
"
,
"
\n
"
)
)
"
)
}
func
warn
(
_
message
:
String
/* , _ cascad
ing
View:ComputedView */
)
{
func
warn
(
_
message
:
String
/* , _ cascad
able
View:ComputedView */
)
{
// if same view
if
log
.
last
?
.
displayMessage
==
message
{
log
[
log
.
count
-
1
]
.
messageCount
+=
1
}
else
{
log
.
append
(
WarnState
(
displayMessage
:
message
// cascad
ing
View: cascad
ing
View
// cascad
able
View: cascad
able
View
))
}
print
(
"
\(
time
()
)
WARNING:
\(
message
.
replace
(
"
\n
"
,
"
\n
"
)
)
"
)
}
func
error
(
_
message
:
String
/* , _ cascad
ing
View:ComputedView */
)
{
func
error
(
_
message
:
String
/* , _ cascad
able
View:ComputedView */
)
{
// if same view
if
log
.
last
?
.
displayMessage
==
message
{
log
[
log
.
count
-
1
]
.
messageCount
+=
1
}
else
{
log
.
append
(
ErrorState
(
displayMessage
:
message
// cascad
ing
View: cascad
ing
View
// cascad
able
View: cascad
able
View
))
}
...
...
This diff is collapsed.
Click to expand it.
memri/cvu/views/Views.swift
+
3
-
3
View file @
a889b6e0
...
...
@@ -161,13 +161,13 @@ public class Views {
// // Determine whether the current view needs reloading
// for def in defs {
// var selectors = [String]()
// if let stack = context?.cascad
ing
View?.cascadeStack {
// if let stack = context?.cascad
able
View?.cascadeStack {
// for parsed in stack { selectors.append(parsed.selectors) }
// ...
// }
// }
self
.
context
?
.
scheduleCascad
ing
ViewUpdate
()
self
.
context
?
.
scheduleCascad
able
ViewUpdate
()
}
func
getGlobalReference
(
_
name
:
String
,
viewArguments
:
ViewArguments
?)
throws
->
Any
?
{
...
...
@@ -504,7 +504,7 @@ public class Views {
return
view
}
// TODO: Refactor: Consider caching cascad
ing
View based on the type of the item
// TODO: Refactor: Consider caching cascad
able
View based on the type of the item
public
func
renderItemCell
(
with
item
:
Item
?,
search
rendererNames
:
[
String
]
=
[],
inView
viewOverride
:
String
?
=
nil
,
...
...
This diff is collapsed.
Click to expand it.
memri/gui/browser/Browser.swift
+
1
-
1
View file @
a889b6e0
...
...
@@ -16,7 +16,7 @@ struct Browser: View {
}
var
body
:
some
View
{
let
currentView
=
self
.
context
.
currentView
??
Cascad
ing
View
()
let
currentView
=
self
.
context
.
currentView
??
Cascad
able
View
()
return
ZStack
{
if
self
.
context
.
currentView
==
nil
{
...
...
This diff is collapsed.
Click to expand it.
memri/gui/browser/FilterPanel.swift
+
8
-
8
View file @
a889b6e0
...
...
@@ -46,12 +46,12 @@ struct FilterPanel: View {
private
func
toggleAscending
()
{
let
ds
=
self
.
context
.
currentView
?
.
datasource
ds
?
.
sortAscending
=
!
(
ds
?
.
sortAscending
??
true
)
context
.
scheduleCascad
ing
ViewUpdate
()
context
.
scheduleCascad
able
ViewUpdate
()
}
private
func
changeOrderProperty
(
_
fieldName
:
String
)
{
self
.
context
.
currentView
?
.
datasource
.
sortProperty
=
fieldName
context
.
scheduleCascad
ing
ViewUpdate
()
context
.
scheduleCascad
able
ViewUpdate
()
}
private
func
rendererCategories
()
->
[(
String
,
FilterPanelRendererButton
)]
{
...
...
@@ -84,7 +84,7 @@ struct FilterPanel: View {
var
body
:
some
View
{
let
context
=
self
.
context
let
cascad
ing
View
=
self
.
context
.
currentView
let
cascad
able
View
=
self
.
context
.
currentView
return
HStack
(
alignment
:
.
top
,
spacing
:
0
)
{
...
...
@@ -116,7 +116,7 @@ struct FilterPanel: View {
ASSection
(
id
:
0
,
data
:
renderersAvailable
(),
dataID
:
\
.
0
)
{
(
item
:
(
key
:
String
,
renderer
:
FilterPanelRendererButton
),
_
)
in
Button
(
action
:
{
context
.
executeAction
(
item
.
renderer
)
})
{
Group
{
if
cascad
ing
View
?
.
activeRenderer
==
item
.
renderer
.
rendererName
{
if
cascad
able
View
?
.
activeRenderer
==
item
.
renderer
.
rendererName
{
Text
(
LocalizedStringKey
(
item
.
renderer
.
getString
(
"title"
)))
.
foregroundColor
(
Color
(
hex
:
"#6aa84f"
))
.
fontWeight
(
.
semibold
)
...
...
@@ -142,7 +142,7 @@ struct FilterPanel: View {
.
padding
(
.
horizontal
)
.
padding
(
.
vertical
,
6
)
})
{
cascad
ing
View
?
.
datasource
.
sortProperty
.
map
{
currentSortProperty
in
cascad
able
View
?
.
datasource
.
sortProperty
.
map
{
currentSortProperty
in
Button
(
action
:
{
self
.
toggleAscending
()
})
{
HStack
{
Text
(
currentSortProperty
)
...
...
@@ -150,7 +150,7 @@ struct FilterPanel: View {
.
font
(
.
system
(
size
:
16
,
weight
:
.
semibold
,
design
:
.
default
))
.
frame
(
minWidth
:
0
,
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
Spacer
()
Image
(
systemName
:
cascad
ing
View
?
.
datasource
.
sortAscending
==
false
Image
(
systemName
:
cascad
able
View
?
.
datasource
.
sortAscending
==
false
?
"arrow.down"
:
"arrow.up"
)
.
resizable
()
...
...
@@ -160,8 +160,8 @@ struct FilterPanel: View {
}
}
}
cascad
ing
View
?
.
sortFields
.
filter
{
cascad
ing
View
?
.
datasource
.
sortProperty
!=
$0
cascad
able
View
?
.
sortFields
.
filter
{
cascad
able
View
?
.
datasource
.
sortProperty
!=
$0
}
.
map
{
fieldName
in
Button
(
action
:
{
self
.
changeOrderProperty
(
fieldName
)
})
{
Text
(
fieldName
)
...
...
This diff is collapsed.
Click to expand it.
memri/gui/common/SubView.swift
+
2
-
2
View file @
a889b6e0
...
...
@@ -40,7 +40,7 @@ public struct SubView: View {
}
catch
{
// TODO: Refactor error handling
throw
"Cannot update Cascad
ing
View
\(
self
)
:
\(
error
)
"
throw
"Cannot update Cascad
able
View
\(
self
)
:
\(
error
)
"
}
}
catch
{
// TODO: Refactor: error handling
...
...
@@ -65,7 +65,7 @@ public struct SubView: View {
try
proxyMain
?
.
currentSession
?
.
setCurrentView
(
state
,
args
)
}
catch
{
// TODO: Refactor error handling
debugHistory
.
error
(
"Error: cannot init subview, failed to update Cascad
ing
View:
\(
error
)
"
)
debugHistory
.
error
(
"Error: cannot init subview, failed to update Cascad
able
View:
\(
error
)
"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
memri/sessions/Session.swift
+
5
-
5
View file @
a889b6e0
...
...
@@ -65,7 +65,7 @@ public final class Session : Equatable, Subscriptable {
}
/// TBD
var
views
=
[
Cascad
ing
View
]()
var
views
=
[
Cascad
able
View
]()
/// TBD
var
sessions
:
Sessions
?
var
context
:
MemriContext
?
...
...
@@ -88,7 +88,7 @@ public final class Session : Equatable, Subscriptable {
currentViewIndex
>
0
}
public
var
currentView
:
Cascad
ing
View
?
{
public
var
currentView
:
Cascad
able
View
?
{
views
[
safe
:
currentViewIndex
]
}
...
...
@@ -118,7 +118,7 @@ public final class Session : Equatable, Subscriptable {
storedViewStates
.
count
>
0
{
for
viewState
in
storedViewStates
{
views
.
append
(
try
Cascad
ing
View
(
viewState
,
self
))
views
.
append
(
try
Cascad
able
View
(
viewState
,
self
))
}
}
// Or if the views are encoded in the definition
...
...
@@ -130,7 +130,7 @@ public final class Session : Equatable, Subscriptable {
for
parsed
in
parsedViews
{
let
viewState
=
try
CVUStateDefinition
.
fromCVUParsedDefinition
(
parsed
)
_
=
try
state
.
link
(
viewState
,
type
:
"view"
,
sequence
:
.
last
)
views
.
append
(
try
Cascad
ing
View
(
viewState
,
self
))
views
.
append
(
try
Cascad
able
View
(
viewState
,
self
))
}
}
...
...
@@ -251,7 +251,7 @@ public final class Session : Equatable, Subscriptable {
}
// Add session to list
views
.
append
(
try
Cascad
ing
View
(
storedView
,
self
))
views
.
append
(
try
Cascad
able
View
(
storedView
,
self
))
nextIndex
=
views
.
count
-
1
}
...
...
This diff is collapsed.
Click to expand it.
memri/sessions/Sessions.swift
+
1
-
1
View file @
a889b6e0
...
...
@@ -42,7 +42,7 @@ public final class Sessions : ObservableObject, Equatable {
sessions
[
safe
:
currentSessionIndex
]
}
var
currentView
:
Cascad
ing
View
?
{
var
currentView
:
Cascad
able
View
?
{
currentSession
?
.
currentView
}
...
...
This diff is collapsed.
Click to expand it.
memriTests/context/contextTest.swift
+
2
-
2
View file @
a889b6e0
...
...
@@ -22,7 +22,7 @@ class contextTest: XCTestCase {
let
root
=
try
RootContext
(
name
:
""
,
key
:
""
)
try
root
.
boot
()
XCTAssertEqual
(
root
.
cascad
ing
View
?
.
sessionView
.
viewDefinition
!.
selector
,
"[view]"
)
XCTAssertEqual
(
root
.
cascad
able
View
?
.
sessionView
.
viewDefinition
!.
selector
,
"[view]"
)
}
func
testSubContext
()
throws
{
...
...
@@ -30,7 +30,7 @@ class contextTest: XCTestCase {
try
root
.
boot
()
let
sub
=
try
root
.
createSubContext
(
Session
())
XCTAssertEqual
(
sub
.
cascad
ing
View
?
.
sessionView
.
viewDefinition
,
nil
)
XCTAssertEqual
(
sub
.
cascad
able
View
?
.
sessionView
.
viewDefinition
,
nil
)
}
func
testDynamicProperties
()
throws
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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