How grishka/neardrop works
Main Components
• Main Application (NearDrop folder): This is the core macOS app. It includes the AppDelegate, UI components (such as MainMenu.xib), and assets (in Assets.xcassets). It is responsible for general app behavior (menu bar integration, file saving, localization, etc.).
• NearbyShare Module (NearbyShare folder): This module holds the underlying connection logic and protobuf message handling. It includes code for inbound/outbound nearby connections, a connection manager, and scripts/generation for protobuf – essential for communication with Android devices.
• Share Extension (ShareExtension folder): This component integrates with the macOS sharing interface (the “Share” menu in Finder, Safari, etc.). It contains its own assets, localized strings, and a user interface (via xib files) for choosing a device and initiating file transfers.
• Protocol & Documentation: The PROTOCOL.md file and embedded protobuf definitions/documentation (both Swift generated and proto source files) indicate how devices communicate using wire formats.
Out Relationships and Interactions
• User Interactions:
• The user interacts with the NearDrop menu bar app (which may include casual notifications or quick activation).
• When a user shares a file (right-click in Finder or via Safari), the ShareExtension is invoked, and it communicates with the main application backend.
• Communication Flow:
• The ShareExtension sends the file/share request to the core logic – likely by invoking functions in the NearbyShare module.
• The NearbyShare module handles the network logic, using Wi-Fi LAN (as stated in the README) to establish peer connections to Android devices. This module also processes the protobuf messages that adhere to the defined protocols.
• The connection status, successful transfers, and notifications are passed back to the main app which ultimately manages user feedback and saving files to the Downloads folder.
Architectural Patterns and Technologies
• Separation of Concerns: Notice the distinction between UI components (Main app and ShareExtension) and the underlying network/connection logic contained within the NearbyShare module.
• Modular Design: The project is divided into clear modules (main app, share extension, and network communication module), making it easier to see boundaries and responsibilities.
• Use of Protobuf for Message Serialization: The presence of both generated Swift protobuf files and their corresponding proto source files indicates a message-based protocol for secure communication.
• Localization: Multiple language-specific resource directories indicate that the UI components support internationalization.