This repository has been archived by the owner on Nov 4, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from apptekstudios/v1.6candidate
V1.6
- Loading branch information
Showing
61 changed files
with
3,448 additions
and
2,411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
.../ASCollectionViewDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
Demo/ASCollectionViewDemo/Screens/TableViewDragAndDrop/TableViewDragAndDropScreen.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// ASCollectionView. Created by Apptek Studios 2019 | ||
|
||
import ASCollectionView | ||
import SwiftUI | ||
|
||
struct TableViewDragAndDropScreen: View | ||
{ | ||
@State var groupA: [String] = (0 ... 4).map { "Item A-\($0)" } | ||
@State var groupB: [String] = (0 ... 4).map { "Item B-\($0)" } | ||
@State var groupC: [String] = (0 ... 4).map { "Item C-\($0)" } | ||
@State var groupD: [String] = (0 ... 4).map { "Item D-\($0)" } | ||
|
||
var body: some View | ||
{ | ||
VStack { | ||
Text("Drag within a tableview to move.\nDrag between tableviews to copy.") | ||
.padding() | ||
HStack { | ||
ASTableView { | ||
ASSection( | ||
id: 0, | ||
data: groupA, | ||
dataID: \.self, | ||
dragDropConfig: ASDragDropConfig(dataBinding: $groupA).enableReordering(), | ||
onSwipeToDelete: { index, _, callback in | ||
withAnimation { | ||
self.groupA.remove(at: index) | ||
callback(true) | ||
} | ||
}) | ||
{ item, _ in | ||
Text(item) | ||
.padding() | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.sectionHeader { | ||
header("Section A") | ||
} | ||
ASSection( | ||
id: 1, | ||
data: groupB, | ||
dataID: \.self, | ||
dragDropConfig: ASDragDropConfig(dataBinding: $groupB).enableReordering(), | ||
onSwipeToDelete: { index, _, callback in | ||
withAnimation { | ||
self.groupB.remove(at: index) | ||
callback(true) | ||
} | ||
}) { item, _ in | ||
Text(item) | ||
.padding() | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.sectionHeader { | ||
header("Section B") | ||
} | ||
} | ||
Color.blue.frame(width: 10) | ||
ASTableView { | ||
ASSection( | ||
id: 0, | ||
data: groupC, | ||
dataID: \.self, | ||
dragDropConfig: ASDragDropConfig(dataBinding: $groupC).enableReordering(), | ||
onSwipeToDelete: { index, _, callback in | ||
withAnimation { | ||
self.groupC.remove(at: index) | ||
callback(true) | ||
} | ||
}) { item, _ in | ||
Text(item) | ||
.padding() | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.sectionHeader { | ||
header("Section C") | ||
} | ||
ASSection( | ||
id: 1, | ||
data: groupD, | ||
dataID: \.self, | ||
dragDropConfig: ASDragDropConfig(dataBinding: $groupD).enableReordering(), | ||
onSwipeToDelete: { index, _, callback in | ||
withAnimation { | ||
self.groupD.remove(at: index) | ||
callback(true) | ||
} | ||
}) { item, _ in | ||
Text(item) | ||
.padding() | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.sectionHeader { | ||
header("Section D") | ||
} | ||
} | ||
} | ||
} | ||
.navigationBarTitle("Drag & drop", displayMode: .inline) | ||
} | ||
|
||
func header(_ string: String) -> some View | ||
{ | ||
Text(string) | ||
.padding() | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.background(Color(.secondarySystemBackground)) | ||
} | ||
} | ||
|
||
struct TableViewDragAndDropScreen_Previews: PreviewProvider | ||
{ | ||
static var previews: some View | ||
{ | ||
TableViewDragAndDropScreen() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "DifferenceKit", | ||
"repositoryURL": "https://github.com/ra1028/DifferenceKit", | ||
"state": { | ||
"branch": null, | ||
"revision": "14c66681e12a38b81045f44c6c29724a0d4b0e72", | ||
"version": "1.1.5" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.