BinanceApi
BinanceApi copied to clipboard
'BinanceAllPricesRequest' initializer is inaccessible due to 'internal' protection level
Hello! I want to use BinanceApi for the macOS application.
I'll try the examples that are given in README.md, when I use the code from the example (I get the latest price for all symbols), I get an error when I initialize the class
let request = BinanceAllPricesRequest ()
Which version of Swift are you using?
I released this library when Swift 4.0 was the latest and greatest. Swift minor version increments are not source compatible with previous versions so I suspect there's an issue related to Swift 4.1 or 4.2
Fixed with 1.0.0! Please see if it works now on your end.
I should make a CI config for this but it's been a late night.
BinanceAllPricesRequest
defaults to the internal initializer, so it can not be called from another module. And in the unit tests it works, because it is simulated as a test @testable import BinanceApi
. Most likely with other structures the same problem. I think that on real projects this library was not tried even.
Like AlexeyGorbunov wrote, It ask for a designated init. However If I test with an empty init() then the compiler error goes away but then we get "'elements' is inaccessible due to 'internal' protection level". So this means a full init(...) for each struct. After some hours I found this reading material "https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html#ID21" - Next time I should read here first. Please Update it for 4.2 and xcode 9 or/and 10. Anyhow, thank you for your work.
BTW, I couldn't compile it using the shell with adding the github dpyro/binance-api in the garthage file. I did compile the two libraries by using the shell separately and the Binance-Api lib using xcode. Otherwise I did get a segment error and xcode crashes. Please also give us a working release setup, because I did get problems there too.