SZPaymentCards 1.0.1

SZPaymentCards 1.0.1

Sagar551994 维护。



  • 作者
  • Sagar551994

SZPaymentCards

CI Status Version License Platform

“SZPaymentCards”是一个轻量级的SwiftUI框架,允许创建不同类型的支付卡,如Visa卡MasterCardUnionPay等……

屏幕截图

创建卡片

显示卡片

通过以下方式联系我👇🏻

Instagram, LinkedIn

支持卡片

  • 万事达卡
  • 维萨卡
  • JCB卡
  • 运通卡
  • 发现卡
  • 美国运通卡
  • 银联卡

示例

要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install

要求

  • Xcode 12
  • iOS 14.0+
  • Swift 5.0+

安装

SZPaymentCards 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'SZPaymentCards', '~> 1.0.0'

使用示例

视图

创建一个视图并设置 SZPaymentCards

import SZPaymentCards

Swift

@State var arrCards: [SZCardData] = []

添加以下代码

@available(iOS 14.0, *)
.fullScreenCover(isPresented: $presentModel, content: {
    SZCardViewController($arrCards, presentModel: $presentModel)
        .setnavigation(Image("profile"), navTitle: "Mr. iOSDeveloper")
})

在代码中显示卡片

使用滚动视图显示多个卡片

ScrollView(.horizontal, showsIndicators: false, content: {
    HStack(alignment: .center) {
        ForEach(0..<arrCards.count, id: \.self) { index in
            GeometryReader { geometry in
                SZCardView($arrCards[index])
                    .padding(.vertical, 100)
                .onTapGesture {
                    withAnimation(Animation.default.speed(0.8), {
                        arrCards[index].flip.toggle()
                    })
                }
                .rotation3DEffect(
                    Angle(degrees: Double(geometry.frame(in: .global).minX) - 20) / -40,
                    axis: (x: 0.0, y: 20.0, z: 0.0)
                )
                    
            }
            .frame(width: UIScreen.main.bounds.width - 20, alignment: .center)
            .padding(.vertical)
            .padding(.horizontal)
        }
    }
})

作者

Sagar551994, [email protected]

许可

SZPaymentCards的开源协议为MIT。更多信息请参阅LICENSE文件。