-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce custom animations for inserting and removing items. Introdu…
…ce ListViewController for easier embedding of lists.
- Loading branch information
Showing
21 changed files
with
743 additions
and
323 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
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
100 changes: 100 additions & 0 deletions
100
Demo/Sources/Demos/Demo Screens/ItemInsertAndRemoveAnimationsViewController.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,100 @@ | ||
// | ||
// ItemInsertAndRemoveAnimationsViewController.swift | ||
// Demo | ||
// | ||
// Created by Kyle Van Essen on 6/21/20. | ||
// Copyright © 2020 Kyle Van Essen. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import BlueprintLists | ||
|
||
|
||
final class ItemInsertAndRemoveAnimationsViewController : ListViewController | ||
{ | ||
struct Animations : Equatable | ||
{ | ||
let id : String | ||
let animations : ItemInsertAndRemoveAnimations | ||
|
||
static func == (lhs: Self, rhs: Self) -> Bool | ||
{ | ||
lhs.id == rhs.id | ||
} | ||
} | ||
|
||
var deleted : Animations? = nil | ||
|
||
let animations : [Animations] = [ | ||
Animations( | ||
id: "Fade", | ||
animations: .fade | ||
), | ||
Animations( | ||
id: "Right", | ||
animations: .right | ||
), | ||
Animations( | ||
id: "Left", | ||
animations: .left | ||
), | ||
Animations( | ||
id: "Top", | ||
animations: .top | ||
), | ||
Animations( | ||
id: "Bottom", | ||
animations: .bottom | ||
), | ||
Animations( | ||
id: "Scale Up", | ||
animations: .scaleUp | ||
), | ||
Animations( | ||
id: "Scale Down", | ||
animations: .scaleDown | ||
), | ||
] | ||
|
||
override func configure(list: inout ListProperties) | ||
{ | ||
list.appearance = .demoAppearance | ||
list.layout = .demoLayout | ||
|
||
list += Section(identifier: "animations") { section in | ||
|
||
section.header = HeaderFooter(DemoHeader(title: "Item Animations")) | ||
|
||
for animations in self.animations { | ||
|
||
guard self.deleted != animations else { | ||
continue | ||
} | ||
|
||
section += Item( | ||
DemoItem(text: animations.id), | ||
selectionStyle: .tappable, | ||
insertAndRemoveAnimations: animations.animations, | ||
onSelect: { _ in | ||
self.view.isUserInteractionEnabled = false | ||
|
||
Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false) { _ in | ||
self.deleted = animations | ||
self.reload(animated: true) | ||
|
||
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in | ||
self.view.isUserInteractionEnabled = true | ||
|
||
self.deleted = nil | ||
self.reload(animated: true) | ||
} | ||
} | ||
}) | ||
} | ||
|
||
section += DemoItem(text: "Extra Row 1") | ||
section += DemoItem(text: "Extra Row 2") | ||
section += DemoItem(text: "Extra Row 3") | ||
} | ||
} | ||
} |
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
Oops, something went wrong.