TinderSwipeView 1.1.8

TinderSwipeView 1.1.8

Nicky Patson 管理。



  • 作者:
  • nickypatson

Tinder Swipe View Swift 5.0.x

受 Tinder 和 Potluck 激发的动画,包含随机的撤销功能!

为了更好的动画效果,请在物理设备上运行!

预览

Size Limit example Size Limit example

屏幕截图

Size Limit example Size Limit example

使用 CocoaPods 安装

CocoaPods 是用于 Swift 的依赖项管理工具,它自动简化了在项目中使用第三方库的过程。您可以使用以下命令安装它:

$ gem install cocoapods

Podfile

要将 GradientSlider 集成到您的 Xcode 项目中,并使用 CocoaPods,请在您的 Podfile 中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
use_frameworks!

pod 'TinderSwipeView’ , '~> 1.1.8'
end

然后,执行以下命令

$ pod repo update

$ pod install

实例化

使用以下方法程序化地实例化 Tinder Swipe

    let swipeView = TinderSwipeView<UserModel>(frame: viewContainer.bounds, contentView: contentView)
    swipeView.showTinderCards(with: userModels)
    

动态创建 Tinder 卡片,可以通过程序化或从 nib 为每个索引即时创建

public typealias ContentView = (_ index: Int, _ frame: CGRect, _ element:Element) -> (UIView)

动画

    internal func didSelectCard()
    internal func cardGoesRight()
    internal func cardGoesLeft()
    internal func rightClickAction()
    internal func leftClickAction()
    internal func makeUndoAction()
    internal func shakeAnimationCard(completion: @escaping (Bool) -> ())

代理方法

以下是可以监听的回调列表

protocol TinderCardDelegate: NSObjectProtocol {

    func dummyAnimationDone()
    func didSelectCard(card: TinderCard)
    func fallbackCard(model:Any)
    func currentCardStatus(card: Any, distance: CGFloat)
    func cardGoesLeft(_ object: Any)
    func cardGoesRight(_ object: Any)
    func endOfCardsReached()
}

要求

* Swift 5
* XCode 10
* iOS 8.0 (Min SDK)

作者

Nicky Patson

主页

[email protected]

许可协议

Tinder Swipe View 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。

致谢

基于TTGEmojiRate的 Emoji