Posts

Showing posts from September, 2023

storyboards access globally iOS swift

 Solution: import Foundation import UIKit enum AppStoryboard : String {          case Main     case Settings     var instance : UIStoryboard {                  return UIStoryboard ( name : self . rawValue , bundle : Bundle . main )     }          func viewController <T : UIViewController >( viewControllerClass : T. Type , function : String = #function , line : Int = #line , file : String = #file ) -> T {         let storyboardID = (viewControllerClass as UIViewController . Type ). storyboardID         guard let scene = instance . instantiateViewController ( withIdentifier : storyboardID) as ? T else {             fatalError ( "ViewController with identifier \(storyboardID) , not found in \( self . rawValue ) Storyboard.\nFile : \(file) \nLine Number : \(line) \nFunction : \(function) " )         }                  return scene     }          func initialViewController () -> UIViewController ? {         return instance . instantiateIn

Externally open the url in browser from app iOS swift

 Problem: I want to open one url from my app to browser.Also validate the url. How to achieve that? Solution:      // MARK: - Open web url     func openWeb ( urlSting : String ) {         if let url = URL ( string : urlSting), UIApplication . shared . canOpenURL (url) {             UIApplication . shared . open (url)         }     }

After full content load for webview then only hide loading indicator iOS swift

 Problem: I want to show loading indicator before load of webview content till webview content fully loaded. After content loaded hide the loader and show the webview.How to achieve that? Solution:      override func viewWillAppear ( _ animated: Bool ) {          webView . addObserver ( self , forKeyPath : #keyPath ( WKWebView . estimatedProgress ), options : . new , context : nil )                  DispatchQueue. main . async {             self . loadwebUrl ()         }     }      override func viewWillDisappear ( _ animated: Bool ) {         super . viewWillDisappear (animated)         webView . removeObserver ( self , forKeyPath : #keyPath ( WKWebView . estimatedProgress ))     }      override func observeValue ( forKeyPath keyPath: String ?, of object: Any ?, change : [ NSKeyValueChangeKey : Any ]?, context : UnsafeMutableRawPointer ?) {         if keyPath == "estimatedProgress" {             // showLoading         }     }      func   loadwebUrl () { } exten

Not able to add internal tester to my newly created app

Image
 Problem: I had created new app in my apple developer account.I had already that user as manager role in my account .In new app i click add in ternal tester i'm not able to get my existing user in that.How to solve that? Solution: It's because you are not added the app in that user.So goto Users -> select the user you want add to the new app.Scroll down the page.In bottom of the screen it will had list of apps added to the user. Click on that text box it will show list of apps.Then select the app you want to test.It will works good..User added to the app for internal testing..

App store developer links for account certificates nad apps iOS

 Solution: Users list Url https://appstoreconnect.apple. com/access/users App ID's List https://developer.apple.com/ account/resources/identifiers/ list Apps List https://appstoreconnect.apple. com/apps

How to debug my website opened in iPad or iPhone to show developer console iOS

 Problem: I'm having my website that had some issues while open in mobile browser.In system browser it was working good. I don't know how to show the console log in mobile browser. How to debug my website in browser? Solution: Ya it's a great question and the answer is yes.But if you had installed chrome browser then it's not possible.You can debug website opened in safari browser to you can able to show console log in your system. Step 1: Goto iphone and open settings app -> goto safari -> select advanced -> toggle on the web inspector Step 2: Connect your iphone to the mac and open safari browser in mac then in menu open settings select advanced and select develop menu in menu bar Step 3:open the website you want to debug in iphone safari browser the console will shown in mac. Happy coding and enjoyyy......

UICollectionview header implementation iOS swift

 Problem: I want to add header like tableview view to show the title of the section in UICollectionview iOS swift Solution:      func collectionView ( _ collectionView: UICollectionView , layout collectionViewLayout: UICollectionViewLayout , referenceSizeForHeaderInSection section: Int ) -> CGSize {         let indexPath = IndexPath ( row : 0 , section : section)         let headerView = self . collectionView (collectionView, viewForSupplementaryElementOfKind : UICollectionView . elementKindSectionHeader , at : indexPath)                  return headerView.systemLayoutSizeFitting( CGSize ( width : collectionView. frame . width , height : UIView . layoutFittingExpandedSize . height ),                                                   withHorizontalFittingPriority: . required , // Width is fixed                                                   verticalFittingPriority: . fittingSizeLevel )     }          func collectionView ( _ collectionView: UICollectionView , viewForSuppl

Implement multiple video views in UIView iOS swift

 Problem: I want to implement two video's in my view with play and pause options.Also show play button. While scroll my scrollview i want pause the video. How to achieve the both above? Solution: import AVFoundation import RxSwift import RxCocoa class  My VC : UIViewController {      @IBOutlet weak var videoView : UIView !     @IBOutlet weak var videoPlayBtn : UIButton !          @IBOutlet weak var   videoView1 : UIView !     @IBOutlet weak var   videoPlayBtn1 : UIButton !          var player : AVPlayer !     var playerLayer  = AVPlayerLayer ()      var isPlayer : Bool ! = false      var   player1 :  AVPlayer !      var   playerLayer1  =  AVPlayerLayer ()      var   isPlayer1 :  Bool ! =  false      // MARK: - viewDidLoad     override func viewDidLoad () {          try ! AVAudioSession . sharedInstance (). setCategory ( AVAudioSession . Category . playback , options : [])         self . videoPlayBtn . tintColor = . lightGray         self . videoPlayBtn1 . tintCo