Improve support for Swift language
See original GitHub issue- 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
- 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:
desired output:
Naming
doesn’t depend from other entitiesDescribing
doesn’t depend from other entitiesClassA
depends onNaming
,Describing
ClassB
depends onClassA
EnumA
depends onEnumB
EnumB
depends onDescribing
StructC
depends onNaming
,Describing
,EnumA
EmergeSwiftTest
depends onClassB
,EnumB
,EnumA
,ClassA
note:
String
andUUID
are ignored in this context as they should appear as dependency on theFoundation
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:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Andrea-Scuderi I’ve merged your PR #13, will try to follow up on an approach for point 2 in a couple of days.
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.