Latest 0.3.0
Homepage https://github.com/myoungsc/SCCardView
License MIT
Platforms ios 9.0
Dependencies SDWebImage
Authors

CI Status
Version
License
Platform

Description

A view that changes the content by selecting a card. Content can be customized, but images are essential.
You can change the card by clicking on it or by swiping up and down gestures.

ScreenShot

Requirements

* Swift 3.0.1
* XCode 8.3.1
* iOS 9.0 (Min SDK)

Installation

SCCardView is available through CocoaPods. To install it, simply add the following line to your Podfile:

//Add Podfile
pod "SCCardView"

//After
pod install

How To Use

If you use a URL, you can set the key value to "url". But "image" is a required parameter. If you use "url", the value of the "image" key will be entered into the placeholder image if it can be empty. The URL image is rendered dependent on SDWebImage.

import SCCardView

// Int index, [String: String] key, Value
// Make dummy data (Necessary key Image Card UI)
let dummyData: [Int: [String: Any]] = [0: ["image": UIImage()!,
                                          "title": "Catholic Church",
                                          "url": "https://github.com/myoungsc/SCCardView/blob/master/Example/SCCardView/Images.xcassets/sc0.imageset/sc0.jpg?raw=true",
                                          "description": "Maybe famous Catholic Churchsadl"],
                                       1: ["image": UIImage(named: "sc1")!,
                                           "title": "Beautiful Sea",
                                           "description": "Beautiful sea anywhere on earth"],
                                       2: ["image": UIImage(named: "sc2")!,
                                          "title": "Famous temple",
                                           "description": "A landscape of famous temple"],
                                       3: ["image": UIImage(named: "sc3")!,
                                          "title": "Pretty Flower",
                                          "description": "Pretty Flowernphoto  by myoung father"],
                                       4: ["image": UIImage(named: "sc4")!,
                                          "title":"Vast Sky",
                                          "description": "Vast korea skynphoto by myoung father"],
                                       5: ["image": UIImage(named: "sc5")!,
                                          "title": "Leaf",
                                          "description":"Leaf anywhere on Koreanphoto by myoung father"]]

sccard.delegate = self
sccard.cardStyle = .onlyTop
//if cardstyle round cutom
/*
 sccard.cardStyle = .custom
 sccard.initCustomCardStyle([.topLeft, .bottomRight])
 */
sccard.initialViewData(dummyData)

// Set initial value
if let dicSubData: [String: Any] = dummyData[0] {
    if let img: UIImage = dicSubData["image"] as? UIImage,
        let title: String = dicSubData["title"] as? String,
        let des: String = dicSubData["description"] as? String {
        sccardSubImg.image = img
        sccardSubTitle.text = title
        sccardSubDes.text = des
    }
}
// Autolayout bottom card ratio
contBottomDes.constant = sccard.bottomInterval

// Delegate
// Selector Card Click. Required Delegate
func SCCardSelectorCard(_ index: Int, dic: [String: Any]) {
    if let img: UIImage = dic["image"] as? UIImage,
        let title: String = dic["title"] as? String,
        let des: String = dic["description"] as? String {
        sccardSubImg.image = img
        sccardSubTitle.text = title
        sccardSubDes.text = des
    }
}

// Refresh content view from down image. Required Delegate
func SCCardURLIndexRefresh(_ img: UIImage) {
    sccardSubImg.image = img
}

// Card Down Gesture. optional Delegate
internal func SCCardDownCardAction(_ indexPath: IndexPath) {
    print("down gesture (indexPath)")
}

// Card Up Gesture. optional Delegate
internal func SCCardUpCardAction(_ indexPath: IndexPath) {
    print("up gesture (indexPath)")
}

Author

myoung

HomePage

myoungsc.dev@gmail.com

License

SCPageControl is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SCCardView",
    "version": "0.3.0",
    "summary": "Selector card to change content view",
    "description": "Selector card to change content view.",
    "homepage": "https://github.com/myoungsc/SCCardView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "myoung": "myoungsc.dev@gmail.com"
    },
    "source": {
        "git": "https://github.com/myoungsc/SCCardView.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "SCCardView/Classes/**/*",
    "dependencies": {
        "SDWebImage": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This