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.

Improve support for Swift language

See original GitHub issue
  1. Some Swift language entities and properties are missing
  • Swift entities are the following: class, struct, protocol, enum

  • Swift properties can be: var, let

  • Missing implementation: protocol, enum, let

  1. Swift Entities dependencies are not evaluated when used as static

example:

class A {
 static let shared = A()
 
 func doSomething() {
  print("A")
 }
}

class B {
 func doSomethingWithA() {
  A.shared.doSomething()
 }
}

The class B depends from A, but the relation is not implemented in the output.

Proposed output

Consider the following valid swift example:

protocol Naming {
    var name: String { get set }
}

protocol Describing {
    var describing: String { get }
}

class ClassA: Naming & Describing {
    
    static let shared = ClassA()
    
    var name: String = "A"
    let id: UUID = UUID()
    var describing: String = "Class A"
}

class ClassB: ClassA {
    func show() {
        print(name)
    }
}

enum EnumA {
    case one
    case two(EnumB)
}

enum EnumB: String, Describing {
    case one
    case two
    
    var describing: String {
        self.rawValue
    }
}

struct StructC<T: Naming>: Describing {
    var name: String = "C"
    let state: EnumA = .one
    var generic: T
    
    var describing: String = "Class C"
    
    init(generic: T) {
        self.generic = generic
    }
}

public struct EmergeSwiftTest {
    public private(set) var text = "Hello, World!"

    var b = ClassB()
    let eB: EnumB = .one
    let eA = EnumA.two(.one)
    
    func show() {
        b.show()
        print(ClassA.shared.name)
    }
}

actual output:

Screenshot 2022-01-15 at 19 53 15

desired output:

  • Naming doesn’t depend from other entities
  • Describing doesn’t depend from other entities
  • ClassA depends on Naming, Describing
  • ClassB depends on ClassA
  • EnumA depends on EnumB
  • EnumB depends on Describing
  • StructC depends on Naming, Describing, EnumA
  • EmergeSwiftTest depends on ClassB, EnumB, EnumA, ClassA

note:

  • String and UUID are ignored in this context as they should appear as dependency on the Foundation framework

I’ve prepared a version solving the point 1. Happy to do a PR if you are interested. Not sure how to sort out point 2 though.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
glatocommented, Jan 17, 2022

@Andrea-Scuderi I’ve merged your PR #13, will try to follow up on an approach for point 2 in a couple of days.

1reaction
glatocommented, Jan 16, 2022

Hi @Andrea-Scuderi 👋, thank you for the interesting ideas and enhancements, I’d appreciate any contribution and help. If you’ve already prepared a PR to solve point 1, I’d be happy to review/test/merge your solution. I’ll try to come up with an approach for point 2 in the following days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swift - Apple Developer
Swift is a powerful and intuitive programming language for iOS, iPadOS, macOS, tvOS, and watchOS. ... To best support international languages and emoji, ......
Read more >
Programming in Swift: Benefits of This Popular Coding ...
There many advantages to programming in Swift, ... Consider these top features to help you with the Swift programming language.
Read more >
Pros and Cons of Swift Programming Language | AltexSoft
It holds such improvements as better concurrency support using async/await mechanisms and actors. Actors are a reference type similar to classes ...
Read more >
Best Way to Learn Swift - Hackr.io
If you know Swift, you can quickly develop apps, using built-in intuitive tools. Swift is open-source and has excellent community support.
Read more >
Swift Language Support in SDK 7.7.0
Swift is also a continuously improving technology with all new language and compiler level optimizations being introduced by Apple.
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