Post

Replies

Boosts

Views

Activity

Reply to URLSessionDelegate usage
class ViewController: UIViewController {       var delegate: SessionHelper?       override func viewDidLoad() {     super.viewDidLoad()     // Do any additional setup after loading the view.         let request = URLRequest(url: URL(string: "https://www.google.com/")!)           let session = URLSession(configuration: .ephemeral, delegate: delegate, delegateQueue: nil)           session.dataTask(with: request) { data, response, error in       if let error = error {         print(error.localizedDescription)       } else {         // handle success request body                   if let _ = data {           print("success data got.")         }       }     }.resume()   }     } protocol SessionHelper: URLSessionDelegate {} extension SessionHelper {   func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {     print("challenge")   } } //class SessionHelper: NSObject, URLSessionDelegate { //  func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { // //    print("challenge") // //  } //}
Dec ’21
Reply to Dynamic Localization
All lang files are placed like this: RuntimeLocalizade -> en.lpoj -> languages.strings and When I setts Bundle Name is RuntimeLocalizable.bundle - weren't created any file only created-RuntimeLocalizable.bundle but, i changes Bundle Name to RuntimeLocalizable - all of lang files were created like this in RuntimeLocalizable en.lproj -> languages.strings tr.lproj -> languages.strings
Jan ’21
Reply to Dynamic Localization
Claude31, I'm getting language data from server and writing to lproj directories, all files (en.lproj, tr.lproj...) successfully writing but when i writing this line of code, i can't see any changes, and i getting error message for second line: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value let bundlePath = Bundle.main.path(forResource: "en", ofType: "lproj") let bundle   = Bundle(path: bundlePath!)! return NSLocalizedString("entertainment_header", tableName: "", bundle: bundle, value: "", comment: "")
Jan ’21
Reply to Dynamic Localization
When i setting bundle name like this: static let bundleName = "RuntimeLocalizable" en.lproj ar.lproj ... is creating but now static let bundleName = "RuntimeLocalizable.bundle" lang files aren't created. RuntimeLocalizable.bundle file is creating i can't see any changes on textlabel's value. error message is en.lproj... path is null (because, files wasn't created)
Jan ’21