intuit / CardParts

A reactive, card-based UI framework built on UIKit for iOS developers.
Other
2.52k stars 224 forks source link

Does not display the style of the Card #125

Closed WingCH closed 5 years ago

WingCH commented 5 years ago
  1. Create project on Xcode
  2. https://github.com/intuit/CardParts#installation (current version:2.7.2)
  3. copy and paster using example code

    https://github.com/intuit/CardParts/blob/master/Example/CardParts/MainViewController.swift

class ViewController: CardsViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let cards: [CardPartsViewController] = [
            CardPartTextViewCardController(),
            CardPartTitleDescriptionViewCardController(), ]

        loadCards(cards: cards)
    }

    class CardPartTextViewCardController: CardPartsViewController {

        let cardPartTextView = CardPartTextView(type: .normal)

        override func viewDidLoad() {
            super.viewDidLoad()

            cardPartTextView.text = "This is a CardPartTextView"

            setupCardParts([cardPartTextView])
        }
    }
    class CardPartTitleDescriptionViewCardController: CardPartsViewController {

        let cardPartTitleDescriptionViewRight = CardPartTitleDescriptionView(titlePosition: .top, secondaryPosition: .right)
        let cardPartTitleDescriptionViewCenter = CardPartTitleDescriptionView(titlePosition: .top, secondaryPosition: .center(amount: 0))

        override func viewDidLoad() {
            super.viewDidLoad()

            cardPartTitleDescriptionViewRight.leftTitleText = "Look at my alignemnt"
            cardPartTitleDescriptionViewRight.rightTitleText = ".right aligned!"

            cardPartTitleDescriptionViewCenter.leftTitleText = "Look now!"
            cardPartTitleDescriptionViewCenter.rightTitleText = ".center aligned"

            setupCardParts([cardPartTitleDescriptionViewRight, cardPartTitleDescriptionViewCenter])
        }
    }
}

image

I have checked again, but I can't find the reason. Can someone help me? Please

WingCH commented 5 years ago

i have find the problem. missing CardPartsMintTheme().apply() in AppDelegate.swift Suggested update Readme -> Quick Start

croossin commented 5 years ago

We will consider adding that, however, we don't want to apply a specific theme for all examples. Thanks for the tip and we will take it into consideration!