pendo-io / pendo-mobile-sdk

Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value
https://www.pendo.io
Other
58 stars 2 forks source link

Add deprecated annotations to deprecated functions in Swift SDK #135

Closed SwiftNativeDeveloper closed 4 months ago

SwiftNativeDeveloper commented 5 months ago

Platform + Version iOS

SDK Version 3.1.x or newer

Framework SwiftUI

Describe the bug Your documentation states that the pendoEnableSwiftUI function is deprecated, however I'm not seeing a warning in Xcode. I assume that an availability attribute was not applied to this function and that is why I'm not seeing warnings in Xcode using a deprecated function call.

Please use the availability attributes built into the Swift programming language to mark the function as deprecated. https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes/

To Reproduce

  1. Make use of the pendoEnableSwiftUI function on any view.
  2. Build with Xcode
  3. Observe no deprecation warning is emitted in the build logs

Expected behavior Methods that are deprecated in documentation should also be deprecated in source code so Xcode can produce build warnings for deprecated API usage. https://github.com/pendo-io/pendo-mobile-sdk/blob/master/api-documentation/native-ios-apis.md#viewpendoenableswiftui

Logs N/A

Sample Code This code does not produce an Xcode warning as expected based on the documentation.

import Pendo
import SwiftUI

struct PendoDummyView: View {
    var body: some View {
        Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
            .pendoEnableSwiftUI()
    }
}

#Preview {
    PendoDummyView()
}

Additional context All other functions or features in the SDK that are deprecated should also state that via code techniques.

MikePendo commented 5 months ago

@SwiftNativeDeveloper

If using SDK below 3.1 the pendoEnableSwiftUI() modifier must be applied OR Deprecated from SDK 3.1. The SDK automatically performs the logic, removing the need to use this API. Calling it will be ignored. ~~otherwise its redundant and will be deprecated in the future. The reason why we didnt put warning YET coz its not deprecated for all SDK versions and should not produce warning yet.~~

SwiftNativeDeveloper commented 5 months ago

I'm a little confused about 'not deprecated for all SDK versions'. The attribute, in code, wouldn't retroactively apply to earlier versions of the SDK. Adding the attribute to newer code would only affect new code pulled from artifactory. At least that is my understanding of what is going on under the covers of the binary framework swift package.

MikePendo commented 5 months ago

You are right I think I confused it with something else we will do it in the next version

0xkuj commented 4 months ago

fixed in 3.2.1