GithubHelp home page GithubHelp logo

swift-api-client's People

Contributors

dmfs avatar edhoru avatar mpashnyov avatar vinczebalazs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mpashnyov

swift-api-client's Issues

Crash when subscription returns an error instead of data parsable to JSONSubscription

When trying to subscribe to that calendar there is a crash caused by the sdk not being able to Decode the JSON response. The crash log on Xcode is:

Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(PageKeys(stringValue: "subscriptionId", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key PageKeys(stringValue: "subscriptionId", intValue: nil) ("subscriptionId").", underlyingError: nil)): file /Users/edhoru/Documents/GitHub/ios-public-calendars-sdk/Pods/SchedJoulesApiClient/ApiClient/Source/Subscriptions/Queries/SubscriptionStatusQuery.swift, line 48
2019-07-19 05:32:30.716145-0500 iOS-SDK[1634:627354] Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(PageKeys(stringValue: "subscriptionId", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key PageKeys(stringValue: "subscriptionId", intValue: nil) ("subscriptionId").", underlyingError: nil)): file /Users/edhoru/Documents/GitHub/ios-public-calendars-sdk/Pods/SchedJoulesApiClient/ApiClient/Source/Subscriptions/Queries/SubscriptionStatusQuery.swift, line 48

Represent Country and Language with same model

Both the Country and Language models have the same fields except for icon. Because icon is an optional anyways, it would make more sense to have a uniform Locale class represent both Country and Language.

make non-final classes final

During my last review I accidentally let a few non-final classes slip through. They should be fixed to be final.

Explore WWDC 2021

Things of interest so far:

  • App Events
  • Widgets
  • Swift Package Manager

Add option to load the weather calendar from the api

The weather calendar doesn't follow the same logic as the other calendars, since the it uses the units defined in the client end, we have to add the method so clients don't make the request directly to our backend.

Make all classes immutable

Immutability is a desirable property for every type. In order for a class to be immutable it has to be final.
Make sure there are non non-final classes and no public fields or properties which can be modified.

Change Pages directory structure

The Protocols directory inside Pages should be moved inside the Models directory as those are protocols corresponding to the Page models.

Return concrete type in settings queries

Swift does not support using protocols directly, so we have to return a concrete type as the query Result to be able to use it in the generic settings view controller.

Review language settings

We got a review on schedjoules app that says: Why is the app not available in German? You can set it, but is it still English? Functions, buttons etc

Please check

Reduce duplicate code in Queries.

The current Query implementations contain a lot of duplicated code. In particular almost all their properties have the same values and their handleResult methods are all the same.

The design should be improved by introducing an abstract DelegatingQuery which delegates all properties and the handleResult to a delegate passed to the ctor.
In addition introduce a PageQuery which only takes the parameters and an optional path suffix which is then used to simplify all the existing page implementations.

Proposed usage of DelegatingQuery and PageQuery is like so:

public final class NextPageQuery: DelegatingQuery {

   public convenience init(numberOfItems: Int) {
       super.init(queryItems: [URLQueryItem(name: "next", value: String(numberOfItems))])
   }

   /// Initialize with the number of items to return, locale
   public convenience init(numberOfItems: Int, locale: String) {
       super.init(queryItems: [URLQueryItem(name: "next", value: String(numberOfItems)),
                              URLQueryItem(name: "locale", value: locale)])   
}

Also see https://medium.com/design-patterns-in-swift/design-patterns-in-swift-decorator-pattern-2026e7112869 for more info on this topic.

Add empty public initializer to queries

Queries which have all their properties pre-defined do not require an init method. However, to be able to initialize them in another module, an empty public initializer must be declared explicitly. This signals to the compiler that the class was meant to be used as public.

Query to fetch calendar data

In order to show a calendar preview, as a partner I need a Query to fetch calendar data.

The Query should return high level event objects.

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.