Posts

Showing posts from May, 2024

Increase the font size based on phone text size swift

 Problem: increase the font size based on phone text size swift Solution: //  MARK: - Font extension extension   UIFont {      func   largeBold () ->  UIFont {          return   UIFontMetrics . default . scaledFo nt ( for :  UIFont ( name :  myfontName ,  size : 17)!)     }

does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath swift

  Problem: While run the collectionview with headers it shows the below error does not have a reuseIdentifier - cells must be retrieved by calling - dequeueReusableCellWithReuseId entifier:forIndexPath      func   configCell ( message :  String ,  atIndex :  IndexPath ) ->  UICollectionViewCell  {          return   UICollectionViewCell()     } Solution: Because it have no cell.That's why it shows exception      func   configCell ( message :  String ,  atIndex :  IndexPath ) ->  UICollectionViewCell  {          guard   let  cell =  self . CollView . dequeueReu sableCell ( withReuseIdentifier :  NewCell . identifie r ,  for : atIndex)  as ?  NewCell   else  {              return   UICollectionViewCell ()         }          return  cell     }

Want to get the item based on my indexpath rxcollectionviewdatasource

 Problem: I want to get the item from rxcollectionviewdatasource from multiple sections with multiple items. Solution :      func   collectionView ( _  collectionView:  UICollectionView ,  layout  collectionViewLayout:  UICollectionViewLayout ,  sizeForItemAt  indexPath:  IndexPath ) ->  CGSize  {          if   let  item =  try ? d ataSource . model ( at : indexPath)  as ? My Item  {              switch  item {              case  . model1 (_):                  return   CGSize . zero                               case  .  model2 ( info :  let  info):                  return   CGSize ( width : 320,  height : 100 )                               case  .  model3 ( info : _):                  return   CGSize(width: 320, height:  100 )                               case  .  model4 ( info : _):                  return   CGSize ( width : 320,  height :  100 )             }         }          return   CGSize . zero     } ViewModel: typealias   SectionOfSearch  =  SectionModel < CollViewSea

SOTabBarController selected index not refreshing issue iOS swift

 Problem: I had tried that select particular index on  SOTabBarController.In log it shows selected index updated but in UI not updated. How to solve that? Solution: In your cocoapod file add the code in  SOTabBarController file    public   func   preSelectedIndex ( index :  Int ){              self . tabBar . didSelectTab ( index : index)         } In another class file  Class SOTabBar update the code aslike below  from private to normal function func didSelectTab(index: Int) {

control swipe direction only on right swipecellkit

 Problem: I want to enable only the left swipe not right swipe in swipecellkit.How to achieve that? Solution:      func   collectionView ( _  collectionView:  UICollectionView ,  editActionsForItemAt  indexPath:  IndexPath ,  for  orientation: SwipeCellKit. SwipeActionsOrien tation ) -> [SwipeCellKit. SwipeAction ]? {          guard  orientation == . right   else  {  return   nil  } }