RxSwift.resourceCount not accessable

Created on 1 Jan 2016  路  24Comments  路  Source: ReactiveX/RxSwift

if TRACE_RESOURCES

private let startResourceCount = RxSwift.resourceCount

endif

Says,
Module 'RxSwift' has no member named 'resourceCount'

Most helpful comment

Hey guys you can also add post install to pod file

post_install do |installer|
   installer.pods_project.targets.each do |target|
      if target.name == 'RxSwift'
         target.build_configurations.each do |config|
            if config.name == 'Debug'
               config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES']
            end
         end
      end
   end
end

All 24 comments

Please take a look on #301

Hi @sergdort I set the OtherSwift Compiler Flags same as you did, still I have same issue, Please see the below SS

2016-01-03_1318

Hi @kbala did you make a post POD install hook ?

use_frameworks!

pod 'RxSwift'

post_install do |installer|
   installer.pods_project.targets.each do |target|
      if target.name == 'RxSwift'
         target.build_configurations.each do |config|
            if config.name == 'Debug'
               config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES']
            end
         end
      end
   end
end

I use Carthage build version: github "ReactiveX/RxSwift" ~> 2.0 . And I cann't access RxSwift. resourceCount too.

image

image

Here is screen shot from RxExample, looks like it should be -D TRACE_RESOURCES

screen shot 2016-01-04 at 11 40 43 am

It seems not working for me.

And it off course should be in the framework build settings. I'm not sure is it possible to do some configurations with Carthage, like with Cocoapods

screen shot 2016-01-04 at 12 38 12 pm

You can't access resourceCount with Carthage because, as far as I'm aware of, Carthage only uses release version of the binaries, and you can't specify addition compilation flags.

Once any version of RxSwift libraries is compiled without TRACE_RESOURCES Swift flag, the code that traces resources is simply not compiled inside the library.

If Carthage supported specifying additional Swift flags during compilation, that would be possible, but I'm not sure it currently supports that or is there some other way to solve that using Carthage.

@kzaher Yes, Carthage seems can not change build setting.
@sergdort I can not set the build setting of RxSwift framework.

You can use carthage build --configuration Debug.

yes, I run carthage build --configuration Debug

I can access the resourceCount now, and it works :+1:

Thnx @ikesyo :)

And thnx @sergdort , helping with issues helps a lot :+1:

carthage build --platform iOS --configuration Release-Tests
work too

You can also quickly enable RxSwift.resourceCount by adding the TRACE_RESOURCES flag to the RxSwift target, e.g., in the Pods project, Build settings > Other Swift flags > Debug:

screenshot 2016-06-05 17 11 08

You'll just need to remember to re-enable it every time you do a pod update--which, maybe, isn't such a bad thing 馃槈

Just remembering that right now, the resource count is getted from:
RxSwift.Resources.total.

Hey guys you can also add post install to pod file

post_install do |installer|
   installer.pods_project.targets.each do |target|
      if target.name == 'RxSwift'
         target.build_configurations.each do |config|
            if config.name == 'Debug'
               config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['-D', 'TRACE_RESOURCES']
            end
         end
      end
   end
end

Let's add this to next release :)

Oh,

@sergdort I've thought we can add this to podspec also and not podfile. My bad.

follow to @kzaher in #1277, i can enable debugging with Carthage by using script:

carthage update --no-use-binaries --configuration Debug RxSwift

I'm having this issue as well even though I am not using Carthage. I added RxSwift to the project with Cocoapods and tried to access RxSwift.Resources.totalCount but after adding the post install script to the podfile I get a dyld: Symbol not found exception on the line RxSwift.Resources.totalCount
What is the correct way to access the total count?

Is there any way to access RxSwift.Resources.totalCount if RxSwift is added via Swift Package Manager?

Is there any way to access RxSwift.Resources.totalCount if RxSwift is added via Swift Package Manager?

cc @kzaher

@freak4pc @kzaher Sorry) Any updates about Swift package?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmial picture dmial  路  3Comments

tyregor picture tyregor  路  3Comments

marlowcharite picture marlowcharite  路  3Comments

acecilia picture acecilia  路  3Comments

apoloa picture apoloa  路  3Comments