Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [Alpha] Added iOS Support to Komoju Payment SDK #71

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AmniX
Copy link
Collaborator

@AmniX AmniX commented Nov 13, 2024

Summary

This PR introduces iOS support to the Komoju Payment SDK by leveraging the Kotlin Multiplatform Mobile (KMM) framework. Previously, the SDK was available only for Android. With this update, we are bringing a fully functional iOS implementation that allows developers to integrate Komoju Payments into iOS applications. The iOS functionality is encapsulated within two main projects:

  1. ios: A Swift wrapper framework that integrates the KMM shared SDK into iOS applications.
  2. example-ios: A sample iOS app named SoundBud! that demonstrates how to use the ios framework and the Komoju Payment SDK.

ios

Detailed Breakdown

1. ios Framework

The ios project is a wrapper framework written in Swift. This framework provides an iOS-specific interface for using the KMM-based Komoju Payment SDK. Here’s a breakdown of its functionality:

  • Swift Wrapper: The framework is written in Swift to enable smooth integration with iOS applications. It acts as a bridge, wrapping the KMM SDK and exposing the necessary functionality for iOS users.
  • Internal Usage of KMM SDK: The core logic of the Komoju Payment SDK, including UI components, business logic, and payment processing, is written in the KMM shared module. The Swift wrapper simply delegates to this shared KMM SDK and renders it within a native iOS interface.
  • SwiftUI Integration: The iOS framework uses SwiftUI to render the KMM-based SDK components within a native UIViewController. This ensures that iOS developers can easily embed the SDK into their apps using standard iOS UI components and patterns.
  • Platform-Specific Enhancements: Any iOS-specific code (e.g., UI customization or platform-specific behavior) is handled within this framework, ensuring the SDK works seamlessly on iOS devices.

2. example-ios App (SoundBud!)

The example-ios project is a sample iOS application that demonstrates the usage of the ios wrapper framework. SoundBud! showcases how the SDK can be integrated into a real-world iOS app. It includes:

  • SDK Integration: This app shows how to use the ios framework to initiate payment flows, present the UI, and interact with the Komoju Payment SDK.
  • End-to-End Flow: The SoundBud! app demonstrates the entire payment flow, including initiating a payment, processing it, and handling the response, making it a valuable reference for developers looking to implement the SDK in their own apps.
  • UI Example: It also provides a simple, visually clean example of how to integrate the SDK’s UI within an iOS app using SwiftUI.

Key Features

  • Cross-Platform Payment SDK: The Komoju Payment SDK is now available for both Android and iOS, thanks to the use of Kotlin Multiplatform Mobile (KMM). This allows the same shared business logic and UI components to be used across both platforms, reducing development effort and ensuring feature parity.
  • Native iOS Support: The iOS wrapper provides a native interface for using the SDK in Swift-based iOS apps, ensuring a seamless experience for iOS developers.
  • SwiftUI Compatibility: The framework supports SwiftUI for modern UI integration, making it easy for developers to embed the SDK's functionality into their apps with minimal effort.
  • End-to-End Example: The SoundBud! app serves as a comprehensive guide for integrating and using the SDK on iOS, showcasing best practices and how to handle real-world scenarios.

Changes in This PR

  • New ios framework: Introduces the iOS wrapper framework, providing Swift-based interfaces for the KMM SDK.
  • New example-ios app (SoundBud!): A fully functional example app demonstrating the SDK's usage on iOS.
  • iOS Payment Flow: Implements the iOS-specific UI and logic to initiate and process payments using the shared KMM SDK.
  • Integration with SwiftUI: Renders KMM SDK UI components in a UIViewController to fit seamlessly into SwiftUI-based applications.

Future Work

  • Fix Deep Links: Currently, deep links from other apps are not opening as expected. This issue needs to be addressed.
  • Set Up Redistribution: We need to configure the distribution of the iOS SDK via CocoaPods and Swift Package Manager (SPM).
  • Test on Real Devices: The SDK has only been tested in the iOS Simulator with a test environment. Testing on real devices is required.
  • Rename Framework: The current name of the framework is ios, which can be confusing. We plan to rename it to something more descriptive.

Testing

  • The functionality has been thoroughly tested on both iOS simulators only.
  • The example app (example-ios) demonstrates the SDK integration, and its flow can be tested on an iOS device to verify that the payment processing works as expected.

Conclusion

This PR brings full iOS support to the Komoju Payment SDK, enabling cross-platform payment solutions for both Android and iOS applications. By leveraging KMM, we provide a unified codebase that simplifies integration and ensures consistent behavior across platforms. The included Swift wrapper framework and the example app provide everything needed for iOS developers to integrate Komoju Payments seamlessly into their apps.

@AmniX AmniX self-assigned this Nov 13, 2024
@AmniX AmniX marked this pull request as draft November 13, 2024 01:24
@AmniX AmniX changed the title [WIP] ]Adding iOS Support to Komoju Payment SDK [WIP] [Alpha] Added iOS Support to Komoju Payment SDK Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant