Post

Replies

Boosts

Views

Activity

How to make the upper corner edges rounded for UIView
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..?
1
0
2.3k
Jul ’20
Any Idea how to Decode this JSON
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" 								} 						] 				} 		] }
9
0
1.4k
Jul ’20
JSON array of mixed types using JSONDecoder
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
1
0
2.2k
Jul ’20
How to use CollectionView inside a ScrollView
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
1
0
6.8k
May ’20
Date Conversion
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🙂
3
0
2.8k
May ’20