Posts

Post marked as solved
3 Replies
2.5k Views
Hi i'm new to swift just started learningI want to convert string to date format then convert the date format to a string to pass it down to a label, was trying out several steps.Steps Performedlet date = "2020-07-13T18:51:53.928+0000" let formatter = DateFormatter() let date2 = formatter.date(from: date) formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" let dateString = formatter.string(from: date2) print("The Modified Date \(dateString)")Result:The Modified Date nilThanks🙂
Posted
by aamirkhan.
Last updated
.
Post not yet marked as solved
1 Replies
2.1k Views
i did something like this extension UIView {   @IBInspectable var cornerRadius: CGFloat {     get {       return layer.cornerRadius     }     set {       layer.cornerRadius = newValue       layer.masksToBounds = newValue > 0     }   } } And added the corner radius under Keypath | Type | Value layer.cornerRadius | Number | 15 but the question is i want the rounded edges only on the top. Any idea how to implement it..?
Posted
by aamirkhan.
Last updated
.
Post marked as solved
9 Replies
1.1k Views
Can Anyone help me out in decoding this JSON { 		"name": "Foo", 		"age": 34, 		"activities": [ 				{ 						"test1": "testing", 						"type": "xyz", 						"three": { 								"label1": "Testing1", 								"content": [ 										{ 												"mark1": "markTest1", 												"mark2": "markTest2" 										} 								] 						} 				}, 				{ 						"test2": "Running", 						"type": "zzzz", 						"three": [ 								{ 										"label2": "Testing1" 								}, 								{ 										"label2": "Testing1" 								} 						] 				} 		] }
Posted
by aamirkhan.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
I have JSON Structure [ { name: "Boo", title: "Hello Boo", value: [ subject: 88 ] }, { name: "Foo", title: "Hello Foo", } ] for decoding Purpose i performed this struct Students: Decodable { let name: String, let title: String, let value: ValueHeader } struct ValueHeader: Decodable { let subject: Int? }       fileprivate func fetchTaskItems(completion: @escaping (Result<[Students], Error>) -> ()) { guard let url = URL(string: jsonString) else { return }       URLSession.shared.dataTask(with: url) { (data, response,err) in               if let err = err {         completion(.failure(err))         return       }               do {         let taskItem = try JSONDecoder().decode([Students].self, from: data!)         completion(.success(taskItem))       } catch let jsonError {         completion(.failure(jsonError))       }             }.resume()         } i get an error as valueNotFound(Swift.KeyedDecodingContainer<App.ValueHeader.(unknown context at $10fd991dc).CodingKeys>, I tried giving an optional to subject still not working any idea how to deal with this type of JSON
Posted
by aamirkhan.
Last updated
.
Post marked as solved
1 Replies
6k Views
Hi,I'm trying to achive something like this. View.. Scrollview... Label1... Label2... Label3... Label4... Label5... CollectionView.... Cell..... Content View...... Label 1...... ...... Label nSo the problem is scrollview is working fine and i'm able to pass the data on Label 1, Label 2, Label 3, Label 4, Label 5. But collection view is not being displayed. The method which i'm trying out is it correct or is there an alternative way to implement ?Thanks
Posted
by aamirkhan.
Last updated
.