Skip to content

Commit

Permalink
Initial commit of challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Olmedo committed Feb 2, 2021
0 parents commit 354a71b
Show file tree
Hide file tree
Showing 27 changed files with 1,284 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# idealista iOS Challenge
idealista iOS crew needs you! We need a fellow to face our everyday challenges: new features, problem fixes, UI design, performance, security, backwards compatibility, testing...
This repository contains a project ready to work with, but we need your help to build the next amazing features that will bring it to the next level, are you ready to go?

We love clean code and beautiful layouts, structured implementation and testable components. Does it sound good to you? This is your challenge!

## Getting started
This repository contains a working iOS app that retrieves a list of ads

<p align="center">
<img src="./list.png">
</p>

The app used UIKit and xibs for render the views and have no dependencies with any library

## Tasks

Your task is to **clone** this repository and take into consideration next steps

###### New features to add

1. Create a detail view and navigate to it from ads list.
The detail URL is in the response of the ad list
2. Add a new feature to favourite ads

###### Some optional tasks to do (bonus):

1. Add pull to refresh to the listing
2. Localize the app in english
3. Add some test
4. Refactor the initial code
5. Visual improvements

###### Once you've finished

1. Notify by email to [email protected] which branch of your repo you want our iOS team analyze or send us the project folder (including the .git)
2. Have a beer after the work done
630 changes: 630 additions & 0 deletions iOSCodeChallenge.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>iOSCodeChallenge.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>iOSCodeChallenge.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
11 changes: 11 additions & 0 deletions iOSCodeChallenge/API Client/DTOs/IDResultDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class IDResultDTO: Codable
{
let propertyCode: String?
let thumbnail: String?
let price: Int?
let propertyType: String?
let operation: String?
let multimedia: IDResultMultimediaDTO?
let detailUrl: String?

}
4 changes: 4 additions & 0 deletions iOSCodeChallenge/API Client/DTOs/IDResultMultimediaDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct IDResultMultimediaDTO: Codable
{
let images: [IDResultMultimediaImageDTO]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct IDResultMultimediaImageDTO: Codable
{
let url: String?
}
4 changes: 4 additions & 0 deletions iOSCodeChallenge/API Client/DTOs/IDResultsDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct IDResultsDTO: Codable
{
let elementList: [IDResultDTO]
}
25 changes: 25 additions & 0 deletions iOSCodeChallenge/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate
{
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
window = UIWindow(frame: UIScreen.main.bounds)

let rootNavigation = UINavigationController(rootViewController: IDResultListTableViewController())
rootNavigation.navigationBar.prefersLargeTitles = true

rootNavigation.navigationBar.barTintColor = .white
window?.rootViewController = rootNavigation
window?.makeKeyAndVisible()

UINavigationBar.appearance().barTintColor = UIColor(red: 225.0/255.0, green: 245.0/255.0, blue: 110.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor(red: 182.0/255.0, green: 38.0/255.0, blue: 130.0/255.0, alpha: 1.0)

return true
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
98 changes: 98 additions & 0 deletions iOSCodeChallenge/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions iOSCodeChallenge/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
25 changes: 25 additions & 0 deletions iOSCodeChallenge/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
45 changes: 45 additions & 0 deletions iOSCodeChallenge/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
66 changes: 66 additions & 0 deletions iOSCodeChallenge/List/IDResultListTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import UIKit

class IDResultListTableViewCell: UITableViewCell
{
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var photo: UIImageView!

override func awakeFromNib()
{
super.awakeFromNib()

backgroundColor = .white
selectionStyle = .none
separatorInset = .zero
}

func fill(withResult result: IDResultDTO)
{
titleLabel.text = title(forResult: result)
subtitleLabel.text = String(format: "%@ €", String(result.price ?? 0))

if let multimedia = result.multimedia, let firstImageURL = multimedia.images.first?.url {
URLSession.shared.dataTask(with: URL(string: firstImageURL)!) {
(data, response, error) in

guard let data = data, error == nil, let image = UIImage(data: data) else {
return
}

DispatchQueue.main.sync {
self.photo.image = image
}
}.resume()
}
}

private func title(forResult result: IDResultDTO) -> String
{
guard let operation = result.operation, let typology = result.propertyType else { return "" }

switch (operation, typology) {
case ("sale", "flat"):
return "Piso en venta"
case ("rent", "flat"):
return "Piso en alquiler"
case ("sale", "penthouse"):
return "Ático en venta"
case ("rent", "penthouse"):
return "Ático en alquiler"
case ("sale", "studio"):
return "Estudio en venta"
case ("rent", "studio"):
return "Estudio en alquiler"
case ("sale", "chalet"):
return "Chalet en venta"
case ("rent", "chalet"):
return "Chalet en alquiler"
case ("sale", "duplex"):
return "Dúplex en venta"
case ("rent", "duplex"):
return "Dúplex en alquiler"
default: return ""
}
}
}
Loading

0 comments on commit 354a71b

Please sign in to comment.