question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot access Antilog from swift.

See original GitHub issue

Usecase: We want to create subclass of the Antilog abstract class in swift.

The warning is the following:

Imported declaration 'CommonNapierNapierLevel' could not be mapped to 'NapierNapier.Level'
5:28
__attribute__((swift_name("NapierNapier.Level")))

Because of it we cannot use anything which relates to the Napier.Level enum from swift code, therefore the Antilog superclass is empty.

As a workaround we created a similar class like the CrashlyticsAntilog in the example but would be better a bit if the library would not produce a warning.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
stumi01commented, Sep 9, 2020

@AAkira Perfect, thank you.

2reactions
horita-yuyacommented, Sep 9, 2020

@AAkira @stumi01

Hi, I tried with the version.

import UIKit
import Common

final class SwiftAntilog: NapierAntilog {
    override func performLog(priority: NapierLogLevel, tag: String?, throwable: KotlinThrowable?, message: String?) {
        print("Swift: \(message ?? "")")
    }
}

final class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        NapierProxyKt.releaseBuild(antilog: SwiftAntilog())
        
        Sample().hello()
        
        DispatchQueue.global(qos: .background).async {
            // Without the below code, SwiftAntilog won't appear because Napier is ThreadLocal object.
//            NapierProxyKt.releaseBuild(antilog: SwiftAntilog())
            Sample().hello()
        }
    }
}

// Console
// Swift: Hello napier
// Swift: optional tag

Is this behavior you expect?

You can try this code with mpp-sample in Napier repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swift - Find antilog for 4 digit Integer in iOS - Stack Overflow
I need to find an antilog for 5995. I can get the actual antilog value when I am using anti logarithm book. but...
Read more >
Swift - Find antilog for 4 digit Integer in iOS | Edureka Community
I need to find an antilog for 5995. I can get the actual antilog value when I am using anti logarithm book. but...
Read more >
How do you find the antilog in a scientific calculator? - Quora
Antilog is basically a reverse function of Log. You can calculate it by pressing [Shift] key before pressing the log key. Same is...
Read more >
[Solved]-Trouble converting extension on Data to Swift 3.1 and ...
Coding example for the question Trouble converting extension on Data to Swift 3.1 and UnsafeRawPointer-swift.
Read more >
how do you take antilog on calculator Code Example - Code Grepper
Queries related to “how do you take antilog on calculator” ... you must use a personal access token with 'read_repository' · how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found