self.navigationBar.setBackgroundImage(createImageWithColor(UIColor.clear), for: .default)


//


func createImageWithColor(_ color:UIColor) -> UIImage{

    return createImageWithColor(color, size: CGSize(width: 1, height: 1))

}

func createImageWithColor(_ color:UIColor,size:CGSize) -> UIImage {

    let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)

    UIGraphicsBeginImageContext(rect.size);

    let context = UIGraphicsGetCurrentContext();

    context?.setFillColor(color.cgColor);

    context?.fill(rect);

    

    let theImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return theImage!;

}