GithubHelp home page GithubHelp logo

carson-katri / reddit-swiftui Goto Github PK

View Code? Open in Web Editor NEW
1.3K 24.0 86.0 933 KB

A cross-platform Reddit client built in SwiftUI

License: MIT License

Swift 100.00%
swiftui swiftui-example reddit ios macos watchos

reddit-swiftui's Introduction

A cross-platform Reddit client created in SwiftUI.

Get the Public Beta

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:

/// `SwiftUI` compatibility
#if os(macOS)
extension Image {
    init(systemName: String) {
        self.init(nsImage: NSImage())
    }
}
#endif

reddit-swiftui's People

Contributors

banaslee avatar carson-katri avatar pqhf5kd avatar sirarkimedes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reddit-swiftui's Issues

No releases?

You should build the app and upload the .app to the Releases tab :)

TestFlight

I'd be interested in testing this out through TestFlight. An email invite ([email protected]) would be wonderful, and/or you could generate a public TestFlight link and put it on the repository.

Unable To Build

Unable to build the project due to WatchKit.

This app could not be installed at this time.
Domain: IXUserPresentableErrorDomain
Code: 1
Failure Reason: Could not install at this time.
Recovery Suggestion: Watch-only apps cannot be contained in companion apps installed on the companion.
--
Watch-only apps cannot be contained in companion apps installed on the companion.
Domain: MIInstallerErrorDomain
Code: 135
User Info: {
    FunctionName = "-[MIInstallableBundle _validateCompanionAppStateInWatchKitApp:withVersion:error:]";
    LegacyErrorString = WatchOnlyAppOnCompanion;
    SourceFileLine = 611;
}
--


System Information

macOS Version 10.15.6 (Build 19G46c)
Xcode 12.0 (17175.2)

Blue Selection trigged when List (Blur) Selection expected

NavigationLink and List selection state seem to be overlapping.

There are two ways this happens:

    • select a post
    • see the post now has a grey selected background
    • tap section header
    • see the selected post now has a blue selected background
    • all consecutive selections will have a blue background as well
  1. Click on the edge of the list item (outside the text or images)

Perhaps make the click area fill the space so that clicking on the edge won't cause a selection.

Pagination

Any plan to add pagination to the post list?

Use SFSymbols on macOS Big Sur

Hi

So that extension on NSImage on macOS makes a blank image and has a placeholder input string to maybe do something with in the future or...?

Thanks in advance.

Xcode Build Fail - MacOS

I get this error:

Showing Recent Issues
No account for team "FH9CW55WY5". (Add a new account in the Accounts preference pane or verify that your accounts have valid credentials.)

PostList Content Cut Short

I believe this is when all posts are text-only posts, the right side of the content in the PostList is cut off (roughly the same amount as if a thumbnail would be there). On both iOS and macOS

image

image

[macOS] Clicking on the post list text, the NavigationLink isn't triggered

What happens:
When clicking on any of the text, or elements, that are in the List on macOS, the NavigationLink destination isn't triggered.

An example:
When clicking on the text that is enclosed within the red box,
macOS
The PostDetailView destination does not get triggered.
The only way to trigger the PostDetailView is to click outside of the Text elements.

Additional details:
Removing the .onTapGesture(count: 2) from macOS' PostView will allow the clicks to be passed through again. Though, this obviously removes the double click to open a new window functionality.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.