ZIPFoundation progress displayed using SwiftUI ProgressView - swiftui

I'm having an application in SwiftUI and I am using ZIPFoundation to uncompress an archive. This works fine. At the moment I am using native SwiftUI ProgressView(title) to display during the uncompress process, again working fine, anyway it only displays a rotating wheel and no progress scale.
I would like to change to ProgressView(title, value, total) to display the scale, anyway not sure how. I have found this example, but it uses UIKit and addObserver() and I am not sure how to adapt this to SwiftUI, or if there is better way with SwiftUI.
Can anyone please help.

Related

ChartJS charts width and height set to 0 when responsive and dragged. Any ideas as to why?

I am in the process of building a dashboard with multiple charts on it. For a chart library I've landed on VueChartJS, with the vue-chart-3 wrapper and for a drag n drop library I'm using vue-draggable-next.
The issue I'm having is that if the charts have the responsive option as true and you drag them, their height and width are set to 0. I added a toggle to prove that it's an issue with the responsive feature, but is there anything else I can do to remedy this issue?
Right now I'm wondering if I need to make some invisible toggle that activates every time you click the chart to drag it around and then toggles off when you are done dragging, but that seems like a lot of potential code and time to impliment this feature and wonder if there's not just a better way to do this?
Any advice or help would be greatly appreciated!
I've made a CodeSandbox to show the issue and there is a gif below as well showing what is happening.

SwiftUI Image crashes when you add dark mode asset

I've been using SwiftUI on this simple WidgetKit (iOS 14) successfully, until I added a dark mode asset (PDF) to the image:
If I choose, under "appearance" on the right, "Any, Dark", the widget crashes. I thought SwiftUI would handle this gracefully... Is there a "proper" way to take advantage of the image set's appearances, or do I have to do write the logic to choose between 2 image sets?

Scrolling region in cocos2d version 2

I am trying to implement a help screen in my cocos2d game, using cocos2d version 2.0. My screen will have a title bar ("Help") at the top and then the rest of the screen below that is where I want to put a scrolling help section. Ideally I would be able to put both text and images into this help window.
The problem is that cocos2d does not have any functionality like UIScrollView, and from what I have seen doing Google searches, every custom solution I have found seems to have problems with various bugs popping up on various devices.
I have tried these solutions thus far:
CCScrollLayer: http://www.cocos2d-iphone.org/forum/topic/17118/page/3
Scrolling CCNode: http://tonyngo.net/2011/11/scrolling-ccnode-in-cocos2d/
CCScrollView: http://bitbattalion.com/2011/09/uikit-uiscrollview-and-cocos2d/
The closest thing I got to work was embedding a UITextView but that seemed to randomly crash after a few scrolls so it seems unreliable to me.
Does anyone know of a good simple robust solution to this problem? It seems like it should be straightforward but it isn't.
I recommend that you make new class say:(HelpViewClass) and implement it with an UIScrollView and add whatever you want to add on UIScrollView and then you can use this as a child to your layer.
Steps
Make a class - inherited with UIView
Add UIScrollView to the View.
Add Your components to it.
Add this UIView to the HelpLayer.
You can add any UIKit component to the cocos2d Layer by using this
[[[CCDirector sharedDirector] view] addSubView:scrollView];
Note : Remove all UI component when you go back from this HelpLayer.
I think this may help you !

Integrating MapKit with Cocos2D

I'm a bit new with MapKit and have been trying to find the answer to this question:
Can I integrate, or to what extent can I integrate MapKit with Cocos2d?
In having this question answered, I hope that somebody could point me in the right direction on how to approach this scenario:
I am developing a Cocos2D app in which one part of the app would be the MapKit application, showing location and annotations (basically everything that comes with MapKit), and the user has the option to switch to the Cocos2D part. (Switching back and forth between the Map and the Game).
If the two were integrated, would there then be a way to overlay a Cocos2D Menu system over the MapKit and treat MapKit as simply a CCLayer or CCNode? or do I need to treat these two as separate entities altogether by only using UIKit buttons and menus with MapKit, and the only real mix between them is the passing of data from MapKit on to Cocos2D view on transition and vice versa?
Would it follow the same concept as integrating UIKit and Cocos2D in this answered question or this tutorial? Or do I have to use a special wrapper class such as CCUIViewWrapper? I read that CCUIViewWrapper is always drawn on top, so it could possibly not allow me to draw a Cocos2D Menu on top of the map, or even overlay a Cocos2D object once a UIKit button is pressed in the MapKit App.
Any help would be appreciated...Thanks!
I think using CCUIViewWrapper will be a good idea, about the question that CCUIViewWrapper always draw on the topmost layer of View I think that is kinda wrong(I am not sure) as CCUIViewWrapper returns the object in the format of CCNode so you can add it anywhere on the screen you would like to (If I was in your place I would have first tested this with adding a small sprite on top of a MapKit View in a cocos2d project just to be sure).
-Ankur

Cocoa application with cocos2d-iphone?

I'd like to do this:
Create a Cocoa application with a couple NSButtons in it. Also, a "cocos2d-iphone" view running in the same window.
If I trigger the NSButtons, a function is called in the cocos2d-iphone view (not sure where, maybe in the currently running scene?).
Well, I managed to create a new project from the cocos2d-iphone for Mac template, made the window bigger than the cocos2d view, moved the cocos2d view, and added my NSButtons. Now, I am not very sure about how to make the connection I need.. =/
I suggest reading an Interface Builder tutorial. This one is using Quartz, it's not Cocos2D but close enough. Simply assume the Quartz view to be Cocos2D view while you go through the tutorial.
Note that Cocos2D/EAGLView has some issues with NSView objects. In particular you can't add NSView objects as subviews to the Cocos2D OpenGL view, they will simply not be displayed. This is a general problem of the OpenGL view on Mac, and there are solutions/workarounds for this but they unfortunately do not work with Cocos2D. So if you're planning to have NSView objects overlapping the Cocos2D view … well, you can try and if you can make it work, PLEASE let me know how! :)