Build a simple Twitter client with two screens:
- Log In
- There should be fields to type in a username and a password
- Upon tapping a "Log In" button, the code should eventually call
TwitterClient.logIn(username:, password:)
with the provided credentials; i.e. there may be intermediate objects and/or method calls in between tapping the button and callinglogIn(username:, password:)
- Once
TwitterClient.isLoggedIn.value
goes totrue
, the app should show the Tweet Feed screen
- Tweet Feed
- Show a list of tweets (Provided by
TwitterClient.shared.loadTimeline
)- Cells should include a title with the posting user’s handle and the content of the tweet
- Navigation bar should have a "Log Out" button. On tapping this button:
TwitterClient.shared.isLoggedIn.value
should be set tofalse
- The Log In screen should be shown
- Show a list of tweets (Provided by
- If
TwitterClient.isLoggedIn.value
istrue
on app launch, the app should go straight to the Tweet Feed screen
- Any error handling for failed log in credentials. If the credentials entered are incorrect, nothing should happen and the log in screen should remain displayed
- Any UI tests
This class will help manage the logged in status, as well as the tweets to display.
Note that the isLoggedIn
property is a ReactiveKit reactive Property
.
In order to listen for changes to this value, we use code like:
isLoggedIn.observeNext { (isLoggedIn: Bool) -> Void in /* handle logged in status change */ }
Included in the project is a test file to ensure that TwitterClient
is acting the way we expect.
If the tests are failing, then we've broken the project and please let us know.
The tests are written in a particular style, and use the Quick
and Nimble
frameworks; you are not expected to write tests in that particular style, nor are you expected to use Quick
and Nimble
.
Use whatever comes natural to you.
This class is meant to help you in lieu of using an actual Twitter API that takes some time to set up.