|
| 1 | +# Contributing to IosIAP |
| 2 | + |
| 3 | +Thank you for your interest in contributing! We love your input and appreciate your efforts to make IosIAP better. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. Fork the repository |
| 8 | +2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
| 9 | +3. Make your changes |
| 10 | +4. Run tests (`swift test`) |
| 11 | +5. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 12 | +6. Push to your branch (`git push origin feature/amazing-feature`) |
| 13 | +7. Open a Pull Request |
| 14 | + |
| 15 | +## Development Setup |
| 16 | + |
| 17 | +```bash |
| 18 | +# Clone your fork |
| 19 | +git clone https://github.com/YOUR_USERNAME/ios-iap.git |
| 20 | +cd ios-iap |
| 21 | + |
| 22 | +# Open in Xcode |
| 23 | +open Package.swift |
| 24 | + |
| 25 | +# Run tests |
| 26 | +swift test |
| 27 | +``` |
| 28 | + |
| 29 | +## Code Style |
| 30 | + |
| 31 | +- Follow Swift API Design Guidelines |
| 32 | +- Use meaningful variable and function names |
| 33 | +- Keep functions small and focused |
| 34 | +- Add comments only when necessary |
| 35 | + |
| 36 | +### Naming Conventions |
| 37 | + |
| 38 | +- **Acronyms**: Use Pascal case when at beginning/middle (`IapModule`, `IosIapTests`) |
| 39 | +- **Acronyms as suffix**: Use all caps (`ProductIAP`, `ManagerIOS`) |
| 40 | +- See [CLAUDE.md](CLAUDE.md) for detailed naming rules |
| 41 | + |
| 42 | +## Testing |
| 43 | + |
| 44 | +All new features must include tests: |
| 45 | + |
| 46 | +```swift |
| 47 | +func testYourFeature() async throws { |
| 48 | + // Arrange |
| 49 | + let module = IapModule.shared |
| 50 | + |
| 51 | + // Act |
| 52 | + let result = try await module.yourMethod() |
| 53 | + |
| 54 | + // Assert |
| 55 | + XCTAssertEqual(result, expectedValue) |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +## Pull Request Guidelines |
| 60 | + |
| 61 | +### ✅ Do |
| 62 | + |
| 63 | +- Write clear PR titles and descriptions |
| 64 | +- Include tests for new features |
| 65 | +- Update documentation if needed |
| 66 | +- Keep changes focused and small |
| 67 | + |
| 68 | +### ❌ Don't |
| 69 | + |
| 70 | +- Mix unrelated changes in one PR |
| 71 | +- Break existing tests |
| 72 | +- Change code style without discussion |
| 73 | +- Include commented-out code |
| 74 | + |
| 75 | +## Commit Messages |
| 76 | + |
| 77 | +Keep them clear and concise: |
| 78 | + |
| 79 | +- `Add purchase error recovery` |
| 80 | +- `Fix subscription status check` |
| 81 | +- `Update StoreKit 2 integration` |
| 82 | +- `Refactor transaction handling` |
| 83 | + |
| 84 | +## Release Process (Maintainers Only) |
| 85 | + |
| 86 | +When your PR is merged, maintainers will handle the release: |
| 87 | + |
| 88 | +1. **Version Update**: We use semantic versioning (major.minor.patch) |
| 89 | + ```bash |
| 90 | + ./scripts/bump-version.sh patch # for bug fixes |
| 91 | + ./scripts/bump-version.sh minor # for new features |
| 92 | + ./scripts/bump-version.sh major # for breaking changes |
| 93 | + ``` |
| 94 | + |
| 95 | +2. **Automatic Deployment**: Creating a GitHub release triggers: |
| 96 | + - Swift Package Manager update (immediate) |
| 97 | + - CocoaPods deployment (via `pod trunk push`) |
| 98 | + |
| 99 | +3. **Availability**: |
| 100 | + - Swift Package: Available immediately after release |
| 101 | + - CocoaPods: Available within ~10 minutes via `pod update` |
| 102 | + |
| 103 | +Contributors don't need to worry about deployment - just focus on making great contributions! |
| 104 | + |
| 105 | +## Questions? |
| 106 | + |
| 107 | +Feel free to: |
| 108 | +- Open an issue for bugs or features |
| 109 | +- Start a discussion for questions |
| 110 | +- Tag @hyodotdev for urgent matters |
| 111 | + |
| 112 | +## License |
| 113 | + |
| 114 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
0 commit comments