Preview:
//Create tabBar Controller in storyBoard and give that class "TabBarController"

import UIKit

class TabBarController: UITabBarController {
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    
}

//To the tabBar of that TabBarController give it a class "TabBar"

import UIKit

class TabBar: UITabBar {

        var color: UIColor?
        @IBInspectable var radii: CGFloat = 20
        
        private var shapeLayer: CALayer?
        
        override func draw(_ rect: CGRect) {
            
            addShape()
            
        }
        
        private func addShape() {
            let shapeLayer = CAShapeLayer()
            
            shapeLayer.path = createPath()
//            shapeLayer.strokeColor = UIColor.gray.cgColor
            shapeLayer.fillColor = color?.cgColor ?? UIColor.white.cgColor
//            shapeLayer.lineWidth = 1
//            shapeLayer.shadowColor = UIColor.gray.cgColor
//            shapeLayer.shadowOffset = CGSize(width: 0, height: 0);
//            shapeLayer.shadowOpacity = 0.21
//            shapeLayer.shadowRadius = 8
            shapeLayer.shadowPath =  UIBezierPath(roundedRect: bounds, cornerRadius: radii).cgPath
            
            if let oldShapeLayer = self.shapeLayer {
                layer.replaceSublayer(oldShapeLayer, with: shapeLayer)
            } else {
                layer.insertSublayer(shapeLayer, at: 0)
            }
            
            self.shapeLayer = shapeLayer
        }
        
        private func createPath() -> CGPath {
            let path = UIBezierPath(
                roundedRect: bounds,
                byRoundingCorners: [.topLeft, .topRight],
                cornerRadii: CGSize(width: radii, height: 0.0))
            
            return path.cgPath
        }
        
        override func layoutSubviews() {
            super.layoutSubviews()
            self.isTranslucent = true
            var tabFrame = self.frame
            let bottomSafeArea: CGFloat
            
            if #available(iOS 11.0, *) {
                bottomSafeArea = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
            } else {
                // Fallback for older iOS versions
                bottomSafeArea = 0
            }
            
//            print(bottomSafeArea)
            tabFrame.size.height = 68 + bottomSafeArea
//            print(tabFrame.size.height)
            tabFrame.origin.y = self.frame.origin.y + self.frame.height - 68 - bottomSafeArea
//            print(tabFrame.origin.y)
//            self.layer.cornerRadius = 18
            self.frame = tabFrame
//            print(self.frame)
            
            let imageGradient = UIImage.gradientImageToTabBar(bounds: self.bounds, colors: [UIColor(resource: .color1),UIColor(resource: .color2),UIColor(resource: .color3)])
            self.color = UIColor(patternImage: imageGradient)
            
//            self.color = .brown
            self.items?.forEach({ $0.titlePositionAdjustment = UIOffset(horizontal: 0.0, vertical: 0.0) })
        }
        
    

}

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter