Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carson-katri/reddit-swiftui
A cross-platform Reddit client built in SwiftUI
https://github.com/carson-katri/reddit-swiftui
ios macos reddit swiftui swiftui-example watchos
Last synced: 4 days ago
JSON representation
A cross-platform Reddit client built in SwiftUI
- Host: GitHub
- URL: https://github.com/carson-katri/reddit-swiftui
- Owner: carson-katri
- License: mit
- Created: 2019-07-29T01:48:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-19T05:26:54.000Z (about 2 years ago)
- Last Synced: 2024-11-21T22:35:24.560Z (21 days ago)
- Topics: ios, macos, reddit, swiftui, swiftui-example, watchos
- Language: Swift
- Homepage:
- Size: 911 KB
- Stars: 1,263
- Watchers: 23
- Forks: 88
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-swiftui - carson-katri/reddit-swiftui - A cross-platform Reddit client built in SwiftUI (Samples)
- awesome-starts - carson-katri/reddit-swiftui - A cross-platform Reddit client built in SwiftUI (Swift)
- fucking-open-source-ios-apps - reddit-swiftui - platform Reddit client (Misc / SwiftUI)
- awesome-apple-watch - Reddit in SwiftUI - A cross-platform Reddit client created in SwiftUI (Sample Apps / Blog)
README
A cross-platform Reddit client created in SwiftUI.
> *Note:* This project is far from complete. It still lacks many features of your typical Reddit client and has bugs (partly due to SwiftUI, but I'll take credit for some of them)
To show off SwiftUI's strength in cross-platform development, I did **not** use Mac Catalyst for this project. Instead, common UI code is shared between iOS, macOS, and watchOS.
## Project Structure
* `Shared` - Models, helpers, API, and any shared Views.
* `Reddit-[PLATFORM]` - Each target folder contains a `Views` and `Representable` folder. `Views` holds platform-specific views, and `Representable` contains `UIViewRepresentables` or `NSViewRepresentables`.## macOS Specific Features
I've added several things to make the macOS app stand out:
1. Double click - You can double click on a post to open a new window for the detail view.
2. `NSToolbar` - This is implemented entirely in the `AppDelegate`, and uses standard Cocoa code which interfaces with the SwiftUI views.
3. `TouchBar` - TODO## SF Symbols
Because macOS doesn't support SF Symbols, I have created the following extension to make sure shared code works. I would like to replace this with custom icons for macOS that it loads from `XCAssets` eventually:
```swift
/// `SwiftUI` compatibility
#if os(macOS)
extension Image {
init(systemName: String) {
self.init(nsImage: NSImage())
}
}
#endif
```