From 6ca078c043104c0828b1613ec5d5262cc24abbc7 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Tue, 16 May 2023 16:18:30 +0200 Subject: [PATCH 1/6] Swift documentation --- develop-docs/README.md | 4 ++++ develop-docs/Swift-Usage.md | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 develop-docs/Swift-Usage.md diff --git a/develop-docs/README.md b/develop-docs/README.md index 3f9477773d1..0eb393b943a 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -2,6 +2,10 @@ This page contains internal documentation for development. +## Coding with Swift + +To use Swift in the project take a look at [Swift Usage](/Swift-Usage.md) documentation. + ## Code Signing This repository follows the [codesiging.guide](https://codesigning.guide/) in combination with [fastlane match](https://docs.fastlane.tools/actions/match/). diff --git a/develop-docs/Swift-Usage.md b/develop-docs/Swift-Usage.md new file mode 100644 index 00000000000..ac12c6d43ad --- /dev/null +++ b/develop-docs/Swift-Usage.md @@ -0,0 +1,23 @@ +# Swift Usage + +Starting from version 8.0, it is now possible to include Swift code in the project. All Swift files should be placed under the `/Sources/Swift` directory. + +> In this document, `SentryPrivate` refers to the library written in Swift, while `Sentry` represents the framework written in Objective-C. The term "SentryPrivate public API" refers to the API that will be consumed by `Sentry` and is not intended for direct use by users. + +When working with Swift, it's important to keep the following restrictions in mind: + +1. All Swift code will be bundled within the `SentryPrivate` library, which `Sentry` depends on. +2. User-facing APIs cannot be written in Swift because their components will be accessed through imports from "SentryPrivate." +3. `SentryPrivate` does not have access to `Sentry` classes to avoid cyclic references. As a result, any code written in Objective-C is not accessible from Swift. + - However, it is possible to create Dependency Injection (DI) APIs in Swift, allowing `Sentry` to inject its objects for use within "SentryPrivate." +4. `SentryPrivate` public APIs (code consumed by `Sentry`) cannot utilize certain Objective-C incompatible features, including: + - Generics + - Non-@objc protocols and protocol extensions + - Top-level functions and properties + - Global variables + - Structs + - Swift-only enums + - Swift-only optionals + - Swift-only tuples + +By keeping these considerations in mind, you can effectively work with Swift code within the project, ensuring compatibility with the `Sentry` framework and adhering to the necessary restrictions imposed by the language differences. From e08f48216f79521a665bcf7e4e1f77768ed23567 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Tue, 16 May 2023 16:20:30 +0200 Subject: [PATCH 2/6] Update README.md --- develop-docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop-docs/README.md b/develop-docs/README.md index 0eb393b943a..ee0fac525bc 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -4,7 +4,7 @@ This page contains internal documentation for development. ## Coding with Swift -To use Swift in the project take a look at [Swift Usage](/Swift-Usage.md) documentation. +To use Swift in the project take a look at [Swift Usage](Swift-Usage.md) documentation. ## Code Signing From 2fdb8817bd8f3c8193df5da5d8029c1e4724a6b1 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Tue, 16 May 2023 16:22:00 +0200 Subject: [PATCH 3/6] Update Swift-Usage.md --- develop-docs/Swift-Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop-docs/Swift-Usage.md b/develop-docs/Swift-Usage.md index ac12c6d43ad..3884d2266bb 100644 --- a/develop-docs/Swift-Usage.md +++ b/develop-docs/Swift-Usage.md @@ -2,7 +2,7 @@ Starting from version 8.0, it is now possible to include Swift code in the project. All Swift files should be placed under the `/Sources/Swift` directory. -> In this document, `SentryPrivate` refers to the library written in Swift, while `Sentry` represents the framework written in Objective-C. The term "SentryPrivate public API" refers to the API that will be consumed by `Sentry` and is not intended for direct use by users. +> In this document, `SentryPrivate` refers to the library written in Swift, while `Sentry` represents the framework written in Objective-C. The term `SentryPrivate` public API refers to the API that will be consumed by `Sentry` and is not intended for direct use by users. When working with Swift, it's important to keep the following restrictions in mind: From fc7db3a3bf291502034da80937b144f446ec3065 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Tue, 16 May 2023 16:25:44 +0200 Subject: [PATCH 4/6] Update Swift-Usage.md --- develop-docs/Swift-Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop-docs/Swift-Usage.md b/develop-docs/Swift-Usage.md index 3884d2266bb..3eeded6f12f 100644 --- a/develop-docs/Swift-Usage.md +++ b/develop-docs/Swift-Usage.md @@ -8,7 +8,7 @@ When working with Swift, it's important to keep the following restrictions in mi 1. All Swift code will be bundled within the `SentryPrivate` library, which `Sentry` depends on. 2. User-facing APIs cannot be written in Swift because their components will be accessed through imports from "SentryPrivate." -3. `SentryPrivate` does not have access to `Sentry` classes to avoid cyclic references. As a result, any code written in Objective-C is not accessible from Swift. +3. `SentryPrivate` does not have access to `Sentry` classes to avoid cyclic references. As a result, any code written in Objective-C is not accessible from the Swift layer. - However, it is possible to create Dependency Injection (DI) APIs in Swift, allowing `Sentry` to inject its objects for use within "SentryPrivate." 4. `SentryPrivate` public APIs (code consumed by `Sentry`) cannot utilize certain Objective-C incompatible features, including: - Generics From 6c1b865bc1d725ea864e639b752f39caa4c7e133 Mon Sep 17 00:00:00 2001 From: Dhiogo Ramos Brustolin Date: Tue, 16 May 2023 16:26:40 +0200 Subject: [PATCH 5/6] Update Swift-Usage.md --- develop-docs/Swift-Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop-docs/Swift-Usage.md b/develop-docs/Swift-Usage.md index 3eeded6f12f..d3659623daa 100644 --- a/develop-docs/Swift-Usage.md +++ b/develop-docs/Swift-Usage.md @@ -9,7 +9,7 @@ When working with Swift, it's important to keep the following restrictions in mi 1. All Swift code will be bundled within the `SentryPrivate` library, which `Sentry` depends on. 2. User-facing APIs cannot be written in Swift because their components will be accessed through imports from "SentryPrivate." 3. `SentryPrivate` does not have access to `Sentry` classes to avoid cyclic references. As a result, any code written in Objective-C is not accessible from the Swift layer. - - However, it is possible to create Dependency Injection (DI) APIs in Swift, allowing `Sentry` to inject its objects for use within "SentryPrivate." + - However, it is possible to create Dependency Injection (DI) APIs in Swift, allowing `Sentry` to inject its objects for use within `SentryPrivate`. 4. `SentryPrivate` public APIs (code consumed by `Sentry`) cannot utilize certain Objective-C incompatible features, including: - Generics - Non-@objc protocols and protocol extensions From 478b2890c5b86fda370082620f4e678bf1a901d6 Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Wed, 17 May 2023 16:53:47 +0200 Subject: [PATCH 6/6] Update develop-docs/Swift-Usage.md Co-authored-by: Philipp Hofmann --- develop-docs/Swift-Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop-docs/Swift-Usage.md b/develop-docs/Swift-Usage.md index d3659623daa..aaa24aaec02 100644 --- a/develop-docs/Swift-Usage.md +++ b/develop-docs/Swift-Usage.md @@ -1,6 +1,6 @@ # Swift Usage -Starting from version 8.0, it is now possible to include Swift code in the project. All Swift files should be placed under the `/Sources/Swift` directory. +Starting from version 8.0.0, it is now possible to include Swift code in the project. All Swift files should be placed under the `/Sources/Swift` directory. > In this document, `SentryPrivate` refers to the library written in Swift, while `Sentry` represents the framework written in Objective-C. The term `SentryPrivate` public API refers to the API that will be consumed by `Sentry` and is not intended for direct use by users.