diff --git a/.swiftlint.yml b/.swiftlint.yml index 89efd09..4e5cbac 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -11,7 +11,6 @@ disabled_rules: - opening_brace opt_in_rules: # some rules are only opt-in - - anyobject_protocol - array_init - attributes - closure_body_length @@ -125,7 +124,7 @@ large_tuple: nesting: type_level: warning: 2 - statement_level: + function_level: warning: 10 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6661d0..ada40e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,61 +1,439 @@ -# Contributing Guidelines +# Contributing to Snacker -This document contains information and guidelines about contributing to this project. -Please read it before you start participating. +First off, thank you for considering contributing to Snacker! It's people like you that make Snacker such a great tool for the iOS community. -**Topics** +## Table of Contents -* [Reporting Issues](#reporting-issues) -* [Submitting Pull Requests](#submitting-pull-requests) -* [Developers Certificate of Origin](#developers-certificate-of-origin) * [Code of Conduct](#code-of-conduct) +* [Getting Started](#getting-started) +* [Development Setup](#development-setup) +* [Project Structure](#project-structure) +* [How Can I Contribute?](#how-can-i-contribute) +* [Reporting Bugs](#reporting-bugs) +* [Suggesting Features](#suggesting-features) +* [Improving Documentation](#improving-documentation) +* [Submitting Code](#submitting-code) +* [Development Workflow](#development-workflow) +* [Branching Strategy](#branching-strategy) +* [Commit Guidelines](#commit-guidelines) +* [Pull Request Process](#pull-request-process) +* [Coding Standards](#coding-standards) +* [Swift Style Guide](#swift-style-guide) +* [Code Quality](#code-quality) +* [Testing Requirements](#testing-requirements) +* [Community](#community) -## Reporting Issues +## Code of Conduct -A great way to contribute to the project is to send a detailed issue when you encounter a problem. We always appreciate a well-written, thorough bug report. +This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to nv3212@gmail.com. -Check that the project issues database doesn't already include that problem or suggestion before submitting an issue. If you find a match, feel free to vote for the issue by adding a reaction. Doing this helps prioritize the most common problems and requests. +## Getting Started -When reporting issues, please fill out our issue template. The information the template asks for will help us review and fix your issue faster. +### Development Setup -## Submitting Pull Requests +1. **Fork the repository** +```bash +# Click the "Fork" button on GitHub +``` -You can contribute by fixing bugs or adding new features. For larger code changes, we recommend first discussing your ideas on our [GitHub Discussions](https://github.com/space-code/snacker/discussions). When submitting a pull request, please add relevant tests and ensure your changes don't break any existing tests. +2. **Clone your fork** +```bash +git clone https://github.com/YOUR_USERNAME/snacker.git +cd snacker +``` -## Developer's Certificate of Origin 1.1 +3. **Set up the development environment** +```bash +# Bootstrap the project +make bootstrap +``` -By making a contribution to this project, I certify that: +4. **Create a feature branch** +```bash +git checkout -b feature/your-feature-name +``` -- (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or +5. **Open the project in Xcode** +```bash +open Package.swift +``` -- (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or +## How Can I Contribute? -- (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. +### Reporting Bugs -- (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. +Before creating a bug report, please check the [existing issues](#https://github.com/space-code/snacker/issues) to avoid duplicates. -## Code of Conduct +When creating a bug report, include: + +* **Clear title** - Describe the issue concisely +* **Reproduction steps** - Detailed steps to reproduce the bug +* **Expected behavior** - What you expected to happen +* **Actual behavior** - What actually happened +* **Environment** - OS, Xcode version, Swift version +* **Code samples** - Minimal reproducible example +* **Screenshots/Video** - Visual proof of UI glitches (highly recommended for Snacker) + +**Example:** + +```markdown +**Title:** Snackbar ignores safe area on iPhone 15 Pro + +**Steps to reproduce:** +1. Call Snacker.shared.action with `.bottom` alignment +2. Rotate device to landscape +3. Observe snackbar overlapping the home indicator + +**Expected:** Snackbar should respect safe area insets +**Actual:** Snackbar is clipped by the screen edge/home indicator + +**Environment:** +- iOS 17.0 +- Xcode 16.0 +- Swift 6.0 + +**Code:** +\`\`\`swift +Snacker.shared.action( + .snack(view: myView, data: .init(snackbarAlignment: .bottom(spacing: 0))), + container: window +) +\`\`\` +``` + +### Suggesting Features + +We love feature suggestions! When proposing a new feature, include: + +* **Problem statement** - What problem does this solve? +* **Proposed solution** - How should it work? +* **Alternatives** - What alternatives did you consider? +* **Use cases** - Real-world scenarios +* **API design** - Example code showing usage +* **Visuals** - Mockups or sketches if applicable + +**Example:** + +```markdown +**Feature:** Swipe to dismiss + +**Problem:** Users cannot manually dismiss a snackbar before the duration expires. + +**Solution:** Add gesture recognizer to the container view to allow swiping the snackbar away. + +**API:** +\`\`\`swift +let data = SnackbarData( + snackbarAlignment: .top, + interaction: .swipeToDismiss(direction: .up) // New parameter +) +\`\`\` + +**Use case:** Error messages that block content which the user has already read. +``` + +### Improving Documentation + +Documentation improvements are always welcome: + +* **Code comments** - Add/improve inline documentation +* **DocC documentation** - Enhance documentation articles +* **README** - Fix typos, add visual examples +* **Guides** - Write tutorials on creating custom views +* **API documentation** - Document public APIs + +### Submitting Code + +1. **Check existing work** - Look for related issues or PRs +2. **Discuss major changes** - Open an issue for large features +3. **Follow coding standards** - See [Coding Standards](#coding-standards) +4. **Write tests** - All code changes require tests (logic & UI snapshots if possible) +5. **Update documentation** - Keep docs in sync with code +6. **Create a pull request** - Use clear description + +## Development Workflow -The Code of Conduct governs how we behave in public or in private -whenever the project will be judged by our actions. -We expect it to be honored by everyone who contributes to this project. +### Branching Strategy -See [CODE_OF_CONDUCT.md](https://github.com/space-code/snacker/blob/master/CODE_OF_CONDUCT.md) for details. +We use a simplified branching model: + +* **`main`** - Main development branch (all PRs target this) +* **`feature/*`** - New features +* **`fix/*`** - Bug fixes +* **`docs/*`** - Documentation updates +* **`refactor/*`** - Code refactoring +* **`test/*`** - Test improvements + +**Branch naming examples:** + +```bash +feature/swipe-to-dismiss +fix/safe-area-calculation +docs/add-custom-view-example +refactor/animation-coordinator +test/add-queue-tests +``` + +### Commit Guidelines + +We use [Conventional Commits](https://www.conventionalcommits.org/) for clear, structured commit history. + +**Format:** + +``` +(): + + + +