Post

Replies

Boosts

Views

Activity

Reply to UIcollectionView with array no loading sections
Why do you need this if-statement? if collectionView == UI.castCollectionView{ Are you still trying to show UICollectionView inside each UITableViewCell as shown in another thread of yours? I guess you are not managing such nested structure well. Please show your latest definition of NumberOfSeasonsCell if you are still using it. Also all the code related to UI.castCollectionView is needed. One more, please show all the code of collectionView(_:cellForItemAt:). It is very likely there is something wrong in the hidden parts of your code.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to UIViewcontroller.present crashing iOS 14.4
When you write PlayerViewController(), iOS tries to instantiate the view controller using PlayerViewController.xib, which uses init(coder:) internally. Whether you have touched or not is not important. The crash is happening while iOS is trying to instantiate PlayerViewController.xib. Have you tried replacing it to something new created with the latest Xcode? iOS may fail to instantiate a view controller when some old version of xib is given.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to Error initialising UnsafeMutablePointer<ObjCBool>
Ok, so how do you think the code should be written? That depends on where you want the pointer point to. Seems you are not accustomed to managing pointers in Swift. For example, if you want a pointer pointing a newly allocated region in heap: func test() { let stop: UnsafeMutablePointerObjCBool = UnsafeMutablePointer.allocate(capacity: 1) stop.initialize(to: false) //... Use `stop` ... stop.deinitialize(count: 1) stop.deallocate() } If you want to manage heap allocation by yourself, please do not forget these allocate-initialize-deinitialize-deallocate life cycle of pointer. (Not only initialize. You can abbreviate it as AIDD.) Or you want a pointer to some other thing?
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Constructing NWEndpoint from String, UInt16
In Swift, NWEndpoint.Host is a ExpressibleByStringLiteral type, so String literals can be automatically converted, but not the same as String. As well, NWEndpoint.Port is ExpressibleByIntegerLiteral, but not UInt16. You can write something like this: let host: NWEndpoint.Host = NWEndpoint.Host(parameters.dataGWIP) let port: NWEndpoint.Port = NWEndpoint.Port(rawValue: parameters.dataGWPort)! let c = NWConnection(host: host, port: port, using: .udp) (You can omit some type annotations if you prefer. And care about force unwrapping (!) of port.)
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to UIcollectionView with array no loading sections
it shows the same cell 0 content in all cells In your view controller, you have two types of cells, do you mean the same cell 0 as UITableViewCell or UICollectionViewCell? How many UICollectionView exist in your view controller? here's the code i'm not using Thanks, but no need to show unused code. UI.castCollectionView is not part of the problem Why can you believe so? If all was working as expected, you would never experience this sort of weird problem. the problem is with cell and cell model of the other UICollectionView inside the else cellForItemAt I do not understand why you restrict where to check. Do you really want to solve your issue?
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to UIViewcontroller.present crashing iOS 14.4
When you say replacing with something new created with the latest Xcode, are u saying to create a new xib from scratch and build the views to mimic the previous xib? if this is the case , no I haven't tried that yet .  Better try it as soon as possible. You have no need to mimic the previous xib, just need enough definitions to test if it causes the same crash or not.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to display map
 I created a file named MapViewController.swift it still starts the ContentView.swift Seems you created two different types of codes, UIKit and SwiftUI. Are you using MKMapView in MapViewController? Is MapViewController a subclass of UIViewController? In SwiftUI, you usually use Map, do you have any View (not UIViewController) using Map? You should better show your code.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’21