Post

Replies

Boosts

Views

Activity

Reply to Viewing Interface in XCode 12.3
What sort of CocoaSlideshow have you downloaded? I cannot find one in Apple's pages. I cannot display the interface in XCode. Old apps may be using .xib (or .nib, if it's too old) instead of .storyboard. Or the app may be constructing UI by code. How can I display the interface in this project? If you cannot find any in a buildable project, no way. The project may not have a visual interface definitions like storyboard or xib.
Mar ’21
Reply to Navigation Bar Items Leading is not working
Seems like working: struct ContentView: View { var body: some View { NavigationView { MainView() .navigationBarItems(leading: Button(action: {}, label: {Image(systemName: "plus")})) } } } struct MainView: View { var body: some View { VStack { NavigationLink( "To second", destination: SecondView() .navigationBarItems(leading: Text("Leading")) ) Text("MainView") } } } struct SecondView: View { var body: some View { Text("SecondView") } } What is the solution? When you want some solution about the code which does not run as expected, you should better include the issue-reproducible code. Simplified would be welcome, but please include all the information required to run and test it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Viewing Interface in XCode 12.3
When I click on same file in the Modified code I don't see it and the message Unable to load Revisions appears OK, please clarify: You can find MainMenu.xib in your project ( after modified). You cannot open or edit the MainMenu.xib in Xcode the message Unable to load Revisions appears - ??? Where and when? When you try to open it? Or when build it? how can I make its click event execute the code to add padding to the image and write in it? Please do not ask two things in one thread.
Mar ’21
Reply to Error initialising UnsafeMutablePointer<ObjCBool>
If you look at the documentation for UnsafeMutablePointer you will see that the memory pointed to has to be initialised, not the pointer itself and that the initialize method does this. You are misinterpreting the documentation. The doc says you need to initialize the region allocated, but it does not say anything about the variable initialization. You may be confused with calling initialize and giving an initial value to a variable declared. This still fails the same way. I will report it as a compiler bug. NO. It is your misinterpreting the documentation.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Viewing Interface in XCode 12.3
When I click on it  Please confirm, all you done is click on it, right? the project builds and runs OK. You have not written in any place that you Build or Run your project. How do you confirm the project builds and runs OK? Please write everything you have done in your project. Have you never touched Comparison button (⇄)? I am re-entering the project modifications to the downloaded code and so far the interface is visible when clicking MainMenu.xib. Seems you can work on it. Please remember everything you have done it, when you find something wrong in your project.
Mar ’21
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