Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.62k stars 1.12k forks source link

code base UI skeleton not working #547

Open yoonjason opened 1 year ago

yoonjason commented 1 year ago

hi

First I'll show you my code

import snapkit
import Then
import SkeletonView

class BaseViewController: UIViewController {

}

class DoSomethingViewController: BaseViewController {

 private let testLabel: UILabel = .init()

    override func viewDidLoad() {
        super.viewDidLoad()
        setupViews()
        setupLayoutConstraints()
   }

    func setupViews() { 
        testLabel.do {
            $0.text = "terminating with uncaught exception of type NSException"
            $0.textAlignment = .left
            $0.numberOfLines = 0
            view.addSubview($0)
        }
   }

    func setupLayoutConstraints() {
            testLabel.snp.makeConstraints {
            $0.top.equalTo(imageButton).offset(20)
            $0.centerX.equalToSuperview()
            $0.leading.equalToSuperview().offset(10)
            $0.trailing.equalToSuperview().offset(-10)
        }
    }

    override func viewDidLayoutSubviews() {
       super.viewDidLayoutSubviews()
       testLabel.isSkeletonable = true 
       testLabel.showSkeleton()
    }

}

Is there a way to fix the app crashes with the following error?

-[UILabel setIsSkeletonable:]: unrecognized selector sent to instance 0x158708450