Commit 02e269d4 authored by Ruben Daniels's avatar Ruben Daniels
Browse files

Merge branch 'fix-list-refresh' into 'dev'

Fix list refresh

See merge request memri/ios-application!144
parents 998ae8e9 ffe4d47b
Showing with 19 additions and 9 deletions
+19 -9
......@@ -15,7 +15,7 @@
"repositoryURL": "https://gitlab.memri.io/memri/ascollectionview",
"state": {
"branch": "master",
"revision": "5b1ca08ae7938cfb7299f76a5f2b6e67a58cf657",
"revision": "1ac2da68bbd471b5a0fce5427a234fa0c504f247",
"version": null
}
},
......
......@@ -17,7 +17,8 @@ public class UserState: SchemaItem, CVUToString {
"uid"
}
convenience init(_ dict: [String: Any]) throws {
convenience init(_ dict: [String: Any?]) throws {
#warning("@Ruben - I changed this to [String: Any?] to match the function it calls (storeInCache). My xcode wouldn't build the project without this change")
self.init()
try storeInCache(dict)
persist()
......
......@@ -156,7 +156,7 @@ public class MemriTextEditor_UIKit: UITextView {
override public func layoutSubviews() {
if let header = header {
header.frame = CGRect(x: preferredContentInset.left, y: 5, width: bounds.width - preferredContentInset.left - preferredContentInset.right, height: headerSize)
header.frame = CGRect(x: preferredContentInset.left + 5, y: 5, width: bounds.width - preferredContentInset.left - preferredContentInset.right - 10, height: headerSize)
}
textContainerInset = preferredContentInset
super.layoutSubviews()
......
......@@ -141,8 +141,8 @@ struct FilterPanel: View {
.padding(.bottom, 1)
ASTableView(section:
ASSection(id: 0, container: {
$0
ASSection(id: 0, container: { content, _ in
content
.padding(.horizontal)
.padding(.vertical, 6)
}) {
......
......@@ -87,9 +87,9 @@ struct ListRendererView: View {
data: context.items,
dataID: \.uid.value,
selectedItems: selectedIndices,
onSwipeToDelete: { _, item, callback in
onSwipeToDelete: { _, item in
context.executeAction(ActionDelete(context), with: item)
callback(true)
return true
}) { dataItem, _ in
self.renderConfig.render(item: dataItem)
.frame(maxWidth: .infinity, alignment: .leading)
......
......@@ -169,8 +169,17 @@ public class Item: SchemaItem {
/// - value: value
public func set(_ name: String, _ value: Any?) {
realmWriteIfAvailable(realm) {
if self.objectSchema[name] != nil {
self[name] = value
if let schema = self.objectSchema[name] {
switch schema.type {
case .int:
self[name] = value as? Int
case .float:
self[name] = value as? Float
case .double:
self[name] = value as? Double
default:
self[name] = value
}
} else if let obj = value as? Object {
_ = try self.link(obj, type: name, distinct: true)
} else if let list = value as? [Object] {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment