Home
Softono

WDFlashCard

Open source MIT Swift
21
Stars
3
Forks
2
Issues
2
Watchers
3 years
Last Commit

 About WDFlashCard

WDFlashCard is a simple lightweight component for displaying flashcards inside iOS apps.

Platforms

Web Self-hosted macOS iOS

Languages

Swift

Links

Need Help Installing WDFlashCard?

We provide expert installation service for this software. Our team will install, configure, and secure WDFlashCard on your server. plans start at just $30.

WDFlashCard

View on GitHub

WDFlashCard

CocoaPods Compatible License Platform

WDFlashCard is a simple lightweight component for displaying flashcards inside iOS apps. Just add front and back view, set flashcard animation type and duration.

GitHub Logo

Installation:

Manual:

Just download source code and include WDFlashCard/WDFlashCard/WDFlashCardView.swift in your project.

CocoaPods:

target '<TargetName>' do
    use_frameworks!
    pod 'WDFlashCard'
end

Usage

Add UIView to storyboard or Xib file and set WDFlashCard as its class. Also, add two views inside this WDFlashCard view to use them as a back and front view for flash card view. Then set WDFlashCardDelegate (using interface builder or in code) and implement its metods: flipBackView to set back view and flipFrontView to set front view.

class ViewController: UIViewController, WDFlashCardDelegate {
    
    @IBOutlet weak var backView: UIView!
    @IBOutlet weak var frontView: UIView!
    @IBOutlet weak var flashCard: WDFlashCard!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        flashCard.duration = 2.0
        flashCard.flipAnimation = .flipFromLeft
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    //MARK: WDFlashCardDelegate methods
    
    func flipBackView(forFlashCard flashCardView: WDFlashCard) -> UIView {
        return backView
    }
    
    func flipFrontView(forFlashCard flashCardView: WDFlashCard) -> UIView {
        return frontView
    }
}

If you want to disable tap to flip option, you can set flashCard.disableTouchToFlipFesture to true (By default, it is set to true).

flashCard.disableTouchToFlipFesture = true

In that case, you are still able to flip this view. All you need to do is to call flip() method from wherever you need:

flashCard.flip()

For better understanding look at the source code example.

Note:

If you find any bug, please report it, and I will try to fix it ASAP.