Posts

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 ()         ...

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   C...

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  } }

Copy and paste the coredata object in my project iOS swift

 Problem: I want to copy my coredata object into cache and paste it somewhere in my project.How can i achieve that? Solution: You have to achieve that by using userdefaults in your project.But you cannot save the entire object in the defaults.So you have to store the coredata object ID in the defaults. While paste fetch the object based on coredata id and then paste it somewhere.      //  MARK: -  copy and paste the object      func   setCopyMyObj ( value :  myObject ) {          self . userDefaults . set (value. ob jectID . uriRepresentation (). abs oluteString ,  forKey :  " myobj " )              self . saveValue ()     }           func   removeCopyObj () {        self . userDefaults . removeObject ( forKey :  " myobj " )        self . saveValue ()    ...

Increase font size of my editor XCode iOS

Problem:  I want to change my xcode editor font size to be increase or decrease. How can i changes that? Solution: command key and + key to be pressed on same time to increase the font size of xcode editor. command key and - key to be pressed on same time to decrease the font size of xcode editor.