Closed Blackjacx closed 4 years ago
Hey Blackjacx,
Since CCActivityHUD is written in Objective-C, I have not tested it with Swift. I think it may be a bug of CCActivityHUD.
Anyway, I will find the solution and/or fix it as soon as I can.
Hey, that will be awesome :-) Thank you!
Hey Blackjacx,
The problem is that tick.png and cross.png are not copied to your target.
A temporary solution is to add the two images (you can find these resources within the same directory of code files of CCActivityHUD) to your target. But this will make the project directory a little dirty.
I am working on making Cocoapods automatically copy resources to the target.
Hey Blackjacx,
Update CCActivityHUD to v2.1.6 and it will work.
I have tested it with a Swift project. Tell me if it works on your device.
Hey Cokile,
it does not work yet. Do I have to set a special property? Even in a new Swift project it does not work for me with 2.1.6....
Can you show me the related code and the Xcode navigator panel?
private lazy var activity: CCActivityHUD = {
let activity = CCActivityHUD()
activity.cornerRadius = kDefaultCornerRadius
activity.overlayType = .Shadow
return activity
}()
private func showActivity() {
activity.showWithType(.TriangleCircle)
}
private func dismissActivity() {
activity.dismiss()
}
Hey Blackjacx,
I have also created a new test Swift project, and installed the CCActivityHUD v2.1.6 by Cocoapods, it worked for me.
Can you show me your Xcode navigator panel? The correct one should like the capture below
Ahh maybe the difference is that I build a framework from your library using cocoapods. My Navigator is different in the ressources folder (you have an additional subfolder):
Maybe you did not tag and push the latest version on Github?
Try to re-install it and let me know if it will work
Nope I think I'll add the images simply to my project
Hey Blackjacx,
I am sorry that I made a mistake with my Swift test project's Podfile, your Navigator capture is right. But such mistake does not affect the image resources. I have also tested it with a new Objective-C project and everything worked well.
Do you have such thing in your target build phases:
Yes I have this. Hm strange. I can attach the project here. Maybe you'll find the mistake there. HUDTest.zip
Hey Blackjacx,
Since the pod is written in Objective-C while the HUDTest is a project of Swift, I add a bridging header and add only one line in the bridging header:
#import "CCActivityHUD.h"
There is no need to add import CCActivityHUD.h
in ViewController.swift
or modify any code in ViewController.swift
.
Everything works as expected.
For more details about adding bridging header, you can visit this Stackoverflow question.
I know about the bridging header. But in a purely Swift based project it is not necessary. Additionally I just import your POD as framework, that is build by Cocoapods. In such a case resources cannot be found as usual. We also have this problem in our app with the CoreData model file (and resources in general) that comes from the framework. We need to manually find that file using NSBundle methods. You need to do the same when you want that devs continue to install your lib via Cocopods.
So I re-download the HUDTest project and run it without any modification, the checkmark is shown as expected.
Even without pod install
?! For me the checkmark is not shown...
Yup. Just simply download, unzip and run, the checkmark is shown as expected. Also I tried pod install
, but since HUDTest had installed the pod, the command would not change anything.
Hmmm very strange. I have really no idea why that works for you :-(
Have you ever tried not to use use_frameworks!
, at least this also works for me.
Nope, because I want to use frameworks 😇 But I advise you to fix the framework case. Take it as experience ;-)
I habe a iOS 9 and Swift only project. I initialise the activity view directly in the property and show it as reaction on a button press. Thus the view has been loaded. But after everything completes the checkmark is not visible :-(
The tick/cross images are nil on initialization of the UIImage instance.
I use cocapods version 1.0.1. Maybe something changed there using images.