intuit/CardParts

Does not display the style of the Card

WingCH opened this issue · 2 comments

  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

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

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!