Search code examples
swift3datasourcebemsimplelinegraph

Cannot override method_name which has been marked unavailable in BEMSimpleLineGraph


I have been using BEMSimpleLineGraph for my project which was initially build for swift 2.3, now I was migrating it to swift 3 so after updating the the library to version 4.1 it gives me the following error that it can't override the methods as they are not available but upon removing the methods it says

'ViewController' does not conform to protocol 'BEMSimpleLineGraphDataSource'

enter image description here


Solution

  • I got the same problem using the same library. Problem appears to be due to the bridge between OBJ-C and Swift mistaking a deprecated function for the one you're trying to target. I solved it by commenting out code:

    1) BEMSimpleLineGraph.h: comment out all the depricated function declarations, it's about 80 lines of code following the

    //----- DEPRECATED -----//
    

    2) BEMSimpleLineGraph.m: comment out each time this line appears:

    #pragma clang diagnostic ignored
    

    so for instance I removed 7 pairs of lines that looked similar to this:

    #pragma clang diagnostic ignored "-Wdeprecated-declarations"
                    dotValue = [self.delegate valueForIndex:i];