Add shadow in tableview cell using cardView iOS swift

 Solution:

Add pod specification as like below

  pod 'MaterialComponents/ShadowElevations'


Then add extension of class as like below


class ShadowedViewUIView {


  override class var layerClassAnyClass {

    return MDCShadowLayer.self

  }


  var shadowLayerMDCShadowLayer {

    return self.layer asMDCShadowLayer

  }


  func setDefaultElevation() {

    self.shadowLayer.elevation = .cardResting

      

  }


}


Assign class to the view as  ShadowedView then apply the code as like below

        shadowView.setDefaultElevation()


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift