Skip to content

Instantly share code, notes, and snippets.

View ptvyas's full-sized avatar

Piyush Vyas ptvyas

  • Surat, Gujarat, India
  • 16:23 (UTC +05:30)
  • X @vyas_pt
View GitHub Profile
@ptvyas
ptvyas / GenerateImage.swift
Last active March 2, 2024 05:45
Generate Programatically Image and save on Document directory
/// Generate UIImage and Save in Document Directory
func generateImageAndSave() {
var arrText : [String] = []
//arrText = ([Int](0...100)).map { $0.description } // Numbers list
arrText = (0..<26).map { i in String(UnicodeScalar("A".unicodeScalars.first!.value + i)!) } // ABCD Alphabet list
let imgSize = CGSize(width: 900, height: 1600)
for value in arrText {
guard let image = generateImage(withText: value,