JavaScript Required

We're sorry, but we doesn't work properly without JavaScript enabled.

Swift5 and iOS13 Migration Challenges

Every year Apple has done the upgrade in OS level and Swift language due to that it will affect existing applications and its functionality. So a developer or company needs to do an update and provide build to the vendor on time because it will impact the business more. As a developer we need to update as soon as possible otherwise it will impact business and other things. Many things are deprecated in apple. Deprecated method and class should be replaced with a new one otherwise it leads to an application crash or application instability.

On the other hand, it is increasing business for the company where the iPhone application programmers needs to learn new things and update the same in the existing application.

1. Tint color not setting in iOS13 for UIStepper so the developer needs to update the code with the new property.

In iOS13 tint color not appearing due to that new property got disclosed to implement tint color

stepper.setDecrementImage(stepper.decrementImage(for: .normal), for: .normal)
stepper.setIncrementImage(stepper.incrementImage(for: .normal), for: .normal) 

2. In iOS13 image data Can be used to convert with PHasset data because it was not working in iOS13 onwards

@available(iOS 8, *)
openfuncrequestImage(for asset: PHAsset, targetSize: CGSize, contentMode: PHImageContentMode, options: PHImageRequestOptions?, resultHandler: @escaping (UIImage?, [AnyHashable : Any]?) -> Void) ->PHImageRequestID

please avoid to implement this method in ios13

@available(iOS 13, *)
openfuncrequestImageDataAndOrientation(for asset: PHAsset, options: PHImageRequestOptions?, resultHandler: @escaping (Data?, String?, CGImagePropertyOrientation, [AnyHashable : Any]?) -> Void) ->PHImageRequestID

3. The dark mode was not working in iOS13 as expected so for dark mode support. But using the below steps you can handle dark mode for now. There is one key field we need to add in info.plist file. After adding that key iOS will allow the light mode to Force Appearance Over The dark mode.

Dark Mode Iso13

4. When developers are getting multiple command errors in Xcode and console then they need to change in project settings related to the project.

Legacy build

The developer needs to select the Legacy build system from build settings.

5. In iOS13 Audio player got crashed while playing the video with URL for that developer need to replace a piece of code in the audio player then it will work as expected.

Existing before iOS13
varaudioMusicPlay: AVAudioPlayer = AVAudioPlayer()
audioMusicPlay = try AVAudioPlayer(contentsOf: audioUrl)
Replacement in iOS13
varaudioMusicPlay: AVAudioPlayer!.

6. In iOS13 onwards model is not appearing in Fullscreen due to that developer need to modify the code and add some piece of code to correct it.

letviewModel= UIViewController()
viewModel.modalPresentationStyle = .fullScreen
self.present(viewModel, animated: true, completion: nil)

7. In iOS13 onwards, the scrolling, touching and tapping not detecting the custom url in textview but it was working fine in iOS13 below.

functextView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
    switch interaction {
    case .invokeDefaultAction:
    if textView.gestureRecognizers?.contains(where: {$0.isKind(of:    
    UITapGestureRecognizer.self) && $0.state == .ended}) == true {

    return false
            }
    return true
    case .presentActions:

    return true
    case .preview:

    return true
        @unknown default:
    fatalError()
    }
}

8. In iOS13 onwards, there was big problem for tab bar where shadow image not showing or setting properly.

                    
if #available(iOS 13, *) {
    let appearance = self.tabBar.standardAppearance.copy()
    appearance.backgroundImage = UIImage()
    appearance.shadowImage = UIImage()
    appearance.shadowColor = .clear
    self.tabBar.standardAppearance = appearance
        } else {
    self.tabBar.shadowImage = UIImage()
    self.tabBar.backgroundImage = UIImage()
}

9. In iOS13 onwards, there is issue with UISegmentedControl where gesture and swiping not working properly then developer need to change piece of code for iOS13.

classNoSwipeSegmentedControl: UISegmentedControl {

        overridefuncgestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        return true
    }
}

10. In iOS13 onwards, developers are getting stuck with get and post call where calls are not happening as expected then developers need to change the piece of code.

do {
    request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
    } catch let error {
    errorCompletion(error)
    return
}        

11. In iOS13 onwards, UIApplicationExitsOnSuspend is not applicable and supported so developer need to add multithreading concept and define in such a way that program will run consistently.

12. In iOS13 onwards, Switch case statement getting problem and exhaust so instead of Switch case developers need to use enum.

For that default cases can be handled with @unknown default:

13. In iOS13 onwards , Some filter issue will not work like map so developer need to use need new concept from swift5 which is compactmap.

compactMapValues(_:)

14. In iOS13 onwards, multiplier will not work as expected because its method got changed in swift5.

isMultiple(of:)

15. Index is getting deprecated in swift 5 and iOS13. So developer need to add new keyword and handle in the program properly with

16. In iOS13 onwards, statusBarOrientation was not working where orientation not defining

varstatusBarOrientation: UIInterfaceOrientation? {
    get {
    guard let orientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation else {
                #if DEBUG
    fatalError("UIInterfaceOrientationnot working")
                #else
    return nil
                #endif
            }
    return orientation
        }
}