• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    Swift
  • License
    GNU General Publi...
  • Created about 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

FINN's iOS UI Components

Carthage compatible

FinniversKit holds all the UI elements of the FINN iOS app, the main reference for our components is our design system. This framework is composed of small components that are meant to be used as building blocks of the FINN iOS app.

In order to develop our components in an isolated way, we have structured them so they can be used independently of each other. Run the Demo project for a list of all our components.

Installation

CocoaPods

Add to your Podfile:

pod "FinniversKit", git: "https://github.com/finn-no/FinniversKit"

Swift Package Manager

You can also add FinniversKit using SPM.

Carthage

github "finn-no/FinniversKit" "master"

Usage

Import the framework to access all the components.

import FinniversKit

Create new releases

Setup

  • Install dependencies listed in Gemfile with bundle install (dependencies will be installed in ./bundler)
  • Fastlane will use the GitHub API, so make sure to create a personal access token here and place it within an environment variable called FINNIVERSKIT_GITHUB_ACCESS_TOKEN.
    • When creating a token, you only need to give access to the scope repo.
    • There are multiple ways to make an environment variable, for example by using a .env file or adding the following line to .zshrc/.bashrc/.bash_profile):
      export FINNIVERSKIT_GITHUB_ACCESS_TOKEN="[Your access token]"
      Don't forget to run source .env (for whichever file you set the environment variables in) if you don't want to restart your shell.
    • Run bundle exec fastlane verify_environment_variable to see if it is configured correctly.
  • Run bundle exec fastlane verify_ssh_to_github to see if ssh to GitHub is working.

Make release

  • Run bundle exec fastlane and choose appropriate lane. Follow instructions, you will be asked for confirmation before all remote changes.
  • After the release has been created you can edit the description on GitHub by using the printed link.

Interesting things

Folder structure (sources, resources, demo and tests)

  • Sources folder contains Swift and Objective C files, grouped by relevant category/feature if needed
  • Assets folder contains fonts, images, sounds, generated constants and other resources used in the framework
  • UnitTests folder is used for snapshot tests and other files related to testing
  • Demo folder is a place for files that belong to Demo target. It is good practice to have corresponding demo view for every component, fullscreen or recycling view.

Delegates and data sources (instead blocks and injection)

In order to maintain consistency we have opted for using data sources for giving data to our recyclable views and using delegates to interact for actions inside views.

If the view isn't recyclable then we use ViewModels. There are tradeoffs when you choose to be consistent instead of pragmatic but we hope that by having a clear pattern it reduces the discussion points and let's us focus on improving the UI and adding value to our users.

Why not playgrounds?

Our Demo project has been setup in a way that every component is isolated, we initially started by using Xcode's playgrounds but we quickly outgrew it's capacity, reloading times weren't quicker than making the change and running the project again, also it wasn't possible to debug and set breakpoint on things and we couldn't use many of Xcode's useful utilities such as View hierarchy inspector. Finally, the fact that we had to rebuild the project after making any change in the framework meant that we weren't as efficient as using plain Xcode projects (where rebuilding isn't necessary after making a change).

Changelogs

This project has a Gemfile that specify some development dependencies, one of those is pr_changelog which is a tool that helps you to generate changelogs from the Git history of the repo. You install this by running bundle install.

To get the changes that have not been released yet just run:

$ pr_changelog

If you want to see what changes were released in the last version, run:

$ pr_changelog --last-release

You can always run the command with the --help flag when needed.

Accessibility

Everything we do we aim it to be accessible, our two main areas of focus have been VoiceOver and Dynamic Type.

Snapshot Testing

When making UI changes it's quite common that we would request an screenshot of the before and after, adding Snapshot testing made this trivial, if there was UI changes you would get a failure when building through the CI.

FinniversKit uses SnapshotTesting to compare the contents of a UIView against a reference image.

When you run the tests FinniversKit will take snapshot of all the components and will look for differences. If a difference is caught you'll be informed in the form of a failed test. Running the tests locally will generate a diff between the old and the new images so you can see what caused the test to fail.

Testing a new component

To test a new component go to UnitTests and add a new func with the name of your component under the section that makes sense, for example if your component is a Fullscreen component and it's called RegisterView then you'll need to add a method to FullscreenViewTests.swift your method should look like this:

func testRegisterView() {
    snapshot(.registerView)
}

Note that the snapshot method is a helper method that will call SnapshotTesting under the hood.

Snapshot failures on Circle CI

There can be instances where the snapshot test pass on your machine but don't on circle ci, when that happens, circle CI will fail and inform the presence of the test results in a .xctestresult file. To debug this, re-run the workflow with ssh access, then you will get a command to connect through ssh to circle ci, like:

ssh -p PORT IP

Then given the path of the results file circle ci reported, you can run the following command to copy it to your machine, so you will be able to inspect the failed snapshots

scp -v -r -P PORT -i PATH_TO_SSH_KEY distiller@IP:"/Users/distiller/Library/Developer/Xcode/DerivedData/FinniversKit-fblxjfyrnvejgxdktracnzlelvsi/Logs/Test/Run-Demo-2019.10.03_00-14-16--0700.xcresult" .

Make sure to replace the file path correctly to the one that circle ci reported.

Verifying changes for an existing component

If you make changes to any components you'll have to run the test for that component after changing recordMode to true. Doing this will generate a new reference image that will be used later to verify for changes that affect your component. After you've generated the reference image change recordMode back to false.

License

FinniversKit is available under the GNU General Public License v3.0. See the LICENSE file for more info.

The FINN.no branding, icons, images, assets, sounds and others are solely reserved for usage within FINN.no, the main purpose of this library is for internal use and to be used as reference for other teams in how we do things inside FINN.no.

More Repositories

1

BottomSheet

Custom modal presentation style for thumb-friendly interactive views
Swift
367
star
2

charcoal-ios

A modern way to filter things in your iOS apps
Swift
118
star
3

xss-html-filter

Open Sourced HTML filtering utility for Java. Used to parse user-submitted input and sanitize it against potential cross site scripting attacks, malicious html, or simply badly formed html.
Java
117
star
4

android_emulator_hacks

We run android espresso instrumentation tests on bamboo. This worked extremely randomly due to a few issues that we've tried to solve with this app.
Java
69
star
5

Finjinon

Custom iOS camera optimized for taking a sequence of photos quickly and/or selecting from an image picker
Swift
58
star
6

recsys_slates_dataset

FINN.no Slate Dataset for Recommender Systems. A dataset containing all interactions (viewed items + response (clicked item / no click) for users over a longer time horizon.
Python
52
star
7

grafana-dashboards

Shell
48
star
8

maven-dependency-mapper

Maven reverse dependency tree
Java
28
star
9

Diffuse

Diffuse is library that aims to simplify the diffing of two collections
Swift
23
star
10

maven-deploy

A simple NodeJS module to create a war/jar package and install to a local Maven repository or deploy to a remote one
JavaScript
20
star
11

lambda-companion

Java
19
star
12

capturandro

Image capture handling in Android made easy
Java
15
star
13

Paw

A library to represent object details
Swift
14
star
14

carousel-js

Our general purpose carousel widget which can be used for multiple use-cases.
JavaScript
13
star
15

terraform-provider-softlayer

This is a provider for Terraform that lets you provision infrastructure on SoftLayer.
Go
12
star
16

cross-domain-events

Event-like api for postMessage to send objects between cross-domain frames
JavaScript
12
star
17

stash-client

Simple Ruby client for the Atlassian Stash REST API
Ruby
11
star
18

tech.finn.no

Our technology blog
HTML
10
star
19

retriable-kafka-consumer

Retriable consumer pool for kafka
Java
10
star
20

cassandra-hadoop

Provides Hadoop-0.21+ integration into Cassandra. Stems from Dave Brosius work in CASSANDRA-5201
Java
9
star
21

finn-rest-api-php-demo-client

PHP sample code for clients getting started with the FINN REST API
8
star
22

node-docker

Shell
7
star
23

cookie-police

Cookie Police protects document.cookie for you ๐Ÿ‘ฎ
JavaScript
6
star
24

finnui-ios

FINN.no UI for iOS app
Swift
6
star
25

keras-conv-sentence-classifier

Keras Implementation of "Convolutional Neural Networks for Sentence Classification"
Python
6
star
26

rxactivityresponse

A library for using rx + onActivityResponse/onRequestPermissionsResult on android. For example for using rx and permissions/gplay settings/google login etc.
Java
6
star
27

finnflow

FINN's internally used additions to square's flow pattern.
Java
5
star
28

apps-handbook

Your welcome guide to the Apps team at FINN
5
star
29

query-params

Very simple CommonJS-module to encode/decode query parameters
JavaScript
5
star
30

eventlistener

Super-simple wrapper around addEventListener and attachEvent (old IE). Does not handle differences in the Event-objects.
JavaScript
5
star
31

simplehub

Simple event hub
JavaScript
4
star
32

maven_pom

Tiny Ruby library to work with Maven's pom.xml files.
Ruby
4
star
33

unleash-client-haskell

An Unleash client SDK for Haskell
Haskell
4
star
34

cdn-uploader

Small tool uploading assets to CDN backend (Google Cloud Storage)
JavaScript
4
star
35

finn-no.github.com

Our page on GitHub
HTML
4
star
36

migrate-npm-registry

Helper script to migrate all packages from one npm registry to another
JavaScript
3
star
37

puppet-confluent

Puppet module for setting up confluent.io kafka/zookeeper/restservice/schemaregistry
Puppet
3
star
38

guava-metrics

Java
3
star
39

solr-integrationtest-support

Integration testing with Solr made easy
Java
3
star
40

define-options

Micro lib to define valid properties for an options litteral, and return a function that can validate the options.
JavaScript
3
star
41

prometheus-haproxy-log-exporter

Fork of http://git.cbaines.net/prometheus-haproxy-log-exporter/
Python
3
star
42

geocluster

Java
2
star
43

lifestyle

node.js client for FINN REST API
JavaScript
2
star
44

redux-actions

Write actions and reducers for Redux with less boilerplate
JavaScript
2
star
45

json-manifest

Create a JSON manifest of static asset files having hash in their filenames
JavaScript
2
star
46

Yammer-Java-SDK

Simple java http client to work with Yammer's REST APIs.
Java
2
star
47

eslint-config-finn

ESLint config for Finn.no
JavaScript
2
star
48

ios-handbook

Handbook on how to build excellent iOS apps at FINN
2
star
49

tiles-mustache-example

Tiles / mustache example web application [DEPRECATED]
Java
2
star
50

DemoKit-iOS

Swift
2
star
51

js-code-style

FINN.no's config files and a CLI to check JavaScript code style
JavaScript
1
star
52

maven-repo-worker

Simple app to make working with maven repositories easy
Ruby
1
star
53

finnsect

Node.js app for API monitoring and profiling
CSS
1
star
54

openjdk8bond

Shell
1
star
55

Notifications-Maven-Plugin

Send notifications from maven
Java
1
star
56

js-date-formatter

JavaScript
1
star
57

confboard

Webapp to compare *.{ini,properties} files
JavaScript
1
star
58

zendesk-tools

Tools for FINNs ZenDesks
Ruby
1
star
59

node-brakes-prometheus

JavaScript
1
star
60

gardr-finn-js

JavaScript
1
star
61

tomcat9-docker

Shell
1
star
62

Docker-and-Microservices

This is a presentation on Docker held at FINN Architecture Summit - Service Orientation on 2015.01.21.
CSS
1
star
63

norwegian-input-validator

Simple input validator with norwegian formats and error messages
JavaScript
1
star
64

gardr-plugin-ext-burt

A Garรฐr plugin for Burt
JavaScript
1
star
65

FINN-styl-e

Work in progress stylus script/watcher/compiler for FINN.no
JavaScript
1
star
66

Docker-on-Academy

This is a presentation on Docker held at FINN Academy 2014.05.28.
CSS
1
star
67

gardr-plugin-host-burt

Burt plugin for Garรฐr - host side
JavaScript
1
star
68

JSONCodable

Type-safe Codable wrapper for all basic JSON types
Swift
1
star
69

Frontend-Testing-Redefined-on-Academy

This a presentation about frontend testing redefined held at FINN Academy 2017.05.24
JavaScript
1
star
70

object-proxy-js

Wrap a proxy object around any object for method invocation hooks [DEPRECATED]
JavaScript
1
star
71

commons-reflection

Reflection utilities. Provides faster implementations of classes found in java.lang.reflect. (Openjdk request for inclusion: https://bugs.openjdk.java.net/show_bug.cgi?id=100120 )
Java
1
star