فهرست منبع

Merge branch 'BaseProject' into Home

Iñigo Valentin 9 سال پیش
والد
کامیت
08ff8c43f7
63فایلهای تغییر یافته به همراه6865 افزوده شده و 190 حذف شده
  1. 43 0
      README.es-ES.md
  2. 43 0
      README.es-EU.md
  3. 33 14
      README.md
  4. 5 4
      Section.xib
  5. 138 18
      app.xcodeproj/project.pbxproj
  6. 254 0
      app/ActivitiesView.swift
  7. 60 0
      app/ActivitiesView.xib
  8. 172 0
      app/AlbumViewController.swift
  9. 3 0
      app/AppDelegate.swift
  10. 6 0
      app/Assets.xcassets/Misc/Contents.json
  11. 23 0
      app/Assets.xcassets/Misc/Pinpoint.imageset/Contents.json
  12. BIN
      app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint-1.png
  13. BIN
      app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint-2.png
  14. BIN
      app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint.png
  15. 23 0
      app/Assets.xcassets/Misc/PinpointGM.imageset/Contents.json
  16. BIN
      app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm-1.png
  17. BIN
      app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm-2.png
  18. BIN
      app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm.png
  19. 23 0
      app/Assets.xcassets/Misc/ScheduleBullet.imageset/Contents.json
  20. BIN
      app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point-1.png
  21. BIN
      app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point-2.png
  22. BIN
      app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point.png
  23. 23 0
      app/Assets.xcassets/Misc/ScheduleLine.imageset/Contents.json
  24. BIN
      app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline-1.png
  25. BIN
      app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline-2.png
  26. BIN
      app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline.png
  27. 730 14
      app/Base.lproj/Main.storyboard
  28. 177 0
      app/BlogView.swift
  29. 64 0
      app/BlogView.xib
  30. 187 0
      app/GalleryView.swift
  31. 63 0
      app/GalleryView.xib
  32. 89 23
      app/HomeView.swift
  33. 18 18
      app/HomeView.xib
  34. 2 2
      app/Info.plist
  35. 210 0
      app/LablancaView.swift
  36. 407 0
      app/LablancaView.xib
  37. 158 0
      app/PostViewController.swift
  38. 130 0
      app/RowAlbum.swift
  39. 81 0
      app/RowAlbum.xib
  40. 130 0
      app/RowBlog.swift
  41. 113 0
      app/RowBlog.xib
  42. 197 0
      app/RowFutureActivity.swift
  43. 135 0
      app/RowFutureActivity.xib
  44. 132 0
      app/RowGallery.swift
  45. 152 0
      app/RowGallery.xib
  46. 2 0
      app/RowHomeBlog.swift
  47. 102 0
      app/RowHomeGallery.swift
  48. 112 0
      app/RowHomeGallery.xib
  49. 83 0
      app/RowLabel.swift
  50. 79 0
      app/RowLabel.xib
  51. 89 0
      app/RowLablancaDay.swift
  52. 102 0
      app/RowLablancaDay.xib
  53. 121 0
      app/RowPastActivity.swift
  54. 103 0
      app/RowPastActivity.xib
  55. 154 0
      app/RowSchedule.swift
  56. 139 0
      app/RowSchedule.xib
  57. 189 0
      app/ScheduleViewController.swift
  58. 1268 76
      app/Sync.swift
  59. 42 0
      app/UIApplcation.swift
  60. 66 6
      app/UIImageView.swift
  61. 16 0
      app/UIView.swift
  62. 159 10
      app/ViewController.swift
  63. 15 5
      app/app.xcdatamodeld/app.xcdatamodel/contents

+ 43 - 0
README.es-ES.md

@@ -0,0 +1,43 @@
+---
+[Informazioa euskaraz](README.es-EU.md) 
+[Information in english](README.md)
+---
+
+
+# Androizko Gasteizko Margolariak aplikazioia #
+
+Una aplicacion para iOS para miembros de [Gasteizko Margolariak](https://margolariak.com/) [Vitoria-Gasteiz](http://www.vitoria-gasteiz.org/).
+
+### Durante las Fiestas ###
+
+Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
+
+* [NO IMPLEMENTADO] Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
+* [NO IMPLEMENTADO] Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
+* [NO IMPLEMENTADO] ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
+
+
+### Durante el resto del año ###
+
+* [PARCIALMENTE IMPLEMENTADO] Mantente informado de las actividades que organizamos durante el resto del año.
+* [PARCIALMENTE IMPLEMENTADO] Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
+* [PARCIALMENTE IMPLEMENTADO] Galería de fotos de todas nuestras actividades.
+
+
+### Compatibilidad ###
+
+iOS 9.1 o superior.
+
+
+### Idiomas ###
+
+* [IMPLEMENTADO] Castellano
+* [NO IMPLEMENTADO] Inglés
+* [NO IMPLEMENTADO] Euskera 
+
+
+### Otros dispositivos ###
+
+* ¿Android? [Lo tenemos!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakApp) 
+* ¿Prefieres el sitio web? [No problem!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakWeb)
+

+ 43 - 0
README.es-EU.md

@@ -0,0 +1,43 @@
+---
+[Informacion en castellano](README.es-ES.md) 
+[Information in english](README.md)
+---
+
+
+# Androizko Gasteizko Margolariak aplikazioia #
+
+Una aplicacion para iOS para miembros de [Gasteizko Margolariak](https://margolariak.com/) [Vitoria-Gasteiz](http://www.vitoria-gasteiz.org/).
+
+### Durante las Fiestas ###
+
+Hay funciones diseñadas especificamente para las Fiestas de La Blanca, y solo estarán disponibles en esas fechas.
+
+* [NO IMPLEMENTADO] Consulta en tu teléfono el Programa de Fiestas, encuentra actos alrededor tuyo ydescubre como llegar hasta ellos.
+* [NO IMPLEMENTADO] Consulta el Programa de Fiestas de Gasteizko Margolariak, detallado y con la ubicación de cada actividad...
+* [NO IMPLEMENTADO] ... pero, como no somos famosos por nuestra puntualidad, comprueba nuestra ubicación en tiempo real.
+
+
+### Durante el resto del año ###
+
+* [PARCIALMENTE IMPLEMENTADO] Mantente informado de las actividades que organizamos durante el resto del año.
+* [PARCIALMENTE IMPLEMENTADO] Recibe las ultimas noticias sobre la Cuadrilla en nuestro Blog
+* [PARCIALMENTE IMPLEMENTADO] Galería de fotos de todas nuestras actividades.
+
+
+### Compatibilidad ###
+
+iOS 9.1 o superior.
+
+
+### Idiomas ###
+
+* [IMPLEMENTADO] Castellano
+* [NO IMPLEMENTADO] Inglés
+* [NO IMPLEMENTADO] Euskera 
+
+
+### Otros dispositivos ###
+
+* ¿Android? [Lo tenemos!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakApp) 
+* ¿Prefieres el sitio web? [No problem!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakWeb)
+

+ 33 - 14
README.md

@@ -1,26 +1,45 @@
+---
+[Información en castellano](README.es-ES.md) 
+[Informazioa euskaraz](README.es-EU.md)
+---
 
 
-Gasteizko Margolariak iOS App
-===
 
 
-An iOS app intended for members of <a href="http://margolariak.com/">Gasteizko Margolariak</a> in <a href="http://www.vitoria-gasteiz.org/">Vitoria-Gasteiz</a>, Spain.
+# Gasteizko Margolariak Android App #
 
 
-### Status ###
+An iOS app intended for members of [Gasteizko Margolariak](https://margolariak.com/) in [Vitoria-Gasteiz](http://www.vitoria-gasteiz.org/), Spain.
 
 
-In a few words: nothing works. Yet.
+### Features during the city festivals ###
 
 
+This features will be only available during the city festivals.
 
 
-### Upcaming features during the city festivals ###
+* [TODO] Check out the festival schedule, discover events all around the city, and get their location.
+* [TODO] Check out the schedule for the members of Gasteizko Margolariak, indicating the location of every event and activity...
+* [TODO] ... but, since we are not known for our puntuality, check out the location of Gasteizko Margolariak in real time.
+* [TODO] Approximate distance to important event around the city.
 
 
-This features wil be only available during the city festivals.
 
 
-* Check out the festival schedule, showing events all around the city, and indicating their location.
-* Check out the schedule for the members of Gasteizko Margolariak, indicating the location of every event and activity...
-* ... but, since we are not known for our puntuality, check out the location of Gasteizko Margolariak in real time.
+### Features for the rest of the year ###
 
 
+* [PARTIALLY IMPLEMENTED] Check out and be notified of all activities organized by Gasteizko Margolariak.
+* [MOSTLY IMPLEMENTED] Stay updated witho our blog.
+* [MOSTLY IMPLEMENTED] Check out our photo gallery.
 
 
-### Upcaming features for the rest of the year ###
 
 
-* Check out and be notified of all activities organized by Gasteizko Margolariak.
-* View nd comment our blog.
-* View and comment our gallery.
+### Compatibility ###
+
+iOS 9.1 or higher.
+
+
+### Languages ###
+
+* [AVAILABLE] Spanish
+* [TODO] English
+* [TODO] Basque
+
+
+### On other devices ###
+
+* Got Android? [Got you covered!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakApp) 
+* Do you prefer web pages? [No problem!](https://github.com/GasteizkoMargolariak/GasteizkoMargolariakWeb)
+
 
 

+ 5 - 4
Section.xib

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
@@ -21,11 +21,11 @@
             <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
             <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
             <subviews>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="e7S-aL-6Ed" userLabel="Section">
+                <view contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="e7S-aL-6Ed" userLabel="Section">
                     <rect key="frame" x="10" y="10" width="355" height="647"/>
                     <rect key="frame" x="10" y="10" width="355" height="647"/>
                     <subviews>
                     <subviews>
-                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Titulo" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="mYX-eR-Wot">
-                            <rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
+                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Titulo" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="mYX-eR-Wot">
+                            <rect key="frame" x="0.0" y="0.0" width="355" height="27"/>
                             <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
                             <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
@@ -39,6 +39,7 @@
                     <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                     <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                     <constraints>
                     <constraints>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="bottom" secondItem="hhU-TV-XGc" secondAttribute="top" id="0JC-9a-fRi" userLabel="Section_Title.bottom=Content.top"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="bottom" secondItem="hhU-TV-XGc" secondAttribute="top" id="0JC-9a-fRi" userLabel="Section_Title.bottom=Content.top"/>
+                        <constraint firstItem="mYX-eR-Wot" firstAttribute="width" secondItem="e7S-aL-6Ed" secondAttribute="width" id="0xY-43-c4D"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="trailing" secondItem="hhU-TV-XGc" secondAttribute="trailing" id="4VF-IP-46O" userLabel="Section_Title.trailing=Content.trailing"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="trailing" secondItem="hhU-TV-XGc" secondAttribute="trailing" id="4VF-IP-46O" userLabel="Section_Title.trailing=Content.trailing"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="leading" secondItem="hhU-TV-XGc" secondAttribute="leading" id="5pZ-0J-Mc4"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="leading" secondItem="hhU-TV-XGc" secondAttribute="leading" id="5pZ-0J-Mc4"/>
                         <constraint firstItem="hhU-TV-XGc" firstAttribute="top" secondItem="e7S-aL-6Ed" secondAttribute="top" constant="27" id="GaL-O1-uum"/>
                         <constraint firstItem="hhU-TV-XGc" firstAttribute="top" secondItem="e7S-aL-6Ed" secondAttribute="top" constant="27" id="GaL-O1-uum"/>

+ 138 - 18
app.xcodeproj/project.pbxproj

@@ -7,14 +7,32 @@
 	objects = {
 	objects = {
 
 
 /* Begin PBXBuildFile section */
 /* Begin PBXBuildFile section */
+		93075C6A1E59CAB000396389 /* BlogView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93075C691E59CAB000396389 /* BlogView.xib */; };
+		93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93075C6B1E59CB6B00396389 /* BlogView.swift */; };
+		93075C701E59D04A00396389 /* RowBlog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93075C6F1E59D04A00396389 /* RowBlog.swift */; };
+		93075C721E59D06900396389 /* RowBlog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93075C711E59D06900396389 /* RowBlog.xib */; };
 		931AA5891E1AFF8C003A2290 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931AA5881E1AFF8C003A2290 /* String.swift */; };
 		931AA5891E1AFF8C003A2290 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931AA5881E1AFF8C003A2290 /* String.swift */; };
 		931AA58B1E1DA911003A2290 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 931AA58A1E1DA910003A2290 /* CoreData.framework */; };
 		931AA58B1E1DA911003A2290 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 931AA58A1E1DA910003A2290 /* CoreData.framework */; };
 		931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AD1E218D0D003A2290 /* Entry.xib */; };
 		931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AD1E218D0D003A2290 /* Entry.xib */; };
 		931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */; };
 		931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */ = {isa = PBXBuildFile; fileRef = 931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */; };
+		9326C4F41EA51C39007DF2A4 /* RowLablancaDay.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */; };
+		9326C4F61EA5279D007DF2A4 /* RowLablancaDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */; };
 		93294FF81E336FA000FDAF50 /* Entry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF71E336FA000FDAF50 /* Entry.swift */; };
 		93294FF81E336FA000FDAF50 /* Entry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF71E336FA000FDAF50 /* Entry.swift */; };
 		93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */; };
 		93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */; };
 		935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935892CF1E493C2300E1CD5F /* UIImageView.swift */; };
 		935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935892CF1E493C2300E1CD5F /* UIImageView.swift */; };
+		935D6E2D1E8678B700CED3A1 /* GalleryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 935D6E2C1E8678B700CED3A1 /* GalleryView.xib */; };
+		935D6E2F1E86792000CED3A1 /* GalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935D6E2E1E86792000CED3A1 /* GalleryView.swift */; };
+		935D6E311E867C5E00CED3A1 /* RowGallery.xib in Resources */ = {isa = PBXBuildFile; fileRef = 935D6E301E867C5E00CED3A1 /* RowGallery.xib */; };
+		935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935D6E321E867C7E00CED3A1 /* RowGallery.swift */; };
+		936966ED1E98445200A11055 /* AlbumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936966EC1E98445200A11055 /* AlbumViewController.swift */; };
+		936966EF1E9848D600A11055 /* RowAlbum.xib in Resources */ = {isa = PBXBuildFile; fileRef = 936966EE1E9848D600A11055 /* RowAlbum.xib */; };
+		936966F11E984B5000A11055 /* RowAlbum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936966F01E984B5000A11055 /* RowAlbum.swift */; };
+		937EA02D1E5B8B5300D0893A /* UIApplcation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 937EA02C1E5B8B5300D0893A /* UIApplcation.swift */; };
+		938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 938D211C1EA2275300C47EC3 /* LablancaView.xib */; };
+		938D211F1EA2306300C47EC3 /* LablancaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938D211E1EA2306300C47EC3 /* LablancaView.swift */; };
 		93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */; };
 		93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */; };
+		93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */; };
+		93B5C01C1E872B600069BFF8 /* RowHomeGallery.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */; };
 		93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B991D9C31AB006C0F67 /* AppDelegate.swift */; };
 		93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B991D9C31AB006C0F67 /* AppDelegate.swift */; };
 		93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B9B1D9C31AB006C0F67 /* ViewController.swift */; };
 		93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93B84B9B1D9C31AB006C0F67 /* ViewController.swift */; };
 		93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93B84B9D1D9C31AB006C0F67 /* Main.storyboard */; };
 		93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93B84B9D1D9C31AB006C0F67 /* Main.storyboard */; };
@@ -27,6 +45,7 @@
 		93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */; };
 		93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */; };
 		93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F51E586310009DF853 /* RowHomeSocial.xib */; };
 		93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93BAD2F51E586310009DF853 /* RowHomeSocial.xib */; };
 		93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F71E586741009DF853 /* RowHomeSocial.swift */; };
 		93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BAD2F71E586741009DF853 /* RowHomeSocial.swift */; };
+		93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BEB6D11E7E878300C68DE5 /* PostViewController.swift */; };
 		93D9EA601DE271E700089002 /* Section.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA5F1DE271E700089002 /* Section.xib */; };
 		93D9EA601DE271E700089002 /* Section.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA5F1DE271E700089002 /* Section.xib */; };
 		93D9EA641DE273FD00089002 /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA631DE273FD00089002 /* Section.swift */; };
 		93D9EA641DE273FD00089002 /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA631DE273FD00089002 /* Section.swift */; };
 		93D9EA681DE342AC00089002 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA671DE342AC00089002 /* UIView.swift */; };
 		93D9EA681DE342AC00089002 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA671DE342AC00089002 /* UIView.swift */; };
@@ -34,17 +53,46 @@
 		93D9EA6C1DE3498500089002 /* HomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA6B1DE3498500089002 /* HomeView.xib */; };
 		93D9EA6C1DE3498500089002 /* HomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93D9EA6B1DE3498500089002 /* HomeView.xib */; };
 		93D9EA711DE37C7900089002 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 93D9EA701DE37C7900089002 /* libsqlite3.tbd */; };
 		93D9EA711DE37C7900089002 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 93D9EA701DE37C7900089002 /* libsqlite3.tbd */; };
 		93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA751DE3ACBB00089002 /* Sync.swift */; };
 		93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93D9EA751DE3ACBB00089002 /* Sync.swift */; };
+		93E0C5E21EB7E7F000905811 /* ActivitiesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5E11EB7E7F000905811 /* ActivitiesView.xib */; };
+		93E0C5E41EB7E94300905811 /* ActivitiesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5E31EB7E94300905811 /* ActivitiesView.swift */; };
+		93E0C5E61EBDEF2B00905811 /* RowFutureActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5E51EBDEF2B00905811 /* RowFutureActivity.swift */; };
+		93E0C5E81EBDF0E700905811 /* RowFutureActivity.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5E71EBDF0E700905811 /* RowFutureActivity.xib */; };
+		93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5E91EBDFFB300905811 /* RowPastActivity.swift */; };
+		93E0C5EC1EBE001000905811 /* RowPastActivity.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5EB1EBE000F00905811 /* RowPastActivity.xib */; };
+		93E0C5EE1EBE25BD00905811 /* RowLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5ED1EBE25BC00905811 /* RowLabel.swift */; };
+		93E0C5F21EBE264F00905811 /* RowLabel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93E0C5F11EBE264F00905811 /* RowLabel.xib */; };
+		93E0C5F41EBE306900905811 /* ScheduleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E0C5F31EBE306900905811 /* ScheduleViewController.swift */; };
+		93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */; };
+		93EB2F0E1EBF5BF500F64186 /* RowSchedule.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */; };
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
 
 
 /* Begin PBXFileReference section */
 /* Begin PBXFileReference section */
+		93075C691E59CAB000396389 /* BlogView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BlogView.xib; sourceTree = "<group>"; };
+		93075C6B1E59CB6B00396389 /* BlogView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlogView.swift; sourceTree = "<group>"; };
+		93075C6F1E59D04A00396389 /* RowBlog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowBlog.swift; sourceTree = "<group>"; };
+		93075C711E59D06900396389 /* RowBlog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowBlog.xib; sourceTree = "<group>"; };
 		931AA5881E1AFF8C003A2290 /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
 		931AA5881E1AFF8C003A2290 /* String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
 		931AA58A1E1DA910003A2290 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 		931AA58A1E1DA910003A2290 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 		931AA5AD1E218D0D003A2290 /* Entry.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Entry.xib; sourceTree = "<group>"; };
 		931AA5AD1E218D0D003A2290 /* Entry.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Entry.xib; sourceTree = "<group>"; };
 		931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomePastActivities.xib; sourceTree = "<group>"; };
 		931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomePastActivities.xib; sourceTree = "<group>"; };
+		9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowLablancaDay.xib; sourceTree = "<group>"; };
+		9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowLablancaDay.swift; sourceTree = "<group>"; };
 		93294FF71E336FA000FDAF50 /* Entry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entry.swift; sourceTree = "<group>"; };
 		93294FF71E336FA000FDAF50 /* Entry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entry.swift; sourceTree = "<group>"; };
 		93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomePastActivities.swift; sourceTree = "<group>"; };
 		93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomePastActivities.swift; sourceTree = "<group>"; };
 		935892CF1E493C2300E1CD5F /* UIImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageView.swift; sourceTree = "<group>"; };
 		935892CF1E493C2300E1CD5F /* UIImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageView.swift; sourceTree = "<group>"; };
+		935D6E2C1E8678B700CED3A1 /* GalleryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GalleryView.xib; sourceTree = "<group>"; };
+		935D6E2E1E86792000CED3A1 /* GalleryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GalleryView.swift; sourceTree = "<group>"; };
+		935D6E301E867C5E00CED3A1 /* RowGallery.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowGallery.xib; sourceTree = "<group>"; };
+		935D6E321E867C7E00CED3A1 /* RowGallery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowGallery.swift; sourceTree = "<group>"; };
+		936966EC1E98445200A11055 /* AlbumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumViewController.swift; sourceTree = "<group>"; };
+		936966EE1E9848D600A11055 /* RowAlbum.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowAlbum.xib; sourceTree = "<group>"; };
+		936966F01E984B5000A11055 /* RowAlbum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowAlbum.swift; sourceTree = "<group>"; };
+		937EA02C1E5B8B5300D0893A /* UIApplcation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIApplcation.swift; sourceTree = "<group>"; };
+		938D211C1EA2275300C47EC3 /* LablancaView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LablancaView.xib; sourceTree = "<group>"; };
+		938D211E1EA2306300C47EC3 /* LablancaView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LablancaView.swift; sourceTree = "<group>"; };
 		93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuCollectionViewCell.swift; path = ../MenuCollectionViewCell.swift; sourceTree = "<group>"; };
 		93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MenuCollectionViewCell.swift; path = ../MenuCollectionViewCell.swift; sourceTree = "<group>"; };
+		93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeGallery.swift; sourceTree = "<group>"; };
+		93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeGallery.xib; sourceTree = "<group>"; };
 		93B84B961D9C31AB006C0F67 /* app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		93B84B961D9C31AB006C0F67 /* app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		93B84B991D9C31AB006C0F67 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		93B84B991D9C31AB006C0F67 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		93B84B9B1D9C31AB006C0F67 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
 		93B84B9B1D9C31AB006C0F67 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -59,6 +107,7 @@
 		93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeFutureActivities.swift; sourceTree = "<group>"; };
 		93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeFutureActivities.swift; sourceTree = "<group>"; };
 		93BAD2F51E586310009DF853 /* RowHomeSocial.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeSocial.xib; sourceTree = "<group>"; };
 		93BAD2F51E586310009DF853 /* RowHomeSocial.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowHomeSocial.xib; sourceTree = "<group>"; };
 		93BAD2F71E586741009DF853 /* RowHomeSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeSocial.swift; sourceTree = "<group>"; };
 		93BAD2F71E586741009DF853 /* RowHomeSocial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowHomeSocial.swift; sourceTree = "<group>"; };
+		93BEB6D11E7E878300C68DE5 /* PostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostViewController.swift; sourceTree = "<group>"; };
 		93D9EA5F1DE271E700089002 /* Section.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Section.xib; path = ../Section.xib; sourceTree = "<group>"; };
 		93D9EA5F1DE271E700089002 /* Section.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Section.xib; path = ../Section.xib; sourceTree = "<group>"; };
 		93D9EA631DE273FD00089002 /* Section.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
 		93D9EA631DE273FD00089002 /* Section.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
 		93D9EA671DE342AC00089002 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
 		93D9EA671DE342AC00089002 /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
@@ -66,6 +115,17 @@
 		93D9EA6B1DE3498500089002 /* HomeView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeView.xib; sourceTree = "<group>"; };
 		93D9EA6B1DE3498500089002 /* HomeView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeView.xib; sourceTree = "<group>"; };
 		93D9EA701DE37C7900089002 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
 		93D9EA701DE37C7900089002 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
 		93D9EA751DE3ACBB00089002 /* Sync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sync.swift; sourceTree = "<group>"; };
 		93D9EA751DE3ACBB00089002 /* Sync.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sync.swift; sourceTree = "<group>"; };
+		93E0C5E11EB7E7F000905811 /* ActivitiesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ActivitiesView.xib; sourceTree = "<group>"; };
+		93E0C5E31EB7E94300905811 /* ActivitiesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivitiesView.swift; sourceTree = "<group>"; };
+		93E0C5E51EBDEF2B00905811 /* RowFutureActivity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFutureActivity.swift; sourceTree = "<group>"; };
+		93E0C5E71EBDF0E700905811 /* RowFutureActivity.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowFutureActivity.xib; sourceTree = "<group>"; };
+		93E0C5E91EBDFFB300905811 /* RowPastActivity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowPastActivity.swift; sourceTree = "<group>"; };
+		93E0C5EB1EBE000F00905811 /* RowPastActivity.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowPastActivity.xib; sourceTree = "<group>"; };
+		93E0C5ED1EBE25BC00905811 /* RowLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowLabel.swift; sourceTree = "<group>"; };
+		93E0C5F11EBE264F00905811 /* RowLabel.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowLabel.xib; sourceTree = "<group>"; };
+		93E0C5F31EBE306900905811 /* ScheduleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduleViewController.swift; sourceTree = "<group>"; };
+		93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowSchedule.swift; sourceTree = "<group>"; };
+		93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowSchedule.xib; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
@@ -101,32 +161,62 @@
 		93B84B981D9C31AB006C0F67 /* app */ = {
 		93B84B981D9C31AB006C0F67 /* app */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */,
-				93B84B9B1D9C31AB006C0F67 /* ViewController.swift */,
-				93B84B991D9C31AB006C0F67 /* AppDelegate.swift */,
-				93B84B9D1D9C31AB006C0F67 /* Main.storyboard */,
-				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
-				93B84BA51D9C31AB006C0F67 /* LaunchScreen.storyboard */,
 				93B84BA81D9C31AB006C0F67 /* Info.plist */,
 				93B84BA81D9C31AB006C0F67 /* Info.plist */,
+				93B84BA31D9C31AB006C0F67 /* Assets.xcassets */,
 				93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */,
 				93B84BA01D9C31AB006C0F67 /* app.xcdatamodeld */,
+				93B84BA51D9C31AB006C0F67 /* LaunchScreen.storyboard */,
+				93B84B991D9C31AB006C0F67 /* AppDelegate.swift */,
+				93B84B9D1D9C31AB006C0F67 /* Main.storyboard */,
+				93B84B9B1D9C31AB006C0F67 /* ViewController.swift */,
+				93B408021D9ED44C000FBC99 /* MenuCollectionViewCell.swift */,
+				93BEB6D11E7E878300C68DE5 /* PostViewController.swift */,
 				93D9EA5F1DE271E700089002 /* Section.xib */,
 				93D9EA5F1DE271E700089002 /* Section.xib */,
 				93D9EA631DE273FD00089002 /* Section.swift */,
 				93D9EA631DE273FD00089002 /* Section.swift */,
 				931AA5AD1E218D0D003A2290 /* Entry.xib */,
 				931AA5AD1E218D0D003A2290 /* Entry.xib */,
 				93294FF71E336FA000FDAF50 /* Entry.swift */,
 				93294FF71E336FA000FDAF50 /* Entry.swift */,
 				93D9EA6B1DE3498500089002 /* HomeView.xib */,
 				93D9EA6B1DE3498500089002 /* HomeView.xib */,
 				93D9EA691DE3491100089002 /* HomeView.swift */,
 				93D9EA691DE3491100089002 /* HomeView.swift */,
-				93D9EA751DE3ACBB00089002 /* Sync.swift */,
-				931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */,
-				93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */,
+				93BAD2F11E585E88009DF853 /* RowHomeFutureActivities.xib */,
+				93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */,
 				93BAD2ED1E585578009DF853 /* RowHomeBlog.xib */,
 				93BAD2ED1E585578009DF853 /* RowHomeBlog.xib */,
 				93BAD2EF1E585662009DF853 /* RowHomeBlog.swift */,
 				93BAD2EF1E585662009DF853 /* RowHomeBlog.swift */,
+				931AA5AF1E219006003A2290 /* RowHomePastActivities.xib */,
+				93294FF91E337D0D00FDAF50 /* RowHomePastActivities.swift */,
+				93BAD2F51E586310009DF853 /* RowHomeSocial.xib */,
+				93BAD2F71E586741009DF853 /* RowHomeSocial.swift */,
+				93075C691E59CAB000396389 /* BlogView.xib */,
+				93075C6B1E59CB6B00396389 /* BlogView.swift */,
+				93075C711E59D06900396389 /* RowBlog.xib */,
+				93075C6F1E59D04A00396389 /* RowBlog.swift */,
+				93D9EA751DE3ACBB00089002 /* Sync.swift */,
 				931AA5881E1AFF8C003A2290 /* String.swift */,
 				931AA5881E1AFF8C003A2290 /* String.swift */,
 				93D9EA671DE342AC00089002 /* UIView.swift */,
 				93D9EA671DE342AC00089002 /* UIView.swift */,
 				935892CF1E493C2300E1CD5F /* UIImageView.swift */,
 				935892CF1E493C2300E1CD5F /* UIImageView.swift */,
-				93BAD2F11E585E88009DF853 /* RowHomeFutureActivities.xib */,
-				93BAD2F31E585EE6009DF853 /* RowHomeFutureActivities.swift */,
-				93BAD2F51E586310009DF853 /* RowHomeSocial.xib */,
-				93BAD2F71E586741009DF853 /* RowHomeSocial.swift */,
+				937EA02C1E5B8B5300D0893A /* UIApplcation.swift */,
+				935D6E2C1E8678B700CED3A1 /* GalleryView.xib */,
+				935D6E2E1E86792000CED3A1 /* GalleryView.swift */,
+				935D6E301E867C5E00CED3A1 /* RowGallery.xib */,
+				935D6E321E867C7E00CED3A1 /* RowGallery.swift */,
+				93B5C0191E872B4B0069BFF8 /* RowHomeGallery.swift */,
+				93B5C01B1E872B600069BFF8 /* RowHomeGallery.xib */,
+				936966EC1E98445200A11055 /* AlbumViewController.swift */,
+				936966EE1E9848D600A11055 /* RowAlbum.xib */,
+				936966F01E984B5000A11055 /* RowAlbum.swift */,
+				938D211C1EA2275300C47EC3 /* LablancaView.xib */,
+				938D211E1EA2306300C47EC3 /* LablancaView.swift */,
+				9326C4F31EA51C39007DF2A4 /* RowLablancaDay.xib */,
+				9326C4F51EA5279D007DF2A4 /* RowLablancaDay.swift */,
+				93E0C5E11EB7E7F000905811 /* ActivitiesView.xib */,
+				93E0C5E31EB7E94300905811 /* ActivitiesView.swift */,
+				93E0C5E51EBDEF2B00905811 /* RowFutureActivity.swift */,
+				93E0C5E71EBDF0E700905811 /* RowFutureActivity.xib */,
+				93E0C5E91EBDFFB300905811 /* RowPastActivity.swift */,
+				93E0C5EB1EBE000F00905811 /* RowPastActivity.xib */,
+				93E0C5ED1EBE25BC00905811 /* RowLabel.swift */,
+				93E0C5F11EBE264F00905811 /* RowLabel.xib */,
+				93E0C5F31EBE306900905811 /* ScheduleViewController.swift */,
+				93EB2F0B1EBF5AEB00F64186 /* RowSchedule.swift */,
+				93EB2F0D1EBF5BF500F64186 /* RowSchedule.xib */,
 			);
 			);
 			path = app;
 			path = app;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -172,7 +262,7 @@
 				TargetAttributes = {
 				TargetAttributes = {
 					93B84B951D9C31AB006C0F67 = {
 					93B84B951D9C31AB006C0F67 = {
 						CreatedOnToolsVersion = 8.0;
 						CreatedOnToolsVersion = 8.0;
-						DevelopmentTeam = Z2WQ2CQN52;
+						DevelopmentTeam = 9F9ER4X7TG;
 						ProvisioningStyle = Automatic;
 						ProvisioningStyle = Automatic;
 					};
 					};
 				};
 				};
@@ -200,16 +290,29 @@
 			isa = PBXResourcesBuildPhase;
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
+				93E0C5E21EB7E7F000905811 /* ActivitiesView.xib in Resources */,
 				931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */,
 				931AA5AE1E218D0E003A2290 /* Entry.xib in Resources */,
+				93E0C5E81EBDF0E700905811 /* RowFutureActivity.xib in Resources */,
+				938D211D1EA2275300C47EC3 /* LablancaView.xib in Resources */,
+				93075C721E59D06900396389 /* RowBlog.xib in Resources */,
 				93B84BA71D9C31AB006C0F67 /* LaunchScreen.storyboard in Resources */,
 				93B84BA71D9C31AB006C0F67 /* LaunchScreen.storyboard in Resources */,
 				93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */,
 				93BAD2F61E586310009DF853 /* RowHomeSocial.xib in Resources */,
 				93BAD2F21E585E88009DF853 /* RowHomeFutureActivities.xib in Resources */,
 				93BAD2F21E585E88009DF853 /* RowHomeFutureActivities.xib in Resources */,
 				931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */,
 				931AA5B01E219006003A2290 /* RowHomePastActivities.xib in Resources */,
+				93E0C5F21EBE264F00905811 /* RowLabel.xib in Resources */,
+				93E0C5EC1EBE001000905811 /* RowPastActivity.xib in Resources */,
+				936966EF1E9848D600A11055 /* RowAlbum.xib in Resources */,
 				93D9EA601DE271E700089002 /* Section.xib in Resources */,
 				93D9EA601DE271E700089002 /* Section.xib in Resources */,
+				93075C6A1E59CAB000396389 /* BlogView.xib in Resources */,
 				93B84BA41D9C31AB006C0F67 /* Assets.xcassets in Resources */,
 				93B84BA41D9C31AB006C0F67 /* Assets.xcassets in Resources */,
+				935D6E2D1E8678B700CED3A1 /* GalleryView.xib in Resources */,
+				93EB2F0E1EBF5BF500F64186 /* RowSchedule.xib in Resources */,
 				93BAD2EE1E585578009DF853 /* RowHomeBlog.xib in Resources */,
 				93BAD2EE1E585578009DF853 /* RowHomeBlog.xib in Resources */,
+				9326C4F41EA51C39007DF2A4 /* RowLablancaDay.xib in Resources */,
+				935D6E311E867C5E00CED3A1 /* RowGallery.xib in Resources */,
 				93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */,
 				93B84B9F1D9C31AB006C0F67 /* Main.storyboard in Resources */,
 				93D9EA6C1DE3498500089002 /* HomeView.xib in Resources */,
 				93D9EA6C1DE3498500089002 /* HomeView.xib in Resources */,
+				93B5C01C1E872B600069BFF8 /* RowHomeGallery.xib in Resources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -221,20 +324,37 @@
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
 				93294FF81E336FA000FDAF50 /* Entry.swift in Sources */,
 				93294FF81E336FA000FDAF50 /* Entry.swift in Sources */,
+				937EA02D1E5B8B5300D0893A /* UIApplcation.swift in Sources */,
+				93E0C5F41EBE306900905811 /* ScheduleViewController.swift in Sources */,
+				936966F11E984B5000A11055 /* RowAlbum.swift in Sources */,
 				93D9EA641DE273FD00089002 /* Section.swift in Sources */,
 				93D9EA641DE273FD00089002 /* Section.swift in Sources */,
 				93D9EA6A1DE3491100089002 /* HomeView.swift in Sources */,
 				93D9EA6A1DE3491100089002 /* HomeView.swift in Sources */,
+				93E0C5EE1EBE25BD00905811 /* RowLabel.swift in Sources */,
+				93BEB6D21E7E878300C68DE5 /* PostViewController.swift in Sources */,
 				93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */,
 				93BAD2F81E586741009DF853 /* RowHomeSocial.swift in Sources */,
+				9326C4F61EA5279D007DF2A4 /* RowLablancaDay.swift in Sources */,
 				93BAD2F01E585662009DF853 /* RowHomeBlog.swift in Sources */,
 				93BAD2F01E585662009DF853 /* RowHomeBlog.swift in Sources */,
 				93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */,
 				93294FFA1E337D0D00FDAF50 /* RowHomePastActivities.swift in Sources */,
+				93B5C01A1E872B4B0069BFF8 /* RowHomeGallery.swift in Sources */,
 				935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */,
 				935892D01E493C2300E1CD5F /* UIImageView.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
 				93D9EA761DE3ACBB00089002 /* Sync.swift in Sources */,
+				93E0C5EA1EBDFFB400905811 /* RowPastActivity.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				93BAD2F41E585EE6009DF853 /* RowHomeFutureActivities.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				931AA5891E1AFF8C003A2290 /* String.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
 				93B84B9C1D9C31AB006C0F67 /* ViewController.swift in Sources */,
+				93075C6C1E59CB6B00396389 /* BlogView.swift in Sources */,
 				93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */,
 				93B84B9A1D9C31AB006C0F67 /* AppDelegate.swift in Sources */,
 				93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */,
 				93B84BA21D9C31AB006C0F67 /* app.xcdatamodeld in Sources */,
+				935D6E331E867C7E00CED3A1 /* RowGallery.swift in Sources */,
+				93EB2F0C1EBF5AEB00F64186 /* RowSchedule.swift in Sources */,
+				936966ED1E98445200A11055 /* AlbumViewController.swift in Sources */,
 				93D9EA681DE342AC00089002 /* UIView.swift in Sources */,
 				93D9EA681DE342AC00089002 /* UIView.swift in Sources */,
+				938D211F1EA2306300C47EC3 /* LablancaView.swift in Sources */,
+				93075C701E59D04A00396389 /* RowBlog.swift in Sources */,
+				93E0C5E41EB7E94300905811 /* ActivitiesView.swift in Sources */,
 				93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */,
 				93B408031D9ED44C000FBC99 /* MenuCollectionViewCell.swift in Sources */,
+				93E0C5E61EBDEF2B00905811 /* RowFutureActivity.swift in Sources */,
+				935D6E2F1E86792000CED3A1 /* GalleryView.swift in Sources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -358,11 +478,11 @@
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = Z2WQ2CQN52;
+				DEVELOPMENT_TEAM = 9F9ER4X7TG;
 				INFOPLIST_FILE = app/Info.plist;
 				INFOPLIST_FILE = app/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.app;
+				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.iosapp;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_VERSION = 3.0;
 				SWIFT_VERSION = 3.0;
 			};
 			};
@@ -373,11 +493,11 @@
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = Z2WQ2CQN52;
+				DEVELOPMENT_TEAM = 9F9ER4X7TG;
 				INFOPLIST_FILE = app/Info.plist;
 				INFOPLIST_FILE = app/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.app;
+				PRODUCT_BUNDLE_IDENTIFIER = com.margolariak.iosapp;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_VERSION = 3.0;
 				SWIFT_VERSION = 3.0;
 			};
 			};

+ 254 - 0
app/ActivitiesView.swift

@@ -0,0 +1,254 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class ActivitiesView: UIView {
+	
+	@IBOutlet var container: ActivitiesView!
+	@IBOutlet weak var futureSection: Section!
+	@IBOutlet weak var pastSection: Section!
+
+	var delegate: AppDelegate? = nil
+	var storyboard: UIStoryboard? = nil
+	var controller: ViewController? = nil
+	var lang: String? = nil
+	var futureList: UIStackView? = nil
+	var pastList: UIStackView? = nil
+	var context: NSManagedObjectContext? = nil
+	
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		NSLog(":ACTIVITIES:DEBUG: init.")
+		
+		//Load the contents of the HomeView.xib file.
+		Bundle.main.loadNibNamed("ActivitiesView", owner: self, options: nil)
+		self.addSubview(container)
+		self.container.frame = self.bounds
+		self.futureSection.setTitle(text: "Próximas actividades")
+		self.pastSection.setTitle(text: "Últimas actividades")
+		self.futureList = self.futureSection.getContentStack()
+		self.pastList = self.pastSection.getContentStack()
+		
+		// Get viewController from StoryBoard
+		self.storyboard = UIStoryboard(name: "Main", bundle: nil)
+		self.controller = self.storyboard?.instantiateViewController(withIdentifier: "GMViewController") as? ViewController
+		self.context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		self.delegate = UIApplication.shared.delegate as? AppDelegate
+		self.lang = self.getLanguage()
+		self.context?.persistentStoreCoordinator = self.delegate?.persistentStoreCoordinator
+
+		// Populate activity lists.
+		populate()
+	}
+		
+	func populate(){
+		// Show future activities
+		var fetchRequest: NSFetchRequest<Activity> = Activity.fetchRequest()
+		var sortDescriptor = NSSortDescriptor(key: "date", ascending: true)
+		var sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.predicate = NSPredicate(format: "date > %@", NSDate())
+		
+		do {
+			let searchResults = try self.context?.fetch(fetchRequest)
+			NSLog(":ACTIVITIES:DEBUG: Total future activities: \(String(describing: searchResults?.count))")
+			if searchResults?.count == 0{
+				NSLog(":ACTIVITIES:DEBUG: No future activities: \(String(describing: searchResults?.count))")
+				let row: RowLabel = RowLabel.init(s: "rowFutureActivity0", i: 0)
+				row.setText(text: "No hay actividades planeadas proximamente. Pronto organizaremos algo!")
+				self.futureList?.addArrangedSubview(row)
+			}
+			else{
+			
+				var row : RowFutureActivity
+				var count = 0
+				var id: Int
+				var title: String
+				var text: String
+				var image: String
+				var city: String
+				var price: Int
+				var date: NSDate
+			
+				for r in searchResults! {
+					count = count + 1
+					NSLog(":ACTIVITIES:DEBUG: Activity perm: \(String(describing: r.value(forKey: "permalink")))")
+				
+					// Create a new row
+					row = RowFutureActivity.init(s: "rowFutureActivity\(count)", i: count)
+					id = r.value(forKey: "id")! as! Int
+					title = r.value(forKey: "title_\(lang!)")! as! String
+					text = r.value(forKey: "text_\(lang!)")! as! String
+					city = r.value(forKey: "city")! as! String
+					price = r.value(forKey: "price")! as! Int
+					date = r.value(forKey: "date")! as! NSDate
+					row.setTitle(text: title)
+					row.setText(text: text)
+					row.setPrice(price: price)
+					row.setCity(text: city)
+					row.setDate(date: date, lang: lang!)
+				
+					// Get main image
+					image = ""
+					let imgFetchRequest: NSFetchRequest<Activity_image> = Activity_image.fetchRequest()
+					let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+					let imgSortDescriptors = [imgSortDescriptor]
+					imgFetchRequest.sortDescriptors = imgSortDescriptors
+					imgFetchRequest.predicate = NSPredicate(format: "activity == %i", id)
+					imgFetchRequest.fetchLimit = 1
+					do{
+						let imgSearchResults = try self.context?.fetch(imgFetchRequest)
+						for imgR in imgSearchResults!{
+							image = imgR.value(forKey: "image")! as! String
+							NSLog(":ACTIVITIES:DEBUG: Image: \(image)")
+							row.setImage(filename: image)
+						}
+					} catch {
+						NSLog(":ACTIVITIES:ERROR: Error getting image for activity \(id): \(error)")
+					}
+				
+					self.futureList?.addArrangedSubview(row)
+					//row.setNeedsLayout()
+					//row.layoutIfNeeded()
+				
+					// TODO: Do this on the row didLoad method
+					// Set tap recognizer
+					//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openActivity(_:)))
+					//row.isUserInteractionEnabled = true
+					//row.addGestureRecognizer(tapRecognizer)
+				}
+				self.futureList?.setNeedsLayout()
+				self.futureList?.layoutIfNeeded()
+			}
+		}
+		catch {
+			NSLog(":ACTIVITIES:ERROR: Error with request: \(error)")
+		}
+		
+		
+		
+		// Show past activities
+		fetchRequest = Activity.fetchRequest()
+		sortDescriptor = NSSortDescriptor(key: "date", ascending: false)
+		sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.predicate = NSPredicate(format: "date < %@", NSDate())
+		
+		do {
+			let searchResults = try self.context?.fetch(fetchRequest)
+			NSLog(":ACTIVITIES:DEBUG: Total past activities: \(String(describing: searchResults?.count))")
+			
+			var row: RowPastActivity
+			var count: Int = 0
+			var id: Int
+			var title: String
+			var text: String
+			var image: String
+			
+			for r in searchResults! {
+				count = count + 1
+				NSLog(":ACTIVITIES:DEBUG: Activity perm: \(String(describing: r.value(forKey: "permalink")))")
+				
+				// Create a new row
+				row = RowPastActivity.init(s: "rowPastActivity\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				title = r.value(forKey: "title_\(lang!)")! as! String
+				text = r.value(forKey: "text_\(lang!)")! as! String
+				row.setTitle(text: title)
+				row.setText(text: text)
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Activity_image> = Activity_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "activity == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try self.context?.fetch(imgFetchRequest)
+					for imgR in imgSearchResults!{
+						image = imgR.value(forKey: "image")! as! String
+						NSLog(":ACTIVITIES:DEBUG: Image: \(image)")
+						row.setImage(filename: image)
+					}
+				}
+				catch {
+					NSLog(":ACTIVITIES:ERROR: Error getting image for activity \(id): \(error)")
+				}
+				
+				NSLog(":ACTIVITIES:DEBUG: Row height: \(row.frame.height)")
+				
+				self.pastList?.addArrangedSubview(row)
+				//row.setNeedsLayout()
+				//row.layoutIfNeeded()
+				
+				// TODO: Do this on the row didLoad method
+				// Set tap recognizer
+				//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openActivity(_:)))
+				//row.isUserInteractionEnabled = true
+				//row.addGestureRecognizer(tapRecognizer)
+			}
+			self.pastList?.setNeedsLayout()
+			self.pastList?.layoutIfNeeded()
+		} catch {
+			NSLog(":ACTIVITIES:ERROR: Error with request: \(error)")
+		}
+		NSLog(":ACTIVITIES:DEBUG: Finished loading ActivitiesView")
+	}
+	
+	/*func openActivity(){//(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ACTIVITIES:DEBUG: getting delegate and showing activity.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showActivity(id: 4)
+		NSLog(":ACTIVITIES:DEBUG: Activity should be shown.")
+	}
+	
+	func openActivity(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ACTIVITIES:DEBUG: getting delegate and showing activity.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showActivity(id: 4)
+		NSLog(":ACTIVITIES:DEBUG: Activity should be shown.")
+	}*/
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+}

+ 60 - 0
app/ActivitiesView.xib

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ActivitiesView" customModule="app">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="7AX-8i-BPU"/>
+                <outlet property="futureSection" destination="Jdf-74-tJS" id="WNV-uv-XXg"/>
+                <outlet property="pastSection" destination="0Su-Ex-4hq" id="3vd-uB-fTu"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xyM-cc-W1r">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="666"/>
+                    <subviews>
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="gvi-ij-s5Q">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="306"/>
+                            <subviews>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jdf-74-tJS" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+                                </view>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0Su-Ex-4hq" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="50" width="375" height="256"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="0Su-Ex-4hq" firstAttribute="top" secondItem="Jdf-74-tJS" secondAttribute="bottom" constant="10" id="Vwq-bc-l9J"/>
+                                <constraint firstAttribute="bottom" secondItem="0Su-Ex-4hq" secondAttribute="bottom" id="YXW-7I-LlA"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="bottom" secondItem="gvi-ij-s5Q" secondAttribute="bottom" id="dLo-VU-AFT"/>
+                        <constraint firstAttribute="trailing" secondItem="gvi-ij-s5Q" secondAttribute="trailing" id="iKv-jf-8lN"/>
+                        <constraint firstItem="gvi-ij-s5Q" firstAttribute="top" secondItem="xyM-cc-W1r" secondAttribute="top" id="nBi-D9-aFk"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="gvi-ij-s5Q" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="4bi-AV-eh4"/>
+                <constraint firstItem="xyM-cc-W1r" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="6Qm-1G-beA"/>
+                <constraint firstItem="xyM-cc-W1r" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="92C-lK-w4Q"/>
+                <constraint firstItem="gvi-ij-s5Q" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Iab-hX-fdC"/>
+                <constraint firstItem="xyM-cc-W1r" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="iKU-OG-Vpz"/>
+                <constraint firstItem="xyM-cc-W1r" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="q5m-cP-yKY"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 172 - 0
app/AlbumViewController.swift

@@ -0,0 +1,172 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+class AlbumViewController: UIViewController, UIGestureRecognizerDelegate {
+	
+	@IBOutlet weak var barButton: UIButton!
+	@IBOutlet weak var barTitle: UILabel!
+	@IBOutlet weak var albumTitle: UILabel!
+	@IBOutlet weak var albumContainer: UIStackView!
+	@IBOutlet weak var albumView: UIView!
+
+	// Album ID
+	var id: Int = -1
+	
+	// App delegate
+	var delegate: AppDelegate?
+	
+	// Id received from segue.
+	var passId: Int = -1
+	
+	func getContext () -> NSManagedObjectContext {
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		
+		NSLog(":ALBUMCONTROLLER:LOG: Init album.")
+		
+		super.viewDidLoad()
+		self.loadAlbum(id: id)
+		
+		// Set button action
+		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	/**
+	Returns to the main view controller.
+	*/
+	func back() {
+		NSLog(":ALBUMCONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	/**
+	Loads the photos of the album
+	*/
+	public func loadAlbum(id: Int){
+		
+		NSLog(":ALBUMCONTROLLER:DEBUG: Loading album \(id)")
+		
+		albumContainer.backgroundColor = UIColor.red
+		
+		var row : RowAlbum
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "album = %i", id)
+		
+		var rowcount = 0
+		
+		do {
+			
+			// Get the photo list
+			let searchResults = try context.fetch(fetchRequest)
+			var image: String
+			
+			NSLog(":GALLERYCONTROLLER:DEBUG: Total photos: \(searchResults.count)")
+			
+			for i in (0..<searchResults.count) where i % 2 == 0 {
+				
+				var r = searchResults[i]
+				var photoId = r.value(forKey: "photo")! as! Int
+				
+				row = RowAlbum.init(s: "rowAlbum\(i)", i: i)
+				
+				// Get photo info from Photo entity
+				let imgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "uploaded", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					var imgSearchResults = try context.fetch(imgFetchRequest)
+					var imgR = imgSearchResults[0]
+					image = imgR.value(forKey: "file")! as! String
+					NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) left: \(image)")
+					row.setImage(idx: 0, filename: image)
+					if i + 1 < searchResults.count {
+						r = searchResults[i + 1]
+						photoId = r.value(forKey: "photo")! as! Int
+						imgFetchRequest.predicate = NSPredicate(format: "id == %i", photoId)
+						imgSearchResults = try context.fetch(imgFetchRequest)
+						
+						
+						imgR = imgSearchResults[0]
+						image = imgR.value(forKey: "file")! as! String
+						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: \(image)")
+						row.setImage(idx: 1, filename: image)
+					}
+					else{
+						NSLog(":GALLERYCONTROLLER:LOG: Image Row \(i) right: none")
+					}
+					//TODO create row, add images (L+R), add row to container.
+					//row.setImage(filename: image)
+				} catch {
+					print(":GALLERYCONTROLLER:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+				NSLog(":GALLERYCONTROLLER:DEBUG: Adding row: height: \(row.frame.height)")
+				albumContainer.addArrangedSubview(row)
+				
+				rowcount = rowcount + 1
+			}
+		} catch {
+			print("POST:ERROR: Error with request: \(error)")
+		}
+	}
+	
+	/**
+	Gets the device language.
+	:return: Two letter language code of the device.
+	*/
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 3 - 0
app/AppDelegate.swift

@@ -25,6 +25,8 @@ import CoreData
 class AppDelegate: UIResponder, UIApplicationDelegate {
 class AppDelegate: UIResponder, UIApplicationDelegate {
 
 
 	var window: UIWindow?
 	var window: UIWindow?
+	
+	var controller: ViewController?
 
 
 	
 	
 
 
@@ -120,5 +122,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 			}
 			}
 		}
 		}
 	}
 	}
+	
 }
 }
 
 

+ 6 - 0
app/Assets.xcassets/Misc/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 23 - 0
app/Assets.xcassets/Misc/Pinpoint.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint-1.png


BIN
app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint-2.png


BIN
app/Assets.xcassets/Misc/Pinpoint.imageset/pinpoint.png


+ 23 - 0
app/Assets.xcassets/Misc/PinpointGM.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint_gm.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint_gm-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pinpoint_gm-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm-1.png


BIN
app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm-2.png


BIN
app/Assets.xcassets/Misc/PinpointGM.imageset/pinpoint_gm.png


+ 23 - 0
app/Assets.xcassets/Misc/ScheduleBullet.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_point.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_point-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_point-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point-1.png


BIN
app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point-2.png


BIN
app/Assets.xcassets/Misc/ScheduleBullet.imageset/schedule_point.png


+ 23 - 0
app/Assets.xcassets/Misc/ScheduleLine.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_timeline.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_timeline-1.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "schedule_timeline-2.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline-1.png


BIN
app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline-2.png


BIN
app/Assets.xcassets/Misc/ScheduleLine.imageset/schedule_timeline.png


+ 730 - 14
app/Base.lproj/Main.storyboard

@@ -1,12 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
     <device id="retina4_0" orientation="portrait">
     <device id="retina4_0" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
         <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
         <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <scenes>
     <scenes>
@@ -23,10 +24,10 @@
                 <placeholder placeholderIdentifier="IBFirstResponder" id="utt-1m-pei" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="utt-1m-pei" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
         </scene>
         </scene>
-        <!--Gasteizko Margolariak-->
+        <!--GMViewController-->
         <scene sceneID="tne-QT-ifu">
         <scene sceneID="tne-QT-ifu">
             <objects>
             <objects>
-                <viewController title="Gasteizko Margolariak" id="BYZ-38-t0r" customClass="ViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController storyboardIdentifier="GMViewController" title="Gasteizko Margolariak" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BYZ-38-t0r" userLabel="GMViewController" customClass="ViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
                     <layoutGuides>
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
                         <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
                         <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
                         <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@@ -63,7 +64,7 @@
                                 </collectionViewFlowLayout>
                                 </collectionViewFlowLayout>
                                 <cells>
                                 <cells>
                                     <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="a4j-DF-epb" customClass="MenuCollectionViewCell" customModule="app" customModuleProvider="target">
                                     <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="a4j-DF-epb" customClass="MenuCollectionViewCell" customModule="app" customModuleProvider="target">
-                                        <rect key="frame" x="0.0" y="-2.5" width="100" height="50"/>
+                                        <rect key="frame" x="0.0" y="-3" width="100" height="50"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                             <rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
                                             <rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
@@ -184,6 +185,10 @@
                         <outlet property="containerViewHome" destination="FfD-xR-Ufj" id="EtF-qz-vWE"/>
                         <outlet property="containerViewHome" destination="FfD-xR-Ufj" id="EtF-qz-vWE"/>
                         <outlet property="containerViewLablanca" destination="nhy-Gy-cgq" id="bBa-2W-hjf"/>
                         <outlet property="containerViewLablanca" destination="nhy-Gy-cgq" id="bBa-2W-hjf"/>
                         <outlet property="containerViewLocation" destination="T4H-Rn-I4y" id="EFa-Km-WuR"/>
                         <outlet property="containerViewLocation" destination="T4H-Rn-I4y" id="EFa-Km-WuR"/>
+                        <segue destination="UkS-wI-Yhx" kind="show" identifier="SeguePost" id="gs2-jd-cPW"/>
+                        <segue destination="k0M-Sk-DZM" kind="show" identifier="SegueAlbum" id="Puc-tv-vaD"/>
+                        <segue destination="zJF-Mh-CNb" kind="show" identifier="SegueSchedule" id="A70-jo-yAP"/>
+                        <segue destination="3o1-ab-AT4" kind="show" identifier="SegueSync" id="E96-mK-gE9"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
@@ -234,10 +239,10 @@
                         <viewControllerLayoutGuide type="top" id="dmp-DU-HeF"/>
                         <viewControllerLayoutGuide type="top" id="dmp-DU-HeF"/>
                         <viewControllerLayoutGuide type="bottom" id="cDH-sf-Urh"/>
                         <viewControllerLayoutGuide type="bottom" id="cDH-sf-Urh"/>
                     </layoutGuides>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="XIc-19-qoq">
+                    <view key="view" contentMode="scaleToFill" id="XIc-19-qoq" customClass="LablancaView" customModule="app">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                     </view>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="L8G-JV-V2l" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="L8G-JV-V2l" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -252,10 +257,10 @@
                         <viewControllerLayoutGuide type="top" id="OhA-Gv-fwb"/>
                         <viewControllerLayoutGuide type="top" id="OhA-Gv-fwb"/>
                         <viewControllerLayoutGuide type="bottom" id="3Yd-97-laW"/>
                         <viewControllerLayoutGuide type="bottom" id="3Yd-97-laW"/>
                     </layoutGuides>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="e8E-bp-zJI">
+                    <view key="view" contentMode="scaleToFill" id="e8E-bp-zJI" customClass="ActivitiesView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="0.4079896717" green="1" blue="0.34807942549999998" alpha="1" colorSpace="calibratedRGB"/>
+                        <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="calibratedRGB"/>
                     </view>
                     </view>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iuX-Se-nlc" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iuX-Se-nlc" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -270,15 +275,15 @@
                         <viewControllerLayoutGuide type="top" id="yir-Ne-huf"/>
                         <viewControllerLayoutGuide type="top" id="yir-Ne-huf"/>
                         <viewControllerLayoutGuide type="bottom" id="126-8G-plw"/>
                         <viewControllerLayoutGuide type="bottom" id="126-8G-plw"/>
                     </layoutGuides>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z">
+                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z" customClass="BlogView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="1" green="0.33842284866451022" blue="0.42972784824945376" alpha="1" colorSpace="calibratedRGB"/>
+                        <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="calibratedRGB"/>
                     </view>
                     </view>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iDB-bY-1MG" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iDB-bY-1MG" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
-            <point key="canvasLocation" x="1643" y="1803"/>
+            <point key="canvasLocation" x="2081" y="2157"/>
         </scene>
         </scene>
         <!--Gallery-->
         <!--Gallery-->
         <scene sceneID="Uqp-if-ZuD">
         <scene sceneID="Uqp-if-ZuD">
@@ -288,15 +293,726 @@
                         <viewControllerLayoutGuide type="top" id="yvh-VS-RXe"/>
                         <viewControllerLayoutGuide type="top" id="yvh-VS-RXe"/>
                         <viewControllerLayoutGuide type="bottom" id="tOB-l0-rCU"/>
                         <viewControllerLayoutGuide type="bottom" id="tOB-l0-rCU"/>
                     </layoutGuides>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="pPe-Xd-teA">
+                    <view key="view" contentMode="scaleToFill" id="pPe-Xd-teA" customClass="GalleryView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     </view>
                     </view>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="2vc-bF-Qwf" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="2vc-bF-Qwf" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
             <point key="canvasLocation" x="1509" y="576"/>
             <point key="canvasLocation" x="1509" y="576"/>
         </scene>
         </scene>
+        <!--Post-->
+        <scene sceneID="zgg-Cx-j75">
+            <objects>
+                <viewController title="Post" id="UkS-wI-Yhx" customClass="PostViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="yy6-d2-MRo"/>
+                        <viewControllerLayoutGuide type="bottom" id="IxZ-up-5UO"/>
+                    </layoutGuides>
+                    <view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="mCJ-K1-jG1" userLabel="Container">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="arX-Be-0iS" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="320" height="30"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="029-px-JqL">
+                                        <rect key="frame" x="0.0" y="0.0" width="48" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BIE-D1-hCZ">
+                                        <rect key="frame" x="48" y="0.0" width="224" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="height" secondItem="arX-Be-0iS" secondAttribute="height" id="6Ck-IY-1CK"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="centerY" secondItem="arX-Be-0iS" secondAttribute="centerY" id="Es5-Zm-aQk"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="centerY" secondItem="arX-Be-0iS" secondAttribute="centerY" id="PkD-5w-aPZ"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="height" secondItem="arX-Be-0iS" secondAttribute="height" id="RTL-TJ-15M"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="width" secondItem="arX-Be-0iS" secondAttribute="width" multiplier="0.7" id="UOQ-6G-qoP"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="width" secondItem="arX-Be-0iS" secondAttribute="width" multiplier="0.15" id="VYu-Jc-ahB"/>
+                                    <constraint firstItem="029-px-JqL" firstAttribute="leading" secondItem="arX-Be-0iS" secondAttribute="leading" id="o0K-dB-meB"/>
+                                    <constraint firstItem="BIE-D1-hCZ" firstAttribute="centerX" secondItem="arX-Be-0iS" secondAttribute="centerX" id="zrK-6B-Gff"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jx5-wy-ab4">
+                                <rect key="frame" x="0.0" y="50" width="320" height="518"/>
+                                <subviews>
+                                    <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="14b-YG-Iyb">
+                                        <rect key="frame" x="0.0" y="0.0" width="320" height="518"/>
+                                        <subviews>
+                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yIU-b9-Dc5" userLabel="Section">
+                                                <rect key="frame" x="10" y="10" width="300" height="995"/>
+                                                <subviews>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tRk-Ti-VOu" userLabel="Title">
+                                                        <rect key="frame" x="0.0" y="0.0" width="300" height="30"/>
+                                                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="30" id="pTS-D5-LUl"/>
+                                                        </constraints>
+                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="bSp-Sd-3qA" userLabel="Content">
+                                                        <rect key="frame" x="0.0" y="30" width="300" height="965"/>
+                                                        <subviews>
+                                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7t9-eQ-KC7" userLabel="Post">
+                                                                <rect key="frame" x="8" y="8" width="284" height="949"/>
+                                                                <subviews>
+                                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="u3M-mi-Tyn" userLabel="Image">
+                                                                        <rect key="frame" x="0.0" y="10" width="284" height="71"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="71" id="fQp-wR-eLU"/>
+                                                                        </constraints>
+                                                                    </imageView>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2i2-HF-HyI" userLabel="Text">
+                                                                        <rect key="frame" x="14" y="91" width="256" height="826"/>
+                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                        <nil key="textColor"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tAc-xa-mg2" userLabel="Separator">
+                                                                        <rect key="frame" x="14" y="917" width="256" height="2"/>
+                                                                        <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="2" id="TTW-wU-fHT"/>
+                                                                        </constraints>
+                                                                    </view>
+                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="254" text="Date" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pX4-mq-dj0" userLabel="Date">
+                                                                        <rect key="frame" x="14" y="929" width="256" height="20"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="height" constant="20" id="Qos-eG-WmY"/>
+                                                                        </constraints>
+                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                        <nil key="textColor"/>
+                                                                        <nil key="highlightedColor"/>
+                                                                    </label>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <constraints>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" id="4ZF-fF-btB"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Bf4-vV-UnB"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="Dqr-hS-PV9"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="Hoe-4Q-YTi"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="U33-D3-0dG"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="dcP-of-FdV"/>
+                                                                    <constraint firstItem="2i2-HF-HyI" firstAttribute="top" secondItem="u3M-mi-Tyn" secondAttribute="bottom" constant="10" id="enp-lt-dAC"/>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="centerX" secondItem="7t9-eQ-KC7" secondAttribute="centerX" id="gd8-xG-NLo"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="width" secondItem="7t9-eQ-KC7" secondAttribute="width" multiplier="0.9" id="h9c-Tr-HaL"/>
+                                                                    <constraint firstItem="u3M-mi-Tyn" firstAttribute="top" secondItem="7t9-eQ-KC7" secondAttribute="top" constant="10" id="ilB-HA-43E"/>
+                                                                    <constraint firstAttribute="bottom" secondItem="pX4-mq-dj0" secondAttribute="bottom" id="j3Q-f8-ncG"/>
+                                                                    <constraint firstItem="tAc-xa-mg2" firstAttribute="top" secondItem="2i2-HF-HyI" secondAttribute="bottom" id="sQe-ZF-dDj"/>
+                                                                    <constraint firstItem="pX4-mq-dj0" firstAttribute="top" secondItem="tAc-xa-mg2" secondAttribute="bottom" constant="10" id="y6S-1C-uEC"/>
+                                                                </constraints>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="1"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="3"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </view>
+                                                        </subviews>
+                                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                    </stackView>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="width" secondItem="yIU-b9-Dc5" secondAttribute="width" id="48B-MC-FiI"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="width" secondItem="yIU-b9-Dc5" secondAttribute="width" id="8hp-PL-zs2"/>
+                                                    <constraint firstAttribute="bottom" secondItem="bSp-Sd-3qA" secondAttribute="bottom" id="AmB-6T-H8u"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="centerX" secondItem="yIU-b9-Dc5" secondAttribute="centerX" id="GLO-lV-zKm"/>
+                                                    <constraint firstItem="tRk-Ti-VOu" firstAttribute="top" secondItem="yIU-b9-Dc5" secondAttribute="top" id="kvI-es-Bmu"/>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="centerX" secondItem="yIU-b9-Dc5" secondAttribute="centerX" id="obg-Sv-CD5"/>
+                                                    <constraint firstItem="bSp-Sd-3qA" firstAttribute="top" secondItem="tRk-Ti-VOu" secondAttribute="bottom" id="wkt-kn-ZPO"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                        <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                        <real key="value" value="1"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                        <real key="value" value="8"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                            </view>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <constraints>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="top" secondItem="14b-YG-Iyb" secondAttribute="top" constant="10" id="56X-pA-LLg"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="trailing" secondItem="14b-YG-Iyb" secondAttribute="trailing" constant="10" id="8Xl-m3-1Xk"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="centerX" secondItem="14b-YG-Iyb" secondAttribute="centerX" id="8oz-7C-ZSn"/>
+                                            <constraint firstAttribute="bottom" secondItem="yIU-b9-Dc5" secondAttribute="bottom" constant="10" id="BC1-pI-UDI"/>
+                                            <constraint firstItem="yIU-b9-Dc5" firstAttribute="leading" secondItem="14b-YG-Iyb" secondAttribute="leading" constant="10" id="SDQ-gY-p6d"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="0.0"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </scrollView>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="top" secondItem="jx5-wy-ab4" secondAttribute="top" id="H0N-Z2-1N1"/>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="width" secondItem="jx5-wy-ab4" secondAttribute="width" id="UPZ-Yz-bgJ"/>
+                                    <constraint firstAttribute="bottom" secondItem="14b-YG-Iyb" secondAttribute="bottom" id="ht1-9m-ecR"/>
+                                    <constraint firstItem="14b-YG-Iyb" firstAttribute="centerX" secondItem="jx5-wy-ab4" secondAttribute="centerX" id="tgi-xm-huK"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="centerX" secondItem="mCJ-K1-jG1" secondAttribute="centerX" id="5lE-sn-JIj"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="top" secondItem="yy6-d2-MRo" secondAttribute="bottom" id="SYd-o2-Nm3"/>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="top" secondItem="arX-Be-0iS" secondAttribute="bottom" id="i80-pQ-ZU9"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="centerX" secondItem="mCJ-K1-jG1" secondAttribute="centerX" id="jAL-9l-RFi"/>
+                            <constraint firstItem="jx5-wy-ab4" firstAttribute="width" secondItem="mCJ-K1-jG1" secondAttribute="width" id="lZY-vh-Ap2"/>
+                            <constraint firstItem="arX-Be-0iS" firstAttribute="width" secondItem="mCJ-K1-jG1" secondAttribute="width" id="r1S-WW-h1K"/>
+                            <constraint firstAttribute="bottom" secondItem="jx5-wy-ab4" secondAttribute="bottom" id="xI7-lL-Xhw"/>
+                        </constraints>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                <real key="value" value="0.0"/>
+                            </userDefinedRuntimeAttribute>
+                        </userDefinedRuntimeAttributes>
+                    </view>
+                    <connections>
+                        <outlet property="barButton" destination="029-px-JqL" id="48Y-ht-xLk"/>
+                        <outlet property="barTitle" destination="BIE-D1-hCZ" id="Fwf-72-Zfe"/>
+                        <outlet property="postImage" destination="u3M-mi-Tyn" id="usY-gh-LBn"/>
+                        <outlet property="postText" destination="2i2-HF-HyI" id="Mmz-c2-N6D"/>
+                        <outlet property="postTitle" destination="tRk-Ti-VOu" id="7kU-Dg-MLX"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="r4n-Sk-nt4" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-728" y="1744"/>
+        </scene>
+        <!--Album-->
+        <scene sceneID="R7a-5x-3QL">
+            <objects>
+                <viewController title="Album" id="k0M-Sk-DZM" customClass="AlbumViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="ONc-DJ-6Kh"/>
+                        <viewControllerLayoutGuide type="bottom" id="Jfy-ak-hpJ"/>
+                    </layoutGuides>
+                    <view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="iBY-d9-Ye4" userLabel="Container">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kLX-yW-lMr" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="320" height="30"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Thj-0t-rxK">
+                                        <rect key="frame" x="0.0" y="0.0" width="48" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LLe-aQ-Sbj">
+                                        <rect key="frame" x="48" y="0.0" width="224" height="30"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="width" secondItem="kLX-yW-lMr" secondAttribute="width" multiplier="0.7" id="3sD-ex-RH9"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="centerY" secondItem="kLX-yW-lMr" secondAttribute="centerY" id="7Jj-rc-BTU"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="leading" secondItem="kLX-yW-lMr" secondAttribute="leading" id="Jcs-G1-TKC"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="centerY" secondItem="kLX-yW-lMr" secondAttribute="centerY" id="VWD-2l-QIQ"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="height" secondItem="kLX-yW-lMr" secondAttribute="height" id="XCm-uK-ZdM"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="height" secondItem="kLX-yW-lMr" secondAttribute="height" id="m2u-z2-gQX"/>
+                                    <constraint firstItem="LLe-aQ-Sbj" firstAttribute="centerX" secondItem="kLX-yW-lMr" secondAttribute="centerX" id="uyE-xa-dZu"/>
+                                    <constraint firstItem="Thj-0t-rxK" firstAttribute="width" secondItem="kLX-yW-lMr" secondAttribute="width" multiplier="0.15" id="uzO-gY-Kxq"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WEW-3s-kOI">
+                                <rect key="frame" x="0.0" y="50" width="320" height="518"/>
+                                <subviews>
+                                    <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" bounces="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kmd-tW-XIB">
+                                        <rect key="frame" x="0.0" y="0.0" width="320" height="518"/>
+                                        <subviews>
+                                            <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sej-1q-hlq" userLabel="Section">
+                                                <rect key="frame" x="10" y="10" width="300" height="1046"/>
+                                                <subviews>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YsV-il-CeR" userLabel="Title">
+                                                        <rect key="frame" x="0.0" y="0.0" width="300" height="30"/>
+                                                        <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="30" id="1pw-9x-fqs"/>
+                                                        </constraints>
+                                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="NlX-b5-vyb" userLabel="Content">
+                                                        <rect key="frame" x="0.0" y="30" width="300" height="1016"/>
+                                                        <subviews>
+                                                            <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YEF-04-q7Y" userLabel="Album">
+                                                                <rect key="frame" x="8" y="8" width="284" height="1000"/>
+                                                                <subviews>
+                                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="WRD-IZ-JpU">
+                                                                        <rect key="frame" x="0.0" y="0.0" width="284" height="1000"/>
+                                                                    </stackView>
+                                                                </subviews>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                <constraints>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="centerY" secondItem="YEF-04-q7Y" secondAttribute="centerY" id="HMS-4q-ns8"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="width" secondItem="YEF-04-q7Y" secondAttribute="width" id="Im5-F6-vGb"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="height" secondItem="YEF-04-q7Y" secondAttribute="height" id="U7o-HF-khX"/>
+                                                                    <constraint firstItem="WRD-IZ-JpU" firstAttribute="centerX" secondItem="YEF-04-q7Y" secondAttribute="centerX" id="jKg-n6-Kko"/>
+                                                                </constraints>
+                                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="1"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="3"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </view>
+                                                        </subviews>
+                                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                    </stackView>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="centerX" secondItem="sej-1q-hlq" secondAttribute="centerX" id="11D-qS-lDY"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="centerX" secondItem="sej-1q-hlq" secondAttribute="centerX" id="Oym-KM-sqY"/>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="top" secondItem="YsV-il-CeR" secondAttribute="bottom" id="kG4-rx-MOP"/>
+                                                    <constraint firstItem="NlX-b5-vyb" firstAttribute="width" secondItem="sej-1q-hlq" secondAttribute="width" id="mxX-S0-Jhg"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="width" secondItem="sej-1q-hlq" secondAttribute="width" id="ql7-1w-gZt"/>
+                                                    <constraint firstItem="YsV-il-CeR" firstAttribute="top" secondItem="sej-1q-hlq" secondAttribute="top" id="tWs-7c-cHP"/>
+                                                    <constraint firstAttribute="bottom" secondItem="NlX-b5-vyb" secondAttribute="bottom" id="tfG-n0-ydH"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                        <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                        <real key="value" value="1"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                        <real key="value" value="8"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                            </view>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <constraints>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="trailing" secondItem="Kmd-tW-XIB" secondAttribute="trailing" constant="10" id="Axn-3D-Qni"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="top" secondItem="Kmd-tW-XIB" secondAttribute="top" constant="10" id="W3n-lX-oj8"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="leading" secondItem="Kmd-tW-XIB" secondAttribute="leading" constant="10" id="k9J-Pf-W1C"/>
+                                            <constraint firstItem="sej-1q-hlq" firstAttribute="centerX" secondItem="Kmd-tW-XIB" secondAttribute="centerX" id="sn2-ir-MIe"/>
+                                            <constraint firstAttribute="bottom" secondItem="sej-1q-hlq" secondAttribute="bottom" constant="10" id="uH3-zh-3sM"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="0.0"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </scrollView>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="Kmd-tW-XIB" secondAttribute="bottom" id="0Uz-ek-vBj"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="width" secondItem="WEW-3s-kOI" secondAttribute="width" id="Bi9-mv-NSg"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="top" secondItem="WEW-3s-kOI" secondAttribute="top" id="S3J-3p-RrM"/>
+                                    <constraint firstItem="Kmd-tW-XIB" firstAttribute="centerX" secondItem="WEW-3s-kOI" secondAttribute="centerX" id="aXw-Ot-IDF"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="top" secondItem="ONc-DJ-6Kh" secondAttribute="bottom" id="1cs-f7-eXV"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="centerX" secondItem="iBY-d9-Ye4" secondAttribute="centerX" id="7rG-90-CBm"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="width" secondItem="iBY-d9-Ye4" secondAttribute="width" id="L71-wc-a42"/>
+                            <constraint firstItem="WEW-3s-kOI" firstAttribute="top" secondItem="kLX-yW-lMr" secondAttribute="bottom" id="NlL-cF-RyX"/>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="centerX" secondItem="iBY-d9-Ye4" secondAttribute="centerX" id="XK7-sC-KU0"/>
+                            <constraint firstAttribute="bottom" secondItem="WEW-3s-kOI" secondAttribute="bottom" id="h2X-Gs-sB2"/>
+                            <constraint firstItem="kLX-yW-lMr" firstAttribute="width" secondItem="iBY-d9-Ye4" secondAttribute="width" id="nmM-Cs-aC6"/>
+                        </constraints>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                <real key="value" value="0.0"/>
+                            </userDefinedRuntimeAttribute>
+                        </userDefinedRuntimeAttributes>
+                    </view>
+                    <connections>
+                        <outlet property="albumContainer" destination="WRD-IZ-JpU" id="tSP-7c-APp"/>
+                        <outlet property="albumTitle" destination="YsV-il-CeR" id="t9S-NX-eaE"/>
+                        <outlet property="albumView" destination="YEF-04-q7Y" id="7tR-Lr-9nh"/>
+                        <outlet property="barButton" destination="Thj-0t-rxK" id="6bX-xo-abt"/>
+                        <outlet property="barTitle" destination="LLe-aQ-Sbj" id="bFR-jT-Xmq"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="GLj-OZ-Cqc" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-1978" y="1477"/>
+        </scene>
+        <!--Schedule-->
+        <scene sceneID="0Lj-Be-Hu6">
+            <objects>
+                <viewController title="Album" id="zJF-Mh-CNb" userLabel="Schedule" customClass="ScheduleViewController" customModule="app" customModuleProvider="target" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="dOJ-i5-gIk"/>
+                        <viewControllerLayoutGuide type="bottom" id="Kp9-sV-JUZ"/>
+                    </layoutGuides>
+                    <view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="8YN-gM-ymv" userLabel="Container">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="P0f-Qc-GSS" userLabel="Toolbar">
+                                <rect key="frame" x="0.0" y="20" width="320" height="29"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cV9-gT-2OC">
+                                        <rect key="frame" x="0.0" y="0.0" width="48" height="29"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                        <state key="normal" title="&lt;">
+                                            <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </state>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gasteizko Margolariak" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RJE-Hu-oDM">
+                                        <rect key="frame" x="48" y="0.0" width="224" height="29"/>
+                                        <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                        <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="RJE-Hu-oDM" firstAttribute="centerX" secondItem="P0f-Qc-GSS" secondAttribute="centerX" id="T6g-du-prz"/>
+                                    <constraint firstItem="cV9-gT-2OC" firstAttribute="leading" secondItem="P0f-Qc-GSS" secondAttribute="leading" id="VGf-cr-zKT"/>
+                                    <constraint firstItem="cV9-gT-2OC" firstAttribute="width" secondItem="P0f-Qc-GSS" secondAttribute="width" multiplier="0.15" id="WCJ-A0-CgT"/>
+                                    <constraint firstItem="RJE-Hu-oDM" firstAttribute="height" secondItem="P0f-Qc-GSS" secondAttribute="height" id="YlB-So-f8f"/>
+                                    <constraint firstItem="RJE-Hu-oDM" firstAttribute="centerY" secondItem="P0f-Qc-GSS" secondAttribute="centerY" id="aES-4b-n3l"/>
+                                    <constraint firstItem="RJE-Hu-oDM" firstAttribute="width" secondItem="P0f-Qc-GSS" secondAttribute="width" multiplier="0.7" id="fKA-UR-a5d"/>
+                                    <constraint firstItem="cV9-gT-2OC" firstAttribute="centerY" secondItem="P0f-Qc-GSS" secondAttribute="centerY" id="j0s-Q2-z7i"/>
+                                    <constraint firstItem="cV9-gT-2OC" firstAttribute="height" secondItem="P0f-Qc-GSS" secondAttribute="height" id="rCF-Un-LBK"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rRo-dr-1GN">
+                                <rect key="frame" x="0.0" y="49" width="320" height="519"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nIg-ez-N2J" userLabel="Section">
+                                        <rect key="frame" x="10" y="10" width="300" height="499"/>
+                                        <subviews>
+                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="Title" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="663-n7-Jwn" userLabel="Title">
+                                                <rect key="frame" x="0.0" y="0.0" width="300" height="30"/>
+                                                <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="30" id="zTh-A8-uDI"/>
+                                                </constraints>
+                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                <nil key="highlightedColor"/>
+                                            </label>
+                                            <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="rYw-pJ-uyq" userLabel="Content">
+                                                <rect key="frame" x="2" y="30" width="296" height="469"/>
+                                                <subviews>
+                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="odg-U1-6cp" userLabel="Calendar">
+                                                        <rect key="frame" x="8" y="8" width="280" height="60"/>
+                                                        <subviews>
+                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ean-uL-e8X">
+                                                                <rect key="frame" x="10" y="7" width="45" height="45"/>
+                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="height" constant="45" id="FCK-N3-WdV"/>
+                                                                    <constraint firstAttribute="width" constant="45" id="czB-hK-gr2"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                                                <state key="normal" title="&lt;">
+                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                </state>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="2"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="4"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </button>
+                                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="25" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EUB-BM-L7c" userLabel="Number">
+                                                                <rect key="frame" x="65" y="8" width="45" height="45"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="width" constant="45" id="0J5-54-fFO"/>
+                                                                    <constraint firstAttribute="height" constant="45" id="bRL-x7-mQS"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="35"/>
+                                                                <nil key="textColor"/>
+                                                                <nil key="highlightedColor"/>
+                                                            </label>
+                                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Agosto" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g7M-sJ-teh" userLabel="Month">
+                                                                <rect key="frame" x="110" y="32.5" width="105" height="20.5"/>
+                                                                <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
+                                                                <nil key="textColor"/>
+                                                                <nil key="highlightedColor"/>
+                                                            </label>
+                                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Margoeguna" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TH3-vv-4wy">
+                                                                <rect key="frame" x="110" y="8" width="115" height="20.5"/>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                                                <nil key="textColor"/>
+                                                                <nil key="highlightedColor"/>
+                                                            </label>
+                                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gEL-Ik-UfU">
+                                                                <rect key="frame" x="225" y="7" width="45" height="45"/>
+                                                                <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                <constraints>
+                                                                    <constraint firstAttribute="width" constant="45" id="0Dv-S2-hPr"/>
+                                                                    <constraint firstAttribute="height" constant="45" id="GXZ-mi-hcs"/>
+                                                                </constraints>
+                                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
+                                                                <state key="normal" title="&gt;">
+                                                                    <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                </state>
+                                                                <userDefinedRuntimeAttributes>
+                                                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                        <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                        <real key="value" value="2"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                    <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                        <real key="value" value="4"/>
+                                                                    </userDefinedRuntimeAttribute>
+                                                                </userDefinedRuntimeAttributes>
+                                                            </button>
+                                                        </subviews>
+                                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <constraints>
+                                                            <constraint firstItem="ean-uL-e8X" firstAttribute="leading" secondItem="odg-U1-6cp" secondAttribute="leading" constant="10" id="2tn-Yg-glj"/>
+                                                            <constraint firstItem="EUB-BM-L7c" firstAttribute="leading" secondItem="ean-uL-e8X" secondAttribute="trailing" constant="10" id="7wi-ei-pIo"/>
+                                                            <constraint firstItem="gEL-Ik-UfU" firstAttribute="centerY" secondItem="odg-U1-6cp" secondAttribute="centerY" id="Drw-jI-c92"/>
+                                                            <constraint firstItem="ean-uL-e8X" firstAttribute="centerY" secondItem="odg-U1-6cp" secondAttribute="centerY" id="FbR-7B-mF9"/>
+                                                            <constraint firstItem="TH3-vv-4wy" firstAttribute="trailing" secondItem="gEL-Ik-UfU" secondAttribute="leading" id="Fwr-5c-qZk"/>
+                                                            <constraint firstItem="g7M-sJ-teh" firstAttribute="leading" secondItem="EUB-BM-L7c" secondAttribute="trailing" id="SDa-kN-y0V"/>
+                                                            <constraint firstItem="g7M-sJ-teh" firstAttribute="bottom" secondItem="EUB-BM-L7c" secondAttribute="bottom" id="ewO-z9-CnW"/>
+                                                            <constraint firstItem="TH3-vv-4wy" firstAttribute="leading" secondItem="EUB-BM-L7c" secondAttribute="trailing" id="exx-HG-g1H"/>
+                                                            <constraint firstItem="TH3-vv-4wy" firstAttribute="top" secondItem="EUB-BM-L7c" secondAttribute="top" id="fjd-hL-ilJ"/>
+                                                            <constraint firstAttribute="trailing" secondItem="gEL-Ik-UfU" secondAttribute="trailing" constant="10" id="lUb-Gk-coy"/>
+                                                            <constraint firstItem="g7M-sJ-teh" firstAttribute="trailing" secondItem="gEL-Ik-UfU" secondAttribute="leading" constant="-10" id="nvO-MM-b9b"/>
+                                                            <constraint firstItem="EUB-BM-L7c" firstAttribute="centerY" secondItem="odg-U1-6cp" secondAttribute="centerY" id="yZR-5M-Qdr"/>
+                                                            <constraint firstAttribute="height" constant="60" id="yfY-8b-HUb"/>
+                                                        </constraints>
+                                                    </view>
+                                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sqf-Nt-Prc" userLabel="Schedule">
+                                                        <rect key="frame" x="8" y="78" width="280" height="383"/>
+                                                        <subviews>
+                                                            <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" bounces="NO" translatesAutoresizingMaskIntoConstraints="NO" id="48Q-LP-YCz">
+                                                                <rect key="frame" x="0.0" y="0.0" width="280" height="383"/>
+                                                                <subviews>
+                                                                    <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="bHp-Km-KNL">
+                                                                        <rect key="frame" x="0.0" y="0.0" width="280" height="383"/>
+                                                                    </stackView>
+                                                                </subviews>
+                                                                <constraints>
+                                                                    <constraint firstItem="bHp-Km-KNL" firstAttribute="centerX" secondItem="48Q-LP-YCz" secondAttribute="centerX" id="VAI-Nn-IAt"/>
+                                                                    <constraint firstItem="bHp-Km-KNL" firstAttribute="width" secondItem="48Q-LP-YCz" secondAttribute="width" id="aBI-FI-uS0"/>
+                                                                    <constraint firstItem="bHp-Km-KNL" firstAttribute="top" secondItem="48Q-LP-YCz" secondAttribute="top" id="eg6-cn-DEy"/>
+                                                                    <constraint firstAttribute="trailing" secondItem="bHp-Km-KNL" secondAttribute="trailing" id="gRo-5O-urs"/>
+                                                                    <constraint firstAttribute="bottom" secondItem="bHp-Km-KNL" secondAttribute="bottom" id="gfj-Ap-09t"/>
+                                                                </constraints>
+                                                            </scrollView>
+                                                        </subviews>
+                                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                        <constraints>
+                                                            <constraint firstItem="48Q-LP-YCz" firstAttribute="centerX" secondItem="Sqf-Nt-Prc" secondAttribute="centerX" id="D5K-ml-TlX"/>
+                                                            <constraint firstAttribute="bottom" secondItem="48Q-LP-YCz" secondAttribute="bottom" id="Hh1-co-5CG"/>
+                                                            <constraint firstItem="48Q-LP-YCz" firstAttribute="top" secondItem="Sqf-Nt-Prc" secondAttribute="top" id="Hkf-Vo-M1V"/>
+                                                            <constraint firstItem="48Q-LP-YCz" firstAttribute="centerY" secondItem="Sqf-Nt-Prc" secondAttribute="centerY" id="tz4-U7-hYk"/>
+                                                            <constraint firstItem="48Q-LP-YCz" firstAttribute="width" secondItem="Sqf-Nt-Prc" secondAttribute="width" id="zUk-4F-sbH"/>
+                                                        </constraints>
+                                                        <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                        <userDefinedRuntimeAttributes>
+                                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                <real key="value" value="1"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                <real key="value" value="3"/>
+                                                            </userDefinedRuntimeAttribute>
+                                                        </userDefinedRuntimeAttributes>
+                                                    </view>
+                                                </subviews>
+                                                <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstItem="Sqf-Nt-Prc" firstAttribute="top" secondItem="odg-U1-6cp" secondAttribute="bottom" constant="10" id="aOG-X0-VZl"/>
+                                                </constraints>
+                                                <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                            </stackView>
+                                        </subviews>
+                                        <color key="backgroundColor" red="0.59607843140000005" green="0.7843137255" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                        <constraints>
+                                            <constraint firstItem="rYw-pJ-uyq" firstAttribute="top" secondItem="663-n7-Jwn" secondAttribute="bottom" id="9Gs-ds-1Kn"/>
+                                            <constraint firstItem="663-n7-Jwn" firstAttribute="width" secondItem="nIg-ez-N2J" secondAttribute="width" id="P66-wF-f9s"/>
+                                            <constraint firstItem="663-n7-Jwn" firstAttribute="centerX" secondItem="nIg-ez-N2J" secondAttribute="centerX" id="WQ9-5d-Emo"/>
+                                            <constraint firstItem="Sqf-Nt-Prc" firstAttribute="width" secondItem="nIg-ez-N2J" secondAttribute="width" constant="-20" id="Z9f-tb-ejn"/>
+                                            <constraint firstItem="663-n7-Jwn" firstAttribute="top" secondItem="nIg-ez-N2J" secondAttribute="top" id="add-lE-oaz"/>
+                                            <constraint firstItem="Sqf-Nt-Prc" firstAttribute="centerX" secondItem="nIg-ez-N2J" secondAttribute="centerX" id="ccQ-Bg-VP2"/>
+                                            <constraint firstItem="rYw-pJ-uyq" firstAttribute="centerX" secondItem="nIg-ez-N2J" secondAttribute="centerX" id="fep-5d-H6q"/>
+                                            <constraint firstAttribute="bottom" secondItem="rYw-pJ-uyq" secondAttribute="bottom" id="uMf-AM-09X"/>
+                                        </constraints>
+                                        <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                        <userDefinedRuntimeAttributes>
+                                            <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                <color key="value" red="0.0" green="0.0" blue="0.066666666669999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                            </userDefinedRuntimeAttribute>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                <real key="value" value="1"/>
+                                            </userDefinedRuntimeAttribute>
+                                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                <real key="value" value="8"/>
+                                            </userDefinedRuntimeAttribute>
+                                        </userDefinedRuntimeAttributes>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <constraints>
+                                    <constraint firstItem="nIg-ez-N2J" firstAttribute="height" secondItem="rRo-dr-1GN" secondAttribute="height" constant="-20" id="2cx-Wp-1D3"/>
+                                    <constraint firstItem="nIg-ez-N2J" firstAttribute="centerY" secondItem="rRo-dr-1GN" secondAttribute="centerY" id="Aow-J2-EtX"/>
+                                    <constraint firstItem="nIg-ez-N2J" firstAttribute="centerX" secondItem="rRo-dr-1GN" secondAttribute="centerX" id="DSh-bL-FaZ"/>
+                                    <constraint firstItem="nIg-ez-N2J" firstAttribute="width" secondItem="rRo-dr-1GN" secondAttribute="width" constant="-20" id="civ-Ll-a7e"/>
+                                </constraints>
+                                <userDefinedRuntimeAttributes>
+                                    <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                        <color key="value" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    </userDefinedRuntimeAttribute>
+                                </userDefinedRuntimeAttributes>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="P0f-Qc-GSS" firstAttribute="width" secondItem="8YN-gM-ymv" secondAttribute="width" id="15Q-4t-71E"/>
+                            <constraint firstItem="rRo-dr-1GN" firstAttribute="top" secondItem="P0f-Qc-GSS" secondAttribute="bottom" id="40K-Ts-eE7"/>
+                            <constraint firstItem="rRo-dr-1GN" firstAttribute="width" secondItem="8YN-gM-ymv" secondAttribute="width" id="Jhr-rW-slc"/>
+                            <constraint firstItem="P0f-Qc-GSS" firstAttribute="top" secondItem="dOJ-i5-gIk" secondAttribute="bottom" id="WaW-Zq-Uf9"/>
+                            <constraint firstItem="P0f-Qc-GSS" firstAttribute="centerX" secondItem="8YN-gM-ymv" secondAttribute="centerX" id="gQv-36-Fxt"/>
+                            <constraint firstAttribute="bottom" secondItem="rRo-dr-1GN" secondAttribute="bottom" id="gzY-Cd-jBQ"/>
+                            <constraint firstItem="rRo-dr-1GN" firstAttribute="centerX" secondItem="8YN-gM-ymv" secondAttribute="centerX" id="yze-m6-yFy"/>
+                        </constraints>
+                        <userDefinedRuntimeAttributes>
+                            <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                <real key="value" value="0.0"/>
+                            </userDefinedRuntimeAttribute>
+                        </userDefinedRuntimeAttributes>
+                    </view>
+                    <connections>
+                        <outlet property="btNext" destination="gEL-Ik-UfU" id="yfe-ny-2eZ"/>
+                        <outlet property="btPrev" destination="ean-uL-e8X" id="8ah-gF-AV8"/>
+                        <outlet property="lbDayMonth" destination="g7M-sJ-teh" id="Wwr-mS-Y3D"/>
+                        <outlet property="lbDayName" destination="TH3-vv-4wy" id="hbO-Yb-NUo"/>
+                        <outlet property="lbDayNumber" destination="EUB-BM-L7c" id="UjL-xN-CcE"/>
+                        <outlet property="svScheduleList" destination="bHp-Km-KNL" id="aSi-lC-w6H"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="rq0-MV-vyl" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-2839" y="1801"/>
+        </scene>
+        <!--Sync-->
+        <scene sceneID="cqg-BI-2xm">
+            <objects>
+                <viewController title="Sync" id="3o1-ab-AT4" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="RYy-ax-Nya"/>
+                        <viewControllerLayoutGuide type="bottom" id="rXD-89-8EQ"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="aKm-vb-AZR">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="dxh-Z0-luU">
+                                <rect key="frame" x="48" y="243" width="224" height="83"/>
+                            </imageView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sincronizando..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="up0-1V-tTd">
+                                <rect key="frame" x="0.0" y="336" width="320" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="mIj-oN-tq7"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="VkR-DT-y3S">
+                                <rect key="frame" x="48" y="376" width="224" height="2"/>
+                            </progressView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Message" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pgU-dx-MvQ">
+                                <rect key="frame" x="48" y="386" width="224" height="18"/>
+                                <fontDescription key="fontDescription" type="italicSystem" pointSize="15"/>
+                                <color key="textColor" red="0.31238102791878175" green="0.31238102791878175" blue="0.31238102791878175" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                        </subviews>
+                        <color key="backgroundColor" red="0.70980392160000005" green="0.82745098039999998" blue="0.8980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="top" secondItem="up0-1V-tTd" secondAttribute="bottom" constant="10" id="2jT-Qj-SnX"/>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="width" secondItem="dxh-Z0-luU" secondAttribute="width" id="5pk-5G-ix0"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="centerX" secondItem="dxh-Z0-luU" secondAttribute="centerX" id="C1h-cG-8Sx"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="centerX" secondItem="VkR-DT-y3S" secondAttribute="centerX" id="QB4-zO-roz"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="width" secondItem="aKm-vb-AZR" secondAttribute="width" multiplier="0.7" id="UXD-fj-qLn"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="centerY" secondItem="aKm-vb-AZR" secondAttribute="centerY" id="aC5-zC-5I4"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="width" secondItem="aKm-vb-AZR" secondAttribute="width" id="c7R-MO-YhC"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="width" secondItem="VkR-DT-y3S" secondAttribute="width" id="dUS-Vx-M16"/>
+                            <constraint firstItem="VkR-DT-y3S" firstAttribute="centerX" secondItem="dxh-Z0-luU" secondAttribute="centerX" id="dfj-BN-WnD"/>
+                            <constraint firstItem="dxh-Z0-luU" firstAttribute="centerX" secondItem="aKm-vb-AZR" secondAttribute="centerX" id="uFb-fC-wRh"/>
+                            <constraint firstItem="up0-1V-tTd" firstAttribute="top" secondItem="dxh-Z0-luU" secondAttribute="bottom" constant="10" id="wY9-12-hcE"/>
+                            <constraint firstItem="pgU-dx-MvQ" firstAttribute="top" secondItem="VkR-DT-y3S" secondAttribute="bottom" constant="8" id="wts-Yk-LsB"/>
+                        </constraints>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="fRm-1Y-Xmm" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+        </scene>
     </scenes>
     </scenes>
+    <resources>
+        <image name="Logo" width="83" height="83"/>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
 </document>
 </document>

+ 177 - 0
app/BlogView.swift

@@ -0,0 +1,177 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class BlogView: UIView {
+	
+	
+	// Outlets
+	@IBOutlet weak var scrollView: UIScrollView!
+	@IBOutlet var container: UIView!
+	@IBOutlet weak var section: Section!
+	
+	var delegate: AppDelegate? = nil
+	var postList: UIStackView? = nil
+	var storyboard: UIStoryboard? = nil
+	var controller: ViewController? = nil
+	var context: NSManagedObjectContext? = nil;
+	var lang: String? = nil
+	
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		NSLog(":BLOG:DEBUG: init (coder).")
+		
+		// Load the contents of the HomeView.xib file.
+		Bundle.main.loadNibNamed("BlogView", owner: self, options: nil)
+		self.addSubview(self.container)
+		self.container.frame = self.bounds
+		self.section.setTitle(text: "Blog")
+		self.postList = self.section.getContentStack()
+		
+		// Get viewController from StoryBoard
+		self.storyboard = UIStoryboard(name: "Main", bundle: nil)
+		self.controller = storyboard?.instantiateViewController(withIdentifier: "GMViewController") as? ViewController
+		self.context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		self.delegate = UIApplication.shared.delegate as? AppDelegate
+		self.lang = getLanguage()
+		self.context?.persistentStoreCoordinator = delegate?.persistentStoreCoordinator
+		
+		populate()
+		
+		NSLog(":BLOG:DEBUG: Finished loading BlogView")
+		
+	}
+	
+	func populate(){
+		let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "dtime", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		
+		do {
+			// Clear the list
+			for v in (self.postList?.subviews)!{
+				v.removeFromSuperview()
+			}
+			
+			// Get the results
+			let searchResults = try self.context?.fetch(fetchRequest)			
+			NSLog(":BLOG:DEBUG: Total posts: \(String(describing: searchResults?.count))")
+			
+			var row : RowBlog
+			var count = 0
+			var id: Int
+			var title: String
+			var text: String
+			var image: String
+			
+			for r in searchResults! {
+				count = count + 1
+				NSLog(":BLOG:DEBUG: Post perm: \(String(describing: r.value(forKey: "permalink")))")
+								
+				//Create a new row
+				row = RowBlog.init(s: "rowBlog\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				title = r.value(forKey: "title_\(lang!)")! as! String
+				text = r.value(forKey: "text_\(lang!)")! as! String
+				row.setTitle(text: title)
+				row.setText(text: text)
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				do{
+					let imgSearchResults = try context?.fetch(imgFetchRequest)
+					for imgR in imgSearchResults!{
+						image = imgR.value(forKey: "image")! as! String
+						NSLog(":BLOG:DEBUG: Image: \(image)")
+						row.setImage(filename: image)
+					}
+				} catch {
+					NSLog(":BLOG:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+				
+				self.postList?.addArrangedSubview(row)
+				//row.setNeedsLayout()
+				//row.layoutIfNeeded()
+				
+				// TODO: Do this on the row didLoad method
+				// Set tap recognizer
+				//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openPost(_:)))
+				//row.isUserInteractionEnabled = true
+				//row.addGestureRecognizer(tapRecognizer)
+				
+				
+				
+			}
+
+			// Trigger a layout update
+			postList?.setNeedsLayout()
+			postList?.layoutIfNeeded()
+
+		} catch {
+			NSLog(":BLOG:ERROR: Error with request: \(error)")
+		}
+		NSLog(":BLOG:DEBUG: Finished populating BlogView")
+	}
+	
+	/*func openPost(){//(_ sender:UITapGestureRecognizer? = nil){
+		print("BLOG:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: 4)
+		print("BLOG:DEBUG: Post should be shown.")
+	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("BLOG:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: 4)
+		print("BLOG:DEBUG: Post should be shown.")
+	}*/
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+}

+ 64 - 0
app/BlogView.xib

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina5_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BlogView" customModule="app">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="Nzq-0W-kDj"/>
+                <outlet property="scrollView" destination="V2d-fd-cjO" id="0Px-EW-La0"/>
+                <outlet property="section" destination="xlt-p5-m6w" id="ITl-k7-X4B"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="Container">
+            <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2d-fd-cjO">
+                    <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
+                    <subviews>
+                        <stackView contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Iqa-PQ-TOo">
+                            <rect key="frame" x="0.0" y="0.0" width="414" height="2200"/>
+                            <subviews>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xlt-p5-m6w" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="414" height="2200"/>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="xlt-p5-m6w" firstAttribute="top" secondItem="Iqa-PQ-TOo" secondAttribute="top" id="ARG-5x-hIU"/>
+                                <constraint firstAttribute="bottom" secondItem="xlt-p5-m6w" secondAttribute="bottom" id="EIU-Wo-4hn"/>
+                                <constraint firstItem="xlt-p5-m6w" firstAttribute="centerX" secondItem="Iqa-PQ-TOo" secondAttribute="centerX" id="cHf-jr-BYh"/>
+                                <constraint firstItem="xlt-p5-m6w" firstAttribute="width" secondItem="Iqa-PQ-TOo" secondAttribute="width" id="i9f-Kl-gsH"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="Iqa-PQ-TOo" firstAttribute="top" secondItem="V2d-fd-cjO" secondAttribute="top" id="JUm-Fl-IMw"/>
+                        <constraint firstItem="Iqa-PQ-TOo" firstAttribute="trailing" secondItem="V2d-fd-cjO" secondAttribute="trailing" id="NAr-lB-8Ty"/>
+                        <constraint firstItem="xlt-p5-m6w" firstAttribute="width" secondItem="V2d-fd-cjO" secondAttribute="width" id="beG-GV-zBi"/>
+                        <constraint firstItem="xlt-p5-m6w" firstAttribute="centerX" secondItem="V2d-fd-cjO" secondAttribute="centerX" id="tjw-ff-7cu"/>
+                        <constraint firstItem="Iqa-PQ-TOo" firstAttribute="leading" secondItem="V2d-fd-cjO" secondAttribute="leading" id="wWa-rA-U3w"/>
+                        <constraint firstAttribute="bottom" secondItem="Iqa-PQ-TOo" secondAttribute="bottom" id="x0w-9j-39f"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="JsC-UU-8eB"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="bBb-zb-kBf"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ddT-DW-Knz"/>
+                <constraint firstItem="Iqa-PQ-TOo" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="iYG-LX-UH4"/>
+                <constraint firstItem="V2d-fd-cjO" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="kdV-ei-kvf"/>
+                <constraint firstItem="Iqa-PQ-TOo" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="uJX-4Y-e2l"/>
+            </constraints>
+            <point key="canvasLocation" x="35.5" y="53.5"/>
+        </view>
+    </objects>
+</document>

+ 187 - 0
app/GalleryView.swift

@@ -0,0 +1,187 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class GalleryView: UIView {
+	
+	// Outlets
+	@IBOutlet var container: UIView!
+	@IBOutlet weak var scrollView: UIScrollView!
+	@IBOutlet weak var section: Section!
+	
+	// App delegate
+	var delegate: AppDelegate? = nil
+	
+	// Section row list
+	var rows: Array<RowGallery> = []
+	
+	/**
+	Run when the view is started.
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		NSLog(":GALLERY:LOG: Init gallery section.")
+		
+		//Load the contents of the HomeView.xib file.
+		Bundle.main.loadNibNamed("GalleryView", owner: self, options: nil)
+		self.addSubview(container)
+		container.frame = self.bounds
+		section.setTitle(text: "Gallery")
+		let parent = section.getContentStack()
+		
+		// Get viewController from StoryBoard
+		let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
+		let controller = storyboard.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
+		
+		// Show albums
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		self.delegate = appDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Album> = Album.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "time", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		
+		do {
+			//Get the results
+			let searchResults = try context.fetch(fetchRequest)
+
+			var row : RowGallery
+			var count = 0
+			var id: Int
+			var title: String
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				
+				//Create a new row
+				row = RowGallery.init(s: "rowGallery\(count)", i: count)
+				id = r.value(forKey: "id")! as! Int
+				
+				title = r.value(forKey: "title_\(lang)")! as! String
+				row.id = id
+				row.setTitle(text: title)
+				
+				// Get 4 random images from the album
+				let imgFetchRequest: NSFetchRequest<Photo_album> = Photo_album.fetchRequest()
+				// TODO Order random
+				//let imgSortDescriptor = NSSortDescriptor(key: "time", ascending: true)
+				//let imgSortDescriptors = [imgSortDescriptor]
+				//simgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "album == %i", id)
+				imgFetchRequest.fetchLimit = 4
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					
+					// Loop images
+					var imageIdx = 0
+					for imgR in imgSearchResults as [NSManagedObject]{
+						
+						let imageId = imgR.value(forKey: "photo")! as! Int
+						
+						// For each image, I need a new query to fetch from photo entity.
+						let singleImgFetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+						singleImgFetchRequest.predicate = NSPredicate(format: "id == %i", imageId)
+						singleImgFetchRequest.fetchLimit = 4
+						do{
+							let singleImgSearchResults = try context.fetch(singleImgFetchRequest)
+							
+							// Loop image
+							for sImgR in singleImgSearchResults as [NSManagedObject]{
+						
+								let image = sImgR.value(forKey: "file")! as! String
+								row.setImage(idx: imageIdx, filename: image)
+							}
+							imageIdx = imageIdx + 1
+						}
+						catch {
+							NSLog(":GALLERY:ERROR: Error getting image from photo entity: \(error)")
+						}
+					}
+				} catch {
+					NSLog(":GALLERY:ERROR: Error getting image for album \(id): \(error)")
+				}
+				
+				parent.addArrangedSubview(row)
+				
+				// Add to the rows array
+				self.rows.append(row)
+				
+				
+				
+			}
+		} catch {
+			NSLog(":GALLERY:ERROR: Error with request: \(error)")
+		}
+		
+		//Always at the end: update scrollview
+		var h: Int = 0
+		for view in scrollView.subviews {
+			//contentRect = contentRect.union(view.frame);
+			h = h + Int(view.frame.height) + 30 //Why 30?
+		}
+		// TODO: Calculate at the end
+		self.scrollView.contentSize.height = 2500//CGFloat(h);
+		
+		self.setUpRowsTapRecognizers()
+		NSLog(":GALLERY:LOG: Finished loading gallery section.")
+	}
+	
+	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
+		let id = (sender?.view as! RowGallery).id
+		NSLog(":GALLERY:DEBUG: getting delegate and showing album \(id).")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showAlbum(id: id)
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+	func setUpRowsTapRecognizers(){
+		NSLog(":GALLERY:DEBUG: Setting up tap recognizers")
+		for row in self.rows{
+			let tapRecognizer = UITapGestureRecognizer(target: row, action: #selector(openAlbum(_:)))
+			row.isUserInteractionEnabled = true
+			container.addGestureRecognizer(tapRecognizer)
+		}
+	}
+}

+ 63 - 0
app/GalleryView.xib

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GalleryView" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="75N-Q5-bZw"/>
+                <outlet property="scrollView" destination="aoy-Mh-gpR" id="6fj-Cm-cse"/>
+                <outlet property="section" destination="3TY-0K-6q1" id="bqj-sb-ZO2"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-Mh-gpR">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="ULw-PH-L95">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="3000"/>
+                            <subviews>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3TY-0K-6q1" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="3000"/>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="3TY-0K-6q1" firstAttribute="top" secondItem="ULw-PH-L95" secondAttribute="top" id="0GM-gA-76X"/>
+                                <constraint firstItem="3TY-0K-6q1" firstAttribute="width" secondItem="ULw-PH-L95" secondAttribute="width" id="fZS-cn-vrg"/>
+                                <constraint firstAttribute="bottom" secondItem="3TY-0K-6q1" secondAttribute="bottom" id="n9J-oi-jRF"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="ULw-PH-L95" secondAttribute="trailing" id="FEV-qn-MAO"/>
+                        <constraint firstItem="ULw-PH-L95" firstAttribute="leading" secondItem="aoy-Mh-gpR" secondAttribute="leading" id="LOc-iu-RwK"/>
+                        <constraint firstItem="ULw-PH-L95" firstAttribute="top" secondItem="aoy-Mh-gpR" secondAttribute="top" id="tCz-sX-2pl"/>
+                        <constraint firstAttribute="bottom" secondItem="ULw-PH-L95" secondAttribute="bottom" id="wJq-aC-CNc"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="1sn-WI-SeL"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="53f-dW-QfI"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="JAc-a5-eSB"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="KbH-35-FjR"/>
+                <constraint firstItem="ULw-PH-L95" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Pmm-8v-Nel"/>
+                <constraint firstItem="3TY-0K-6q1" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="SuI-4Q-EhS"/>
+                <constraint firstItem="aoy-Mh-gpR" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="ftc-db-cKU"/>
+                <constraint firstItem="3TY-0K-6q1" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="uuX-zc-aKY"/>
+                <constraint firstItem="ULw-PH-L95" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="xne-RG-cs4"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 89 - 23
app/HomeView.swift

@@ -40,6 +40,10 @@ class HomeView: UIView {
 	@IBOutlet weak var gallerySection: Section!
 	@IBOutlet weak var gallerySection: Section!
 	@IBOutlet weak var pastActivitiesSection: Section!
 	@IBOutlet weak var pastActivitiesSection: Section!
 	@IBOutlet weak var socialSection: Section!
 	@IBOutlet weak var socialSection: Section!
+
+	var lang: String? = nil
+	var moc: NSManagedObjectContext? = nil
+	var appDelegate: AppDelegate? = nil
 	
 	
 	override init(frame: CGRect){
 	override init(frame: CGRect){
 		super.init(frame: frame)
 		super.init(frame: frame)
@@ -58,7 +62,6 @@ class HomeView: UIView {
 		container.frame = self.bounds
 		container.frame = self.bounds
 		
 		
 
 
-		
 		//Set titles for each section
 		//Set titles for each section
 		locationSection.setTitle(text: "Encuentranos")
 		locationSection.setTitle(text: "Encuentranos")
 		lablancaSection.setTitle(text: "La Blanca")
 		lablancaSection.setTitle(text: "La Blanca")
@@ -69,30 +72,38 @@ class HomeView: UIView {
 		socialSection.setTitle(text: "Siguenos")
 		socialSection.setTitle(text: "Siguenos")
 		
 		
 		//Get info to populate sections
 		//Get info to populate sections
-		let moc = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
-		
-		let appDelegate = UIApplication.shared.delegate as! AppDelegate
-		moc.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
-		let lang : String = getLanguage()
+		self.moc = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		self.appDelegate = UIApplication.shared.delegate as! AppDelegate
+		self.moc?.persistentStoreCoordinator = appDelegate?.persistentStoreCoordinator
+		self.lang = getLanguage()
 		
 		
 		//Populate sections
 		//Populate sections
-		setUpPastActivities(context: moc, delegate: appDelegate, lang: lang, parent: pastActivitiesSection.getContentStack())
-		setUpBlog(context: moc, delegate: appDelegate, lang: lang, parent: blogSection.getContentStack())
-		setUpFutureActivities(context: moc, delegate: appDelegate, lang: lang, parent: futureActivitiesSection.getContentStack())
-		setUpSocial(parent: socialSection.getContentStack())
+		self.populate()
 		
 		
 		
 		
-		pastActivitiesSection.expandSection()
-		
 		//Always at the end: update scrollview
 		//Always at the end: update scrollview
-		var h: Int = 0
-		for view in scrollView.subviews {
-			//contentRect = contentRect.union(view.frame);
-			h = h + Int(view.frame.height) + 30 //Why 30?
-			print("curh: \(h)")
-		}
+		//var h: Int = 0
+		//for view in scrollView.subviews {
+		//	//contentRect = contentRect.union(view.frame);
+		//	h = h + Int(view.frame.height) + 30 //Why 30?
+		//	print("curh: \(h)")
+		//}
 		// TODO: Calculate at the end
 		// TODO: Calculate at the end
-		self.scrollView.contentSize.height = 1300// CGFloat(h);
+		//self.scrollView.contentSize.height = 1300// CGFloat(h);
+	}
+
+	/**
+	 Triggers a reloading (or initial loading) of all sections.
+	*/
+	func populate(){
+		
+		//Populate sections
+		self.setUpPastActivities(context: self.moc!, delegate: appDelegate!, lang: self.lang!, parent: self.pastActivitiesSection.getContentStack())
+		self.setUpBlog(context: self.moc!, delegate: self.appDelegate!, lang: self.lang!, parent: self.blogSection.getContentStack())
+		self.setUpFutureActivities(context: self.moc!, delegate: self.appDelegate!, lang: self.lang!, parent: self.futureActivitiesSection.getContentStack())
+		self.setUpSocial(parent: self.socialSection.getContentStack())
+		self.setUpGallery(context: self.moc!, delegate: self.appDelegate!, parent: self.gallerySection.getContentStack())
+		self.pastActivitiesSection.expandSection()
 	}
 	}
 	
 	
 	func getLanguage() -> String{
 	func getLanguage() -> String{
@@ -190,7 +201,7 @@ class HomeView: UIView {
 			//I like to check the size of the returned results!
 			//I like to check the size of the returned results!
 			print ("Post: \(searchResults.count)")
 			print ("Post: \(searchResults.count)")
 			
 			
-			var row : RowHomePastActivities
+			var row : RowHomeBlog
 			var count = 0
 			var count = 0
 			var id: Int
 			var id: Int
 			var title: String
 			var title: String
@@ -205,11 +216,12 @@ class HomeView: UIView {
 				
 				
 				
 				
 				//Create a new row
 				//Create a new row
-				row = RowHomePastActivities.init(s: "rowHomeBlog\(count)", i: count)
+				row = RowHomeBlog.init(s: "rowHomeBlog\(count)", i: count)
 				id = r.value(forKey: "id")! as! Int
 				id = r.value(forKey: "id")! as! Int
 				title = r.value(forKey: "title_\(lang)")! as! String
 				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
-				print(title)
+				
+				row.id = id
 				row.setTitle(text: title)
 				row.setTitle(text: title)
 				row.setText(text: text)
 				row.setText(text: text)
 				
 				
@@ -236,6 +248,10 @@ class HomeView: UIView {
 				
 				
 				parent.addArrangedSubview(row)
 				parent.addArrangedSubview(row)
 				
 				
+				let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openPost(_:)))
+				row.isUserInteractionEnabled = true
+				row.addGestureRecognizer(tapRecognizer)
+				
 			}
 			}
 		} catch {
 		} catch {
 			print("Error with request: \(error)")
 			print("Error with request: \(error)")
@@ -278,7 +294,8 @@ class HomeView: UIView {
 				id = r.value(forKey: "id")! as! Int
 				id = r.value(forKey: "id")! as! Int
 				title = r.value(forKey: "title_\(lang)")! as! String
 				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
-				print(title)
+				
+				
 				row.setTitle(text: title)
 				row.setTitle(text: title)
 				row.setText(text: text)
 				row.setText(text: text)
 				
 				
@@ -311,6 +328,48 @@ class HomeView: UIView {
 		}
 		}
 	}
 	}
 	
 	
+	func setUpGallery(context : NSManagedObjectContext, delegate: AppDelegate,parent: UIStackView){
+		print("HOME:LOG: Setting up gallery.")
+		
+		// Create the row
+		var row: RowHomeGallery
+		row = RowHomeGallery.init(s: "rowHomeGallery", i: 0)
+		parent.addArrangedSubview(row)
+		
+		
+		// Set images
+		let fetchRequest: NSFetchRequest<Photo> = Photo.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "uploaded", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		fetchRequest.sortDescriptors = sortDescriptors
+		fetchRequest.fetchLimit = 4
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+	
+			var id: Int
+			var image: String
+			
+			// Loop images
+			var i = 0
+			for r in searchResults as [NSManagedObject] {
+				
+				image = r.value(forKey: "file")! as! String
+				row.setImage(idx: i, filename: image)
+				
+				//TODO Set click listener
+				
+				i = i + 1
+			}
+			
+		}
+		catch{
+			print("HOME:ERROR: Error setting gallery up: \(error)")
+		}
+		
+	}
+	
 	func setUpSocial(parent : UIStackView){
 	func setUpSocial(parent : UIStackView){
 		print("SETING UP SOCIAL")
 		print("SETING UP SOCIAL")
 		//Create a new row
 		//Create a new row
@@ -319,4 +378,11 @@ class HomeView: UIView {
 		print("ROW CREATED")
 		print("ROW CREATED")
 		parent.addArrangedSubview(row)
 		parent.addArrangedSubview(row)
 	}
 	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("HOME:DEBUG: getting delegate and showing post.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showPost(id: (sender?.view as! RowHomeBlog).id)
+		print("HOME:DEBUG: Post should be shown.")
+	}
 }
 }

+ 18 - 18
app/HomeView.xib

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina3_5" orientation="portrait">
     <device id="retina3_5" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
@@ -27,37 +27,37 @@
             <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
             <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
             <subviews>
-                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-ba-9jX">
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-ba-9jX">
                     <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
                     <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
                     <subviews>
                     <subviews>
-                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="gOz-rr-CeQ">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+                        <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" axis="vertical" alignment="center" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="gOz-rr-CeQ">
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="780"/>
                             <subviews>
                             <subviews>
-                                <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="60" width="320" height="50"/>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="120" width="320" height="50"/>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="0.0"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="180" width="320" height="50"/>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="10"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
+                                    <rect key="frame" x="0.0" y="240" width="320" height="50"/>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="10" width="320" height="350"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="300" width="320" height="350"/>
                                     <userDefinedRuntimeAttributes>
                                     <userDefinedRuntimeAttributes>
                                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                                             <real key="value" value="0.0"/>
                                             <real key="value" value="0.0"/>
                                         </userDefinedRuntimeAttribute>
                                         </userDefinedRuntimeAttribute>
                                     </userDefinedRuntimeAttributes>
                                     </userDefinedRuntimeAttributes>
                                 </view>
                                 </view>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="360" width="320" height="120"/>
+                                <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app">
+                                    <rect key="frame" x="0.0" y="660" width="320" height="120"/>
                                 </view>
                                 </view>
                             </subviews>
                             </subviews>
                             <color key="backgroundColor" red="1" green="1" blue="0.42787000868055558" alpha="1" colorSpace="calibratedRGB"/>
                             <color key="backgroundColor" red="1" green="1" blue="0.42787000868055558" alpha="1" colorSpace="calibratedRGB"/>

+ 2 - 2
app/Info.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
+	<string>0.0.3</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>1</string>
+	<string>4</string>
 	<key>LSRequiresIPhoneOS</key>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<true/>
 	<key>UILaunchStoryboardName</key>
 	<key>UILaunchStoryboardName</key>

+ 210 - 0
app/LablancaView.swift

@@ -0,0 +1,210 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import CoreData
+import UIKit
+/**
+Class to handle the home view.
+*/
+class LablancaView: UIView {
+
+	@IBOutlet var container: UIView!			// Top container of the view.
+	@IBOutlet weak var nfWindow: UIView!		// The section to show when no festivals.
+	@IBOutlet weak var fWindow: UIView!			// The window to show while the festivals.
+	@IBOutlet weak var fTitle: UILabel!			// The title of the year festivals.
+	@IBOutlet weak var fImage: UIImageView!		// The festivals image
+	@IBOutlet weak var fText: UILabel!			// The festivals description.
+	@IBOutlet weak var fBtSchedule: UIButton!	// Button to show the city schedule.
+	@IBOutlet weak var fBtGMSchedule: UIButton!	// Button to show the Margolari schedule
+	@IBOutlet weak var fOfferList: UIStackView!	// Stack view to hold the offer list.
+	@IBOutlet weak var fDayList: UIStackView!	// Stack view to hold the single days price list.
+	
+	
+	
+	// App delegate
+	var delegate: AppDelegate? = nil
+	
+	// Section row list
+	//var rows: Array<RowGallery> = []
+	
+	/**
+	Run when the view is started.
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Run when the view is started.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		
+		super.init(coder: aDecoder)
+		
+		NSLog(":LABLANCA:LOG: Init lablanca section.")
+
+		Bundle.main.loadNibNamed("LablancaView", owner: self, options: nil)
+		self.addSubview(container)
+		container.frame = self.bounds
+		
+		// Get viewController from StoryBoard
+		let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
+		let controller = storyboard.instantiateViewController(withIdentifier: "GMViewController") as! ViewController
+		
+		// Read settings and show the required sections
+		let defaults = UserDefaults.standard
+		let festivals: Int = 1 //TODO defaults.integer(forKey: "festivals")
+		
+		if festivals == 1{
+			showFestivals()
+		}
+		else{
+			showNoFestivals()
+		}
+	}
+	
+	func showFestivals(){
+		NSLog(":LABLANCA:LOG: Showing festivals section.")
+		self.nfWindow.isHidden = true
+		
+		// TODO: Get current year
+		let year = 2016
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		// Get info about festivals
+		let fetchRequest: NSFetchRequest<Festival> = Festival.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "year = %i", year)
+		
+		do {
+			
+			// Get info from festivals
+			let searchResults = try context.fetch(fetchRequest)
+			
+			if searchResults.count > 0 {
+				let r = searchResults[0]
+			
+				// Set description
+				self.fText.text = r.value(forKey: "text_\(lang)") as! String?
+			}
+
+		} catch {
+			NSLog(":LABLANCA:ERROR: Error getting festivals info: \(error)")
+		}
+		
+		// Set up schedule buttons
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(openSchedule(_:)))
+		fBtSchedule.isUserInteractionEnabled = true
+		fBtSchedule.addGestureRecognizer(tapRecognizer)
+		
+		
+		// Get info about the day prices.
+		let dateFormatter = DateFormatter()
+		dateFormatter.dateFormat = "yyyy-MM-dd"
+		dateFormatter.locale = Locale.init(identifier: "en_GB")
+		
+		// First date of year
+		var dateString = "\(year)-01-01"
+		let sDate = dateFormatter.date(from: dateString)
+		
+		// Last date of year
+		dateString = "\(year)-12-31"
+		let eDate = dateFormatter.date(from: dateString)
+		
+		// Get days
+		let dayFetchRequest: NSFetchRequest<Festival_day> = Festival_day.fetchRequest()
+		dayFetchRequest.predicate = NSPredicate(format: "(date >= %@) AND (date <= %@)", argumentArray: [sDate, eDate])
+		
+		do {
+			
+			// Get info from festivals
+			let daySearchResults = try context.fetch(dayFetchRequest)
+			
+			var row: RowLablancaDay
+			var count: Int = 0
+			
+			for day in daySearchResults as [NSManagedObject]{
+				
+				let date: NSDate = day.value(forKey: "date")! as! NSDate
+				let dateString: String = dateFormatter.string(from: date as Date)
+				let nDay: String = dateString.subStr(start: 8, end: 9)
+				let month: String = dateString.subStr(start: 5, end: 6)
+				var nMonth: String = "Agosto" // TODO: Reference
+				if month == "07"{
+					nMonth = "Julio" // TODO: Reference
+				}
+				let name: String = day.value(forKey: "name_\(lang)")! as! String
+				let price: Int = day.value(forKey: "price")! as! Int
+				
+				// Create the row and set data.
+				row = RowLablancaDay.init(s: "rowLablancaDay\(count)", i: count)
+				row.name.text = name
+				row.price.text = "\(price) €"
+				row.number.text = "\(Int(nDay)!)"
+				row.month.text = nMonth
+				
+				// Add the row
+				fDayList.addArrangedSubview(row)
+				row.setNeedsLayout()
+				row.layoutIfNeeded()
+				
+				// Hide the separator of the last row
+				if count == daySearchResults.count - 1 {
+					row.separator.isHidden = true
+				}
+				
+				count = count + 1
+			}
+			
+		} catch {
+			NSLog(":LABLANCA:ERROR: Error getting festival days info: \(error)")
+		}
+		
+		
+		
+	}
+	
+	func showNoFestivals(){
+		NSLog(":LABLANCA:LOG: Showing no festivals section.")
+		self.fWindow.isHidden = true
+		// Nothing else to be done.
+	}
+	
+	func openSchedule(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":LABLANCA:DEBUG: Getting delegate and showing schedule.")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showSchedule(margolari: false)
+		NSLog(":LABLANCA:DEBUG: Schedule should be shown.")
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+}

+ 407 - 0
app/LablancaView.xib

@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LablancaView" customModule="app">
+            <connections>
+                <outlet property="container" destination="iN0-l3-epB" id="ST9-WZ-eac"/>
+                <outlet property="fBtGMSchedule" destination="sX5-OY-Jg0" id="mdf-kv-Msn"/>
+                <outlet property="fBtSchedule" destination="LqL-cc-rQ7" id="Vtj-4O-mS4"/>
+                <outlet property="fDayList" destination="qKn-wk-VDT" id="Eb2-oe-9fR"/>
+                <outlet property="fImage" destination="61f-V8-Jtw" id="UNp-gk-xTb"/>
+                <outlet property="fOfferList" destination="rcX-IS-Hmj" id="Y1a-Rq-6n2"/>
+                <outlet property="fText" destination="tlF-oW-fKA" id="LNb-2w-WMR"/>
+                <outlet property="fTitle" destination="Uf0-CR-dfk" id="uQa-yj-CK7"/>
+                <outlet property="fWindow" destination="O30-vI-Tga" id="I1G-s6-BsO"/>
+                <outlet property="nfWindow" destination="ANk-4K-DBn" id="Orc-2Z-DU4"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tXE-yu-DoB">
+                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                    <subviews>
+                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="onh-i9-8Tz">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="1255.5"/>
+                            <subviews>
+                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1tl-Rf-vmM">
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="1255.5"/>
+                                    <subviews>
+                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ANk-4K-DBn" userLabel="NoFestivals">
+                                            <rect key="frame" x="10" y="10" width="355" height="1235.5"/>
+                                            <subviews>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="NFTitle" text="NoFestivals" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rbu-EN-1UC" userLabel="NFTitle">
+                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="30" id="Go6-nx-Txf"/>
+                                                    </constraints>
+                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="61P-J5-lJc">
+                                                    <rect key="frame" x="0.0" y="30" width="355" height="1205.5"/>
+                                                    <subviews>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fMm-Rh-0GJ">
+                                                            <rect key="frame" x="0.0" y="0.0" width="355" height="1205.5"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JSe-pA-fF3" userLabel="NFText">
+                                                                    <rect key="frame" x="8" y="8" width="339" height="1189.5"/>
+                                                                    <string key="text">Las Fiestas de La Blanca. Esos días, del 4 al 9 de agosto, en los que Vitoria-Gasteiz se transforma. Se llena de color y alegría, y en cada esquina puedes encontrar actividades y espectáculos.
+
+Nosotros, como cuadrilla de Blusas y Nescas, ya estamos trabajando en ello. Tan pronto como vayamos sabiendo más, aquí iremos publicando nuestro programa y otra información sobre las fiestas.
+
+Para ir abriendo boca, dejanos contarte algunas de las claves del plan Margolari de fiestas:
+Planes que se adaptan a tí: Puedes apuntarte días sueltos, o elegir entre las varias ofertas por varios días para conseguir descuentos.
+Dormir es de cobardes: Casi todos los días organizamos actividades desde la mañana, ya sean almuerzos, actividades para el público general o competiciones en los Herri Kirolak. Después solemos ir a comer juntos, antes de los paseillos, y después, siempre cenamos juntos. Y por la noche, hasta que el cuerpo aguante!
+Especialistas en paseillos: A la hora de hacer paseillos, no hay quien nos gane. Con nuestra furgoneta siempre abierta a la cabeza, y la txaranga El Postín animando desde atrás, es imposible aburrirse. Y entre paseillos tampoco descansamos, siempre estamos organizando cosas: juegos, carreras, bingos, música, ida a las barracas...
+Nos gusta comer: No queremos que un Margolari pase hambre. Las comidas en Gasteizko Margolariak son en restaurante, con un buen menú, que nos den fuerzas para aguantar el resto del día. Las cenas las hacemos bien en la calle o bien en restaurante, pero siempre con comida buena y caliente. Los mismo que los almuerzos.
+Y beber: Sea cual sea tu veneno, lo tenemos: Ron, vodka, kalimotxo, cerveza, whiskey, agua, refrescos... Durante los paseillos (y varias veces más a lo largo del día) en la furgoneta tendrás barra libre de todo lo que quieras.
+Nos apuntamos a un bombardeo: Carrera de Barricas, Herri Kirolak... Nunca hemos faltado a nada. Ganar, lo que es ganar, aún lo tenemos pendiente, pero lo pasamos bien. Así que ya sabes, si quieres representar a Gasteizko Margolariak, avísanos!
+Por la ciudad, para la ciudad: No nos gusta mirarnos el ombligo. Aunque la mayor parte de actividades que organizamos son para los miembros de Gasteizko Margolariak, hay otras que son para todo el público. Hasta ahora hemos organizado talleres de Cesta Punta para txikis, Margotxef (un concurso de cocina infantil), visitas a residencias de ancianos...
+Margolaris: Todo lo demás no sirve de nada si en una cuadrilla no hay buen ambiente. En Gasteizko Margolariak podemos presumir de gente cercana, participativa, capaz de hacer que desde el primer día ya te sientas como en casa. Además, los organizadores son gente cercana, que escucha y está siempre abierta a nuevas propuestas. Por esto, quien prueba, repite.</string>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="width" secondItem="fMm-Rh-0GJ" secondAttribute="width" constant="-16" id="0CL-R7-7P2"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="centerY" secondItem="fMm-Rh-0GJ" secondAttribute="centerY" id="Q89-f8-aOO"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="centerX" secondItem="fMm-Rh-0GJ" secondAttribute="centerX" id="bWM-TD-7eg"/>
+                                                                <constraint firstItem="JSe-pA-fF3" firstAttribute="height" secondItem="fMm-Rh-0GJ" secondAttribute="height" constant="-16" id="v8i-dq-nKb"/>
+                                                            </constraints>
+                                                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                                                        </view>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="width" secondItem="61P-J5-lJc" secondAttribute="width" id="1cf-fJ-wVQ"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="height" secondItem="61P-J5-lJc" secondAttribute="height" id="TW5-ca-9gB"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="centerY" secondItem="61P-J5-lJc" secondAttribute="centerY" id="bNf-OB-OIC"/>
+                                                        <constraint firstItem="fMm-Rh-0GJ" firstAttribute="centerX" secondItem="61P-J5-lJc" secondAttribute="centerX" id="fUF-Fq-9fs"/>
+                                                    </constraints>
+                                                </stackView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="0.59607843137254901" green="0.78431372549019607" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                            <constraints>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="width" secondItem="ANk-4K-DBn" secondAttribute="width" id="2rM-dk-8qK"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="top" secondItem="rbu-EN-1UC" secondAttribute="bottom" id="8zQ-01-cy2"/>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="top" secondItem="ANk-4K-DBn" secondAttribute="top" id="EtJ-4V-V4H"/>
+                                                <constraint firstAttribute="bottom" secondItem="61P-J5-lJc" secondAttribute="bottom" id="H19-rV-6q8"/>
+                                                <constraint firstItem="rbu-EN-1UC" firstAttribute="centerX" secondItem="ANk-4K-DBn" secondAttribute="centerX" id="YlB-Dt-nSZ"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="width" secondItem="ANk-4K-DBn" secondAttribute="width" id="c8o-RP-PLt"/>
+                                                <constraint firstItem="61P-J5-lJc" firstAttribute="centerX" secondItem="ANk-4K-DBn" secondAttribute="centerX" id="xOL-wr-htu"/>
+                                            </constraints>
+                                            <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                            <userDefinedRuntimeAttributes>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                    <integer key="value" value="8"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                    <real key="value" value="1"/>
+                                                </userDefinedRuntimeAttribute>
+                                            </userDefinedRuntimeAttributes>
+                                        </view>
+                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O30-vI-Tga" userLabel="Festivals">
+                                            <rect key="frame" x="10" y="10" width="355" height="1235.5"/>
+                                            <subviews>
+                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="zWn-KM-9py">
+                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="1235.5"/>
+                                                    <subviews>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Trj-oS-RaI" userLabel="FestivalsIntro">
+                                                            <rect key="frame" x="0.0" y="0.0" width="355" height="300"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="FTitle" text="Festivals" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uf0-CR-dfk" userLabel="FTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="sgD-kx-5ct"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="61f-V8-Jtw">
+                                                                    <rect key="frame" x="54" y="40" width="248" height="128"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="128" id="V4f-jX-8vE"/>
+                                                                    </constraints>
+                                                                </imageView>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tlF-oW-fKA">
+                                                                    <rect key="frame" x="8" y="178" width="339" height="122"/>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="5O9-6v-OI1"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="Bcv-eN-x8B"/>
+                                                                <constraint firstAttribute="bottom" secondItem="tlF-oW-fKA" secondAttribute="bottom" id="EHV-kx-BN2"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="top" secondItem="Uf0-CR-dfk" secondAttribute="bottom" constant="10" id="GQH-En-4OI"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" constant="-16" id="JA6-j0-5rF"/>
+                                                                <constraint firstAttribute="height" constant="300" id="JPq-O2-Eee"/>
+                                                                <constraint firstItem="tlF-oW-fKA" firstAttribute="top" secondItem="61f-V8-Jtw" secondAttribute="bottom" constant="10" id="JyT-sH-rLA"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="centerX" secondItem="Trj-oS-RaI" secondAttribute="centerX" id="MPp-Uj-J5D"/>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" id="hig-ZM-Oul"/>
+                                                                <constraint firstItem="61f-V8-Jtw" firstAttribute="width" secondItem="Trj-oS-RaI" secondAttribute="width" multiplier="0.7" id="kTa-D1-266"/>
+                                                                <constraint firstItem="Uf0-CR-dfk" firstAttribute="top" secondItem="Trj-oS-RaI" secondAttribute="top" id="ljp-1E-Lap"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Et3-gn-ciE" userLabel="FestivalsButtons">
+                                                            <rect key="frame" x="0.0" y="310" width="355" height="90"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="FesivalsButtonTitle" text=" Programas de Fiestas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="w8k-rj-iYK" userLabel="FesivalsButtonTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="jb7-xf-xmS"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LqL-cc-rQ7" userLabel="BtSchedule">
+                                                                    <rect key="frame" x="10" y="40" width="162.5" height="40"/>
+                                                                    <color key="backgroundColor" red="0.070588235294117646" green="0.27058823529411763" blue="0.40392156862745099" alpha="1" colorSpace="calibratedRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="40" id="K47-KO-8oN"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
+                                                                    <state key="normal" title="Programa de fiestas">
+                                                                        <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    </state>
+                                                                    <userDefinedRuntimeAttributes>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                            <real key="value" value="2"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                            <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                            <real key="value" value="4"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                    </userDefinedRuntimeAttributes>
+                                                                </button>
+                                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sX5-OY-Jg0" userLabel="BtGMSchedule">
+                                                                    <rect key="frame" x="182.5" y="40" width="162.5" height="40"/>
+                                                                    <color key="backgroundColor" red="0.070588235289999995" green="0.27058823529999998" blue="0.4039215686" alpha="1" colorSpace="calibratedRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="40" id="4YB-v3-Cwb"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
+                                                                    <state key="normal" title="Programa Margolari">
+                                                                        <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    </state>
+                                                                    <userDefinedRuntimeAttributes>
+                                                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                            <color key="value" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                            <real key="value" value="2"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                            <real key="value" value="4"/>
+                                                                        </userDefinedRuntimeAttribute>
+                                                                    </userDefinedRuntimeAttributes>
+                                                                </button>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="trailing" secondItem="sX5-OY-Jg0" secondAttribute="trailing" constant="10" id="4ZI-Ic-udM"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="top" secondItem="w8k-rj-iYK" secondAttribute="bottom" constant="10" id="6U5-ki-vCh"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="top" secondItem="Et3-gn-ciE" secondAttribute="top" id="Eor-ww-lgP"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" id="JWv-RV-UNi"/>
+                                                                <constraint firstItem="w8k-rj-iYK" firstAttribute="centerX" secondItem="Et3-gn-ciE" secondAttribute="centerX" id="SFa-f4-np8"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="leading" secondItem="Et3-gn-ciE" secondAttribute="leading" constant="10" id="Sju-dg-kBM"/>
+                                                                <constraint firstItem="sX5-OY-Jg0" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" multiplier="0.5" constant="-15" id="mRb-Ng-Lhq"/>
+                                                                <constraint firstItem="LqL-cc-rQ7" firstAttribute="width" secondItem="Et3-gn-ciE" secondAttribute="width" multiplier="0.5" constant="-15" id="p0W-yy-k4Z"/>
+                                                                <constraint firstItem="sX5-OY-Jg0" firstAttribute="top" secondItem="w8k-rj-iYK" secondAttribute="bottom" constant="10" id="vP0-hV-IAL"/>
+                                                                <constraint firstAttribute="bottom" secondItem="LqL-cc-rQ7" secondAttribute="bottom" constant="10" id="yFw-lf-zhl"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="feb-ob-HAK" userLabel="FestivalsPrices">
+                                                            <rect key="frame" x="0.0" y="410" width="355" height="825.5"/>
+                                                            <subviews>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Programas de Fiestas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="swA-jU-3wo" userLabel="FesivalsPricesTitle">
+                                                                    <rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
+                                                                    <color key="backgroundColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="30" id="chr-L8-aT9"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
+                                                                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ofertas" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uns-Lv-yfZ">
+                                                                    <rect key="frame" x="8" y="40" width="339" height="20"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="20" id="lCP-xA-gT6"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="rcX-IS-Hmj" userLabel="StackOffers">
+                                                                    <rect key="frame" x="13" y="70" width="330" height="200"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="200" id="YNZ-ap-Ful"/>
+                                                                    </constraints>
+                                                                </stackView>
+                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Dias sueltos" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xp7-EC-6OW">
+                                                                    <rect key="frame" x="8" y="285" width="339" height="20.5"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="20" id="Ecc-N8-k3S"/>
+                                                                    </constraints>
+                                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                                    <nil key="textColor"/>
+                                                                    <nil key="highlightedColor"/>
+                                                                </label>
+                                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="qKn-wk-VDT" userLabel="StackDays">
+                                                                    <rect key="frame" x="12.5" y="315.5" width="330" height="510"/>
+                                                                    <constraints>
+                                                                        <constraint firstAttribute="height" constant="510" id="Hzw-0S-h69"/>
+                                                                    </constraints>
+                                                                </stackView>
+                                                            </subviews>
+                                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                                            <constraints>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="top" secondItem="feb-ob-HAK" secondAttribute="top" id="7hg-wz-EVN"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="top" secondItem="rcX-IS-Hmj" secondAttribute="bottom" constant="15" id="EiC-Rv-Dog"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-16" id="Gg5-Ev-py5"/>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" id="Gj1-HV-kbf"/>
+                                                                <constraint firstItem="xp7-EC-6OW" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="HFH-0V-hcn"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-25" id="LZk-qS-h9h"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="top" secondItem="swA-jU-3wo" secondAttribute="bottom" constant="10" id="MKr-Mb-eal"/>
+                                                                <constraint firstItem="swA-jU-3wo" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="P9O-ov-JFT"/>
+                                                                <constraint firstAttribute="bottom" secondItem="qKn-wk-VDT" secondAttribute="bottom" id="QX5-ch-qgu"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="top" secondItem="xp7-EC-6OW" secondAttribute="bottom" constant="10" id="Sux-3A-CZI"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="U1R-CZ-rX8"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-25" id="ZqJ-Od-UHh"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="cse-q8-LIE"/>
+                                                                <constraint firstItem="qKn-wk-VDT" firstAttribute="centerX" secondItem="feb-ob-HAK" secondAttribute="centerX" id="gFE-CG-zYE"/>
+                                                                <constraint firstItem="uns-Lv-yfZ" firstAttribute="width" secondItem="feb-ob-HAK" secondAttribute="width" constant="-16" id="h4H-Rv-cUV"/>
+                                                                <constraint firstItem="rcX-IS-Hmj" firstAttribute="top" secondItem="uns-Lv-yfZ" secondAttribute="bottom" constant="10" id="vx7-Lg-abI"/>
+                                                            </constraints>
+                                                            <userDefinedRuntimeAttributes>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                                    <real key="value" value="8"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                                    <real key="value" value="1"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                </userDefinedRuntimeAttribute>
+                                                            </userDefinedRuntimeAttributes>
+                                                        </view>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="centerX" secondItem="zWn-KM-9py" secondAttribute="centerX" id="5SW-vB-DAm"/>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="top" secondItem="Trj-oS-RaI" secondAttribute="bottom" constant="10" id="GcZ-Be-MrS"/>
+                                                        <constraint firstItem="Et3-gn-ciE" firstAttribute="width" secondItem="zWn-KM-9py" secondAttribute="width" id="TAv-Wh-Gec"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="centerX" secondItem="zWn-KM-9py" secondAttribute="centerX" id="clD-T1-Ga1"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="width" secondItem="zWn-KM-9py" secondAttribute="width" id="oQW-7X-eiK"/>
+                                                        <constraint firstItem="Trj-oS-RaI" firstAttribute="top" secondItem="zWn-KM-9py" secondAttribute="top" id="rC2-7C-RUH"/>
+                                                    </constraints>
+                                                </stackView>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="centerX" secondItem="O30-vI-Tga" secondAttribute="centerX" id="BCL-JB-6el"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="height" secondItem="O30-vI-Tga" secondAttribute="height" id="ENO-ft-pka"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="width" secondItem="O30-vI-Tga" secondAttribute="width" id="fQa-AU-a1J"/>
+                                                <constraint firstItem="zWn-KM-9py" firstAttribute="centerY" secondItem="O30-vI-Tga" secondAttribute="centerY" id="tTv-jp-vug"/>
+                                            </constraints>
+                                            <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                            <userDefinedRuntimeAttributes>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                                    <real key="value" value="0.0"/>
+                                                </userDefinedRuntimeAttribute>
+                                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                                    <real key="value" value="0.0"/>
+                                                </userDefinedRuntimeAttribute>
+                                            </userDefinedRuntimeAttributes>
+                                        </view>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="centerY" secondItem="1tl-Rf-vmM" secondAttribute="centerY" id="32h-Uf-A6O"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="width" secondItem="1tl-Rf-vmM" secondAttribute="width" constant="-20" id="H6i-C0-iLl"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="centerY" secondItem="1tl-Rf-vmM" secondAttribute="centerY" id="UM4-RM-fCP"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="height" secondItem="1tl-Rf-vmM" secondAttribute="height" constant="-20" id="X9l-D2-wpr"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="centerX" secondItem="1tl-Rf-vmM" secondAttribute="centerX" id="bcV-jn-OzN"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="width" secondItem="1tl-Rf-vmM" secondAttribute="width" constant="-20" id="g3J-QI-uUU"/>
+                                        <constraint firstItem="ANk-4K-DBn" firstAttribute="centerX" secondItem="1tl-Rf-vmM" secondAttribute="centerX" id="hc3-iw-a9J"/>
+                                        <constraint firstItem="O30-vI-Tga" firstAttribute="height" secondItem="1tl-Rf-vmM" secondAttribute="height" constant="-20" id="neE-NI-yZa"/>
+                                    </constraints>
+                                    <edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
+                                </view>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="centerY" secondItem="onh-i9-8Tz" secondAttribute="centerY" id="Eom-1v-GO4"/>
+                                <constraint firstAttribute="bottom" secondItem="1tl-Rf-vmM" secondAttribute="bottom" id="H5Q-1i-OhR"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="width" secondItem="onh-i9-8Tz" secondAttribute="width" id="LTx-LP-2dU"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="top" secondItem="onh-i9-8Tz" secondAttribute="top" id="gM1-dS-jWM"/>
+                                <constraint firstItem="1tl-Rf-vmM" firstAttribute="centerX" secondItem="onh-i9-8Tz" secondAttribute="centerX" id="yyZ-Mm-MFj"/>
+                            </constraints>
+                        </stackView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="top" secondItem="tXE-yu-DoB" secondAttribute="top" id="CrY-e7-Nd6"/>
+                        <constraint firstAttribute="trailing" secondItem="onh-i9-8Tz" secondAttribute="trailing" id="F0Q-kD-nwz"/>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="width" secondItem="tXE-yu-DoB" secondAttribute="width" id="VNo-3N-w64"/>
+                        <constraint firstItem="onh-i9-8Tz" firstAttribute="leading" secondItem="tXE-yu-DoB" secondAttribute="leading" id="VXj-xp-cWQ"/>
+                        <constraint firstAttribute="bottom" secondItem="onh-i9-8Tz" secondAttribute="bottom" id="uCE-No-aOq"/>
+                    </constraints>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="5nP-Qg-R0K"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Adi-zS-UK6"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="XCC-J5-qrD"/>
+                <constraint firstItem="tXE-yu-DoB" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="g1W-BK-3Nv"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 158 - 0
app/PostViewController.swift

@@ -0,0 +1,158 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+class PostViewController: UIViewController, UIGestureRecognizerDelegate {
+	
+
+	
+	@IBOutlet weak var barTitle: UILabel!
+	@IBOutlet weak var barButton: UIButton!
+	@IBOutlet weak var postText: UILabel!
+	@IBOutlet weak var postTitle: UILabel!
+	@IBOutlet weak var postImage: UIImageView!
+	var id: Int = -1
+	var delegate: AppDelegate?
+	
+	//Each of the sections of the app.
+	
+	var passId: Int = -1
+	
+	func getContext () -> NSManagedObjectContext {
+		//let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		//return appDelegate.persistentContainer.viewContext
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		
+		print("POSTCONTROLLER:LOG: viewDidLoad()")
+		
+		super.viewDidLoad()
+		self.loadPost(id: id)
+		
+		// Set button action
+		barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	//TODO implement all the logic for post loading here, including iboutlts
+	
+	
+	func back() {
+		print("POSTCONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	public func loadPost(id: Int){
+		
+		print("POSTCONTROLLER:DEBUG: Loading post \(id)")
+		
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+		fetchRequest.predicate = NSPredicate(format: "id = %i", id)
+		
+		do {
+			//go get the results
+			let searchResults = try context.fetch(fetchRequest)
+			
+			var count = 0
+			var sTitle: String
+			var sText: String
+			var image: String
+			
+			//You need to convert to NSManagedObject to use 'for' loops
+			for r in searchResults as [NSManagedObject] {
+				count = count + 1
+				
+				sTitle = r.value(forKey: "title_\(lang)")! as! String
+				sText = r.value(forKey: "text_\(lang)")! as! String
+				postTitle.text = "  \(sTitle)"
+				postText.text = sText.stripHtml()
+				
+				// Get main image
+				image = ""
+				let imgFetchRequest: NSFetchRequest<Post_image> = Post_image.fetchRequest()
+				let imgSortDescriptor = NSSortDescriptor(key: "idx", ascending: true)
+				let imgSortDescriptors = [imgSortDescriptor]
+				imgFetchRequest.sortDescriptors = imgSortDescriptors
+				imgFetchRequest.predicate = NSPredicate(format: "post == %i", id)
+				imgFetchRequest.fetchLimit = 1
+				//TODO get more images
+				do{
+					let imgSearchResults = try context.fetch(imgFetchRequest)
+					for imgR in imgSearchResults as [NSManagedObject]{
+						image = imgR.value(forKey: "image")! as! String
+						print ("POST:LOG: Image: \(image)")
+						//TODO set image
+						//row.setImage(filename: image)
+					}
+				} catch {
+					print("POST:ERROR: Error getting image for post \(id): \(error)")
+				}
+				
+			}
+		} catch {
+			print("POST:ERROR: Error with request: \(error)")
+		}
+		
+		//Always at the end: update scrollview
+		// TODOs
+		//var h: Int = 0
+		//for view in scrollView.subviews {
+			//contentRect = contentRect.union(view.frame);
+		//	h = h + Int(view.frame.height) + 30 //Why 30?
+		//}
+		//print("POST:DEBUG: Height: \(h)")
+		// TODO: Calculate at the end
+		//self.scrollView.contentSize.height = 4500//CGFloat(h);
+
+	}
+	
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 130 - 0
app/RowAlbum.swift

@@ -0,0 +1,130 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowAlbum: UIView {
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+
+	
+	// Album ID
+	var id = -1
+	
+	// This view
+	var v: UIView!
+	
+	// Array with the imageviews
+	var preview: [UIImageView] = []
+
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWALBUM:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		//Populate review array
+		preview = [photo0, photo1]
+		
+		// Set tap recognizers
+		// TODO
+		//let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowAlbum.openPhoto(_:)))
+		//tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		//self.addGestureRecognizer(tapRecognizer)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	func openPhoto(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROWALBUM:DEBUG: Getting delegate and showing photo.")
+		// TODO
+		//let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		//delegate.controller?.showAlbum(id: self.id)
+	}
+	
+	/**
+	Changes the preview image of the photos.
+	If null or empty, the igage is hidden.
+	:param: idx Id of the image in the row. 0 for left, 1 for right.
+	:param: filename Filename of the image.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			NSLog(":ROWALBUM:DEBUG: No image for album \(self.id) at index \(idx).")
+			preview[idx].isHidden = true
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROWALBUM:DEBUG: Set image \(filename) for at index \(idx).")
+			let path = "img/galeria/thumb/\(filename)"
+			preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 81 - 0
app/RowAlbum.xib

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowAlbum" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="HdV-Po-yYe" id="J6E-n0-STQ"/>
+                <outlet property="photo0" destination="STJ-Gn-fSb" id="KnJ-xP-W5E"/>
+                <outlet property="photo1" destination="BRb-br-Rb9" id="GSz-Ba-URb"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowAlbum" customClass="RowAlbum" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HdV-Po-yYe">
+                    <rect key="frame" x="-0.5" y="269" width="375" height="128"/>
+                    <subviews>
+                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="STJ-Gn-fSb" userLabel="PhotoL">
+                            <rect key="frame" x="10" y="10" width="172.5" height="108"/>
+                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="108" id="adJ-vY-QZ4"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </imageView>
+                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="BRb-br-Rb9" userLabel="PhotoR">
+                            <rect key="frame" x="192.5" y="10" width="172.5" height="108"/>
+                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="108" id="LVi-0V-kFe"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </imageView>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    <constraints>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="width" secondItem="HdV-Po-yYe" secondAttribute="width" multiplier="0.5" constant="-15" id="4OG-wC-zDi"/>
+                        <constraint firstAttribute="trailing" secondItem="BRb-br-Rb9" secondAttribute="trailing" constant="10" id="52p-oq-lor"/>
+                        <constraint firstItem="BRb-br-Rb9" firstAttribute="centerY" secondItem="HdV-Po-yYe" secondAttribute="centerY" id="BdD-2d-ZcG"/>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="leading" secondItem="HdV-Po-yYe" secondAttribute="leading" constant="10" id="DAf-JG-dgr"/>
+                        <constraint firstItem="STJ-Gn-fSb" firstAttribute="centerY" secondItem="HdV-Po-yYe" secondAttribute="centerY" id="LpQ-Cf-UpA"/>
+                        <constraint firstItem="BRb-br-Rb9" firstAttribute="width" secondItem="HdV-Po-yYe" secondAttribute="width" multiplier="0.5" constant="-15" id="hFK-eR-Cdf"/>
+                        <constraint firstAttribute="height" constant="128" id="i8w-5X-QWB"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="4Aa-Fb-Ugf"/>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="bFu-54-Zel"/>
+                <constraint firstItem="HdV-Po-yYe" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="jRe-xq-gcl"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 130 - 0
app/RowBlog.swift

@@ -0,0 +1,130 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowBlog: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	//The container.
+	@IBOutlet weak var container: UIView!
+	
+	//The entry
+	@IBOutlet weak var entry: UIView!
+
+	//The post title.
+	@IBOutlet weak var title: UILabel!
+	
+	//The post description.
+	@IBOutlet weak var descrip: UILabel!
+
+	//The post image.
+	@IBOutlet weak var image: UIImageView!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+		
+		// Set tap recognizer
+		/*print("ROW_BLOG:DEBUG: set tap recognizer")
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openPost (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		addGestureRecognizer(tapRecognizer)*/
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+
+	
+	/**
+	Changes the title of the post. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the description of the post. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		descrip.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the image of the post.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			print("No image")
+			//TODO hide the imageview
+		}
+		else{
+			print("Set image \(filename)")
+			let path = "img/blog/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+	func openPost(_ sender:UITapGestureRecognizer? = nil){
+		print("ROW_BLOG:DEBUG: openpost")
+	}
+}

+ 113 - 0
app/RowBlog.xib

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowBlog" customModule="app" customModuleProvider="target">
+            <connections>
+                <outlet property="container" destination="fIu-6X-Tsy" id="sdT-5k-azi"/>
+                <outlet property="descrip" destination="rzM-vF-gOY" id="uQp-Za-gam"/>
+                <outlet property="entry" destination="b17-mq-rbm" id="3Ac-n2-qLr"/>
+                <outlet property="image" destination="6hA-MD-OsD" id="VNd-1E-Ztc"/>
+                <outlet property="title" destination="WSL-LM-04R" id="qKn-Xk-cEN"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="yLg-4E-qlC" userLabel="RowBlog" customClass="RowBlog" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fIu-6X-Tsy" userLabel="Container">
+                    <rect key="frame" x="0.0" y="273.5" width="375" height="120"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b17-mq-rbm" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="120"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WSL-LM-04R" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="6hA-MD-OsD" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="68z-jj-fIa"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rzM-vF-gOY" userLabel="Text">
+                                    <rect key="frame" x="97" y="40" width="248" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="WSL-LM-04R" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="10" id="4og-BI-wpQ"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="width" secondItem="b17-mq-rbm" secondAttribute="width" multiplier="0.2" id="BYW-Hr-dje"/>
+                                <constraint firstItem="rzM-vF-gOY" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="40" id="O3L-O9-b6V"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="leading" secondItem="b17-mq-rbm" secondAttribute="leading" constant="10" id="gNm-O7-qNU"/>
+                                <constraint firstItem="6hA-MD-OsD" firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="40" id="mvQ-pc-ApL"/>
+                                <constraint firstAttribute="trailing" secondItem="WSL-LM-04R" secondAttribute="trailing" constant="10" id="pco-U6-EWQ"/>
+                                <constraint firstItem="WSL-LM-04R" firstAttribute="leading" secondItem="b17-mq-rbm" secondAttribute="leading" constant="10" id="trs-wK-NuZ"/>
+                                <constraint firstAttribute="trailing" secondItem="rzM-vF-gOY" secondAttribute="trailing" constant="10" id="vlK-IJ-OrY"/>
+                                <constraint firstItem="rzM-vF-gOY" firstAttribute="width" secondItem="b17-mq-rbm" secondAttribute="width" multiplier="0.7" id="ww4-WB-msV"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="b17-mq-rbm" firstAttribute="leading" secondItem="fIu-6X-Tsy" secondAttribute="leading" constant="10" id="09K-4S-bco"/>
+                        <constraint firstAttribute="top" secondItem="b17-mq-rbm" secondAttribute="top" constant="-10" id="DRs-NG-UKY"/>
+                        <constraint firstAttribute="trailing" secondItem="b17-mq-rbm" secondAttribute="trailing" constant="10" id="Qtu-G3-8IH"/>
+                        <constraint firstAttribute="height" constant="120" id="W85-Qc-MWb"/>
+                        <constraint firstItem="b17-mq-rbm" firstAttribute="bottom" secondItem="fIu-6X-Tsy" secondAttribute="bottom" constant="10" id="bcY-vf-soX"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="width" secondItem="yLg-4E-qlC" secondAttribute="width" id="6xh-OR-L3E"/>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="centerX" secondItem="yLg-4E-qlC" secondAttribute="centerX" id="Rel-sh-SrL"/>
+                <constraint firstItem="fIu-6X-Tsy" firstAttribute="centerY" secondItem="yLg-4E-qlC" secondAttribute="centerY" id="X8l-Z5-R9M"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <userDefinedRuntimeAttributes>
+                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                    <real key="value" value="0.0"/>
+                </userDefinedRuntimeAttribute>
+            </userDefinedRuntimeAttributes>
+            <connections>
+                <outlet property="image" destination="6hA-MD-OsD" id="AvA-3b-lxb"/>
+            </connections>
+            <point key="canvasLocation" x="45.5" y="-43.5"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 197 - 0
app/RowFutureActivity.swift

@@ -0,0 +1,197 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowFutureActivity: UIView {
+	
+	//This view
+	var v: UIView!
+
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var title: UILabel!
+	@IBOutlet weak var image: UIImageView!
+	@IBOutlet weak var descript: UILabel!
+	@IBOutlet weak var date: UILabel!
+	@IBOutlet weak var city: UILabel!
+	@IBOutlet weak var price: UILabel!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+		
+		// Set tap recognizer
+		/*print("ROW_FUTURE_ACTIVITY:DEBUG: set tap recognizer")
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openActivity (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		addGestureRecognizer(tapRecognizer)*/
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	
+	
+	/**
+	Changes the title of the activity. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		self.title.text = text.stripHtml()
+	}
+	
+	/**
+	Sets the city of the activity.
+	:param: text The city.
+	*/
+	func setCity(text: String){
+		self.city.text = text
+	}
+	
+	/**
+	Sets the price of the activity.
+	:param: price The price, in Euros. If 0, nothing is shown.
+	*/
+	func setPrice(price: Int){
+		if price != 0{
+			self.price.text = "\(price) €"
+		}
+		else{
+			self.price.text = ""
+		}
+	}
+	
+	/**
+	Changes the description of the activity. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		self.descript.text = text.stripHtml()
+	}
+	
+	/**
+	Sets the date of the activity in a human readable format.
+	:param: text The date.
+	:param: lang Device language.
+	*/
+	func setDate(date: NSDate, lang: String){
+		
+		let dateformatter = DateFormatter()
+		
+		let months_es = ["0index", "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"]
+		let months_en = ["0index", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
+		let months_eu = ["0index", "urtarrilaren", "otsailaren", "martxoaren", "abrilaren", "maiatzaren", "ekainaren", "ustailaren", "abustuaren", "irailaren", "urriaren", "azaroaren", "abenduaren"]
+		let days_es = ["0index", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado", "Domingo"]
+		let days_en = ["0index", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
+		let days_eu = ["0index", "Astelehena", "Asteartea", "Asteazkena", "Osteguna", "Ostirala", "Larumbata", "Igandea"]
+		
+		let calendar = Calendar.current
+		let day = calendar.component(.day, from: date as Date)
+		let month = calendar.component(.month, from: date as Date)
+		let weekday = calendar.component(.weekday, from: date as Date)
+		var strDate = ""
+		
+		switch lang{
+			case "en":
+				
+				var dayNum = ""
+				switch day{
+					case 1:
+						dayNum = "1th"
+						break
+					case 2:
+						dayNum = "2nd"
+						break;
+					case 3:
+						dayNum = "3rd"
+						break;
+					default:
+						dayNum = "\(weekday)th"
+				}
+				
+				strDate = "\(days_en[weekday]), \(months_en[month]) \(dayNum)"
+				break
+			case "eu":
+				strDate = "\(days_eu[weekday]) \(months_eu[month]) \(day)an"
+				break
+			default:
+				strDate = "\(days_es[weekday]) \(day) de \(months_es[month])"
+		}
+		
+		self.date.text = strDate
+	}
+	
+	/**
+	Changes the image of the activity.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			NSLog("ROW_FUTURE_ACTIVITY:DEBUG: No image")
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROW_FUTURE_ACTIVITY:DEBUG: Set image \(filename)")
+			let path = "img/actividades/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+	func openActivity(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROW_FUTURE_ACTIVITY:DEBUG: open activity")
+	}
+}

+ 135 - 0
app/RowFutureActivity.xib

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowFutureActivity" customModule="app">
+            <connections>
+                <outlet property="city" destination="VQF-xA-wca" id="evN-BP-6An"/>
+                <outlet property="container" destination="LXM-17-fy1" id="4qg-I3-wo0"/>
+                <outlet property="date" destination="pCj-dq-5rF" id="4Cg-kn-D3p"/>
+                <outlet property="descript" destination="m6I-vy-k36" id="9rq-LM-8kb"/>
+                <outlet property="image" destination="xIf-kY-gPW" id="Kzl-DN-26C"/>
+                <outlet property="price" destination="U3K-kD-4pK" id="aV5-sa-dbD"/>
+                <outlet property="title" destination="Vd3-c0-iYd" id="jnK-lJ-Fav"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LXM-17-fy1" userLabel="Container">
+                    <rect key="frame" x="0.0" y="263.5" width="375" height="140"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oax-mA-mEd" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="140"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vd3-c0-iYd" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pCj-dq-5rF" userLabel="Date">
+                                    <rect key="frame" x="14.5" y="32" width="325" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="xIf-kY-gPW" userLabel="Image">
+                                    <rect key="frame" x="10" y="53" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="GGt-lC-syI"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m6I-vy-k36" userLabel="Text">
+                                    <rect key="frame" x="97" y="53" width="248" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VQF-xA-wca" userLabel="City">
+                                    <rect key="frame" x="20" y="119" width="275" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="U3K-kD-4pK" userLabel="Price">
+                                    <rect key="frame" x="285" y="119" width="50" height="21"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="50" id="uI7-D4-q0g"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="VQF-xA-wca" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-80" id="1bi-lD-f66"/>
+                                <constraint firstItem="pCj-dq-5rF" firstAttribute="top" secondItem="Vd3-c0-iYd" secondAttribute="bottom" id="2SS-dr-xRe"/>
+                                <constraint firstItem="Vd3-c0-iYd" firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="10" id="6ON-9I-XV5"/>
+                                <constraint firstItem="xIf-kY-gPW" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.2" id="7yL-vu-0hi"/>
+                                <constraint firstItem="m6I-vy-k36" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" multiplier="0.7" id="G5a-55-w2d"/>
+                                <constraint firstItem="Vd3-c0-iYd" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="10" id="Igf-ZR-anh"/>
+                                <constraint firstItem="pCj-dq-5rF" firstAttribute="centerX" secondItem="Oax-mA-mEd" secondAttribute="centerX" id="LiY-tJ-HN8"/>
+                                <constraint firstAttribute="trailing" secondItem="Vd3-c0-iYd" secondAttribute="trailing" constant="10" id="QqW-8x-l8D"/>
+                                <constraint firstAttribute="trailing" secondItem="m6I-vy-k36" secondAttribute="trailing" constant="10" id="d6m-wH-hZ4"/>
+                                <constraint firstItem="pCj-dq-5rF" firstAttribute="width" secondItem="Oax-mA-mEd" secondAttribute="width" constant="-30" id="ec5-Em-Hvc"/>
+                                <constraint firstItem="VQF-xA-wca" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="20" id="fKa-XB-zgY"/>
+                                <constraint firstAttribute="trailing" secondItem="U3K-kD-4pK" secondAttribute="trailing" constant="20" id="fib-sq-y5t"/>
+                                <constraint firstItem="U3K-kD-4pK" firstAttribute="centerY" secondItem="VQF-xA-wca" secondAttribute="centerY" id="fxM-45-fab"/>
+                                <constraint firstItem="m6I-vy-k36" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" id="jKd-mD-fFn"/>
+                                <constraint firstAttribute="bottom" secondItem="VQF-xA-wca" secondAttribute="bottom" id="rUq-Gl-Ma0"/>
+                                <constraint firstItem="xIf-kY-gPW" firstAttribute="leading" secondItem="Oax-mA-mEd" secondAttribute="leading" constant="10" id="xRs-gP-CBO"/>
+                                <constraint firstItem="xIf-kY-gPW" firstAttribute="top" secondItem="pCj-dq-5rF" secondAttribute="bottom" id="xYq-wH-6dd"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="Oax-mA-mEd" firstAttribute="leading" secondItem="LXM-17-fy1" secondAttribute="leading" constant="10" id="1DE-sl-oYv"/>
+                        <constraint firstItem="Oax-mA-mEd" firstAttribute="bottom" secondItem="LXM-17-fy1" secondAttribute="bottom" constant="10" id="cGe-u0-Et9"/>
+                        <constraint firstAttribute="top" secondItem="Oax-mA-mEd" secondAttribute="top" constant="-10" id="dfL-CJ-4Ja"/>
+                        <constraint firstAttribute="trailing" secondItem="Oax-mA-mEd" secondAttribute="trailing" constant="10" id="mgX-om-hx4"/>
+                        <constraint firstAttribute="height" constant="140" id="pnJ-Mv-tz4"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="LXM-17-fy1" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="GTl-bf-vFg"/>
+                <constraint firstItem="LXM-17-fy1" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="TQ0-Rk-U3O"/>
+                <constraint firstItem="LXM-17-fy1" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="l7x-fz-B1I"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 132 - 0
app/RowGallery.swift

@@ -0,0 +1,132 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowGallery: UIView {
+	
+	// This view
+	var v: UIView!
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var title: UILabel!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+	@IBOutlet weak var photo2: UIImageView!
+	@IBOutlet weak var photo3: UIImageView!
+	
+	// Array with the imageviews
+	var preview: [UIImageView] = []
+	
+	// Album ID
+	var id = -1
+	
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWGALLERY:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 1000, height: 1000))
+		loadViewFromNib()
+		v = self
+		v.frame = bounds
+		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		v.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = v.bounds
+		v.addSubview(container)
+		
+		//Populate review array
+		preview = [photo0, photo1, photo2, photo3]
+		
+		// Set tap recognizer
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (RowGallery.openAlbum (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		self.addGestureRecognizer(tapRecognizer)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	func openAlbum(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROW_GALLERY:DEBUG: Getting delegate and showing album \(self.id).")
+		let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+		delegate.controller?.showAlbum(id: self.id)
+	}
+	
+	/**
+	Changes the title of the album. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = "  \(text.stripHtml())"
+	}
+	
+	/**
+	Changes the preview image of the album.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			NSLog(":ROWGALLERY:DEBUG: No image for album \(self.id) at index \(idx).")
+			preview[idx].isHidden = true
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROWGALLERY:DEBUG: Set image \(filename) for album \(self.id) at index \(idx).")
+			let path = "img/galeria/thumb/\(filename)"
+			preview[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 152 - 0
app/RowGallery.xib

@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowGallery" customModule="app">
+            <connections>
+                <outlet property="container" destination="5s9-Le-qTP" id="Z8m-m7-LEO"/>
+                <outlet property="photo0" destination="ALA-B7-xYr" id="gBh-vt-C7l"/>
+                <outlet property="photo1" destination="1yK-KV-day" id="uHg-pA-CYk"/>
+                <outlet property="photo2" destination="FJP-ZD-LGA" id="7As-zB-f1E"/>
+                <outlet property="photo3" destination="Xwd-Zx-bfE" id="wvz-zu-nXM"/>
+                <outlet property="title" destination="0t2-77-n8R" id="JXv-hD-axV"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" userLabel="RowGallery" customClass="RowGallery" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5s9-Le-qTP" userLabel="Container">
+                    <rect key="frame" x="-0.5" y="183" width="375" height="300"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hif-f7-Vxg" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="280"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0t2-77-n8R">
+                                    <rect key="frame" x="0.0" y="10" width="355" height="21"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="ALA-B7-xYr" userLabel="Photo0">
+                                    <rect key="frame" x="10" y="41" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="iiK-OG-AZy"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="1yK-KV-day" userLabel="Photo1">
+                                    <rect key="frame" x="182.5" y="41" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="vrH-X3-6Rl"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="FJP-ZD-LGA" userLabel="Photo2">
+                                    <rect key="frame" x="10" y="162" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="U9z-FX-Qxl"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="Xwd-Zx-bfE" userLabel="Photo3">
+                                    <rect key="frame" x="182.5" y="162" width="162.5" height="108"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="108" id="lL5-Te-XTy"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                            <color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        </userDefinedRuntimeAttribute>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                            <real key="value" value="1"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </imageView>
+                            </subviews>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="top" secondItem="0t2-77-n8R" secondAttribute="bottom" constant="10" id="0t2-P2-3gu"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="leading" secondItem="hif-f7-Vxg" secondAttribute="leading" constant="10" id="5bO-l4-LGu"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="trailing" secondItem="0t2-77-n8R" secondAttribute="trailing" constant="-10" id="DVh-LJ-p9e"/>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="FKW-tk-kAd"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="G3l-Qc-THc"/>
+                                <constraint firstItem="ALA-B7-xYr" firstAttribute="leading" secondItem="0t2-77-n8R" secondAttribute="leading" constant="10" id="HoJ-in-dXf"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="centerX" secondItem="hif-f7-Vxg" secondAttribute="centerX" id="Paz-Pk-eSy"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" multiplier="0.5" constant="-15" id="QPQ-1R-oUR"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="top" secondItem="0t2-77-n8R" secondAttribute="bottom" constant="10" id="Qxa-Ti-08x"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="top" secondItem="hif-f7-Vxg" secondAttribute="top" constant="10" id="WYO-vy-VPP"/>
+                                <constraint firstItem="FJP-ZD-LGA" firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="-10" id="amo-wJ-6JX"/>
+                                <constraint firstItem="0t2-77-n8R" firstAttribute="width" secondItem="hif-f7-Vxg" secondAttribute="width" id="bDV-Kx-fRp"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="-10" id="hN9-fv-fa5"/>
+                                <constraint firstItem="1yK-KV-day" firstAttribute="width" secondItem="0t2-77-n8R" secondAttribute="width" multiplier="0.5" constant="-15" id="mnN-Gq-pa3"/>
+                                <constraint firstItem="Xwd-Zx-bfE" firstAttribute="trailing" secondItem="hif-f7-Vxg" secondAttribute="trailing" constant="-10" id="sfm-VE-DCx"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <integer key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <integer key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="300" id="7Yh-0e-ajC"/>
+                        <constraint firstAttribute="bottom" secondItem="hif-f7-Vxg" secondAttribute="bottom" constant="10" id="KJt-VS-2f3"/>
+                        <constraint firstItem="hif-f7-Vxg" firstAttribute="trailing" secondItem="5s9-Le-qTP" secondAttribute="trailing" constant="-10" id="dQW-pn-Jio"/>
+                        <constraint firstAttribute="top" secondItem="hif-f7-Vxg" secondAttribute="top" constant="-10" id="hXG-tn-58e"/>
+                        <constraint firstItem="hif-f7-Vxg" firstAttribute="leading" secondItem="5s9-Le-qTP" secondAttribute="leading" constant="10" id="noN-5r-cCi"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="58W-bA-0zy"/>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="96p-IK-UFf"/>
+                <constraint firstItem="5s9-Le-qTP" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="aM7-gO-87G"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 2 - 0
app/RowHomeBlog.swift

@@ -29,6 +29,8 @@ Extension of UIView to be formatted as sections.
 	//This view
 	//This view
 	var v: UIView!
 	var v: UIView!
 	
 	
+	var id: Int!
+	
 	//The container.
 	//The container.
 	@IBOutlet weak var container: UIView!
 	@IBOutlet weak var container: UIView!
 	
 	

+ 102 - 0
app/RowHomeGallery.swift

@@ -0,0 +1,102 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowHomeGallery: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var photo0: UIImageView!
+	@IBOutlet weak var photo1: UIImageView!
+	@IBOutlet weak var photo2: UIImageView!
+	@IBOutlet weak var photo3: UIImageView!
+	
+	var photos: [UIImageView] = []
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		//v.frame = bounds
+		//v.bounds = v.frame
+		//v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		//v.translatesAutoresizingMaskIntoConstraints = true
+		//container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		//container.translatesAutoresizingMaskIntoConstraints = true
+		
+		//container.frame = v.bounds
+		v.addSubview(container)
+		
+		photos = [photo0, photo1, photo2, photo3]
+		
+
+		
+		//TODO Set click listeners
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Changes the preview image.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(idx: Int, filename: String){
+		if (filename == ""){
+			print("ROWHOMEGALLERY:LOG: No image.")
+			//TODO hide the imageview
+		}
+		else{
+			let path = "img/galeria/thumb/\(filename)"
+			photos[idx].setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+}

+ 112 - 0
app/RowHomeGallery.xib

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowHomeGallery" customModule="app">
+            <connections>
+                <outlet property="container" destination="fQL-ej-f6f" id="gat-5m-Nlc"/>
+                <outlet property="photo0" destination="dnB-DT-XBi" id="Gcn-A3-qVV"/>
+                <outlet property="photo1" destination="WDB-y4-09J" id="yCC-HU-nfj"/>
+                <outlet property="photo2" destination="anB-pq-Srl" id="VWm-9P-5aK"/>
+                <outlet property="photo3" destination="fDa-I0-n0C" id="oyE-AI-yhP"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RowHomeGallery" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fQL-ej-f6f" userLabel="Container">
+                    <rect key="frame" x="-0.5" y="0.0" width="375" height="230"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wVc-lu-Pqh" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="230"/>
+                            <subviews>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="dnB-DT-XBi" userLabel="Photo0">
+                                    <rect key="frame" x="10" y="10" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="c49-em-SBK"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WDB-y4-09J" userLabel="Photo1">
+                                    <rect key="frame" x="182.5" y="10" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="PMB-24-syn"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="anB-pq-Srl" userLabel="Photo2">
+                                    <rect key="frame" x="10" y="120" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="A9o-VC-FHH"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="fDa-I0-n0C" userLabel="Photo3">
+                                    <rect key="frame" x="182.5" y="120" width="162.5" height="100"/>
+                                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="100" id="Lw8-Ie-YJH"/>
+                                    </constraints>
+                                </imageView>
+                            </subviews>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="68Z-py-m5z"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="top" secondItem="dnB-DT-XBi" secondAttribute="bottom" constant="10" id="Bad-nG-5z5"/>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="leading" secondItem="wVc-lu-Pqh" secondAttribute="leading" constant="10" id="D5O-yf-YW8"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="top" secondItem="WDB-y4-09J" secondAttribute="bottom" constant="10" id="EAz-Ai-4fI"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="leading" secondItem="wVc-lu-Pqh" secondAttribute="leading" constant="10" id="EBa-JH-t1r"/>
+                                <constraint firstItem="anB-pq-Srl" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="EcJ-3D-reB"/>
+                                <constraint firstAttribute="height" constant="230" id="Ffn-YP-qLO"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="top" secondItem="wVc-lu-Pqh" secondAttribute="top" constant="10" id="NRB-ED-7lT"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="gYW-t2-gNJ"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="-10" id="lWA-u1-9Oi"/>
+                                <constraint firstItem="dnB-DT-XBi" firstAttribute="top" secondItem="wVc-lu-Pqh" secondAttribute="top" constant="10" id="mWE-kd-0X9"/>
+                                <constraint firstItem="fDa-I0-n0C" firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="-10" id="tJB-Qz-gmc"/>
+                                <constraint firstItem="WDB-y4-09J" firstAttribute="width" secondItem="wVc-lu-Pqh" secondAttribute="width" multiplier="0.5" constant="-15" id="tJI-ji-ciu"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098039215684" green="0.41176470588235292" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <integer key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <integer key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="bottom" secondItem="fQL-ej-f6f" secondAttribute="bottom" constant="10" id="4Qm-4E-T6T"/>
+                        <constraint firstAttribute="trailing" secondItem="wVc-lu-Pqh" secondAttribute="trailing" constant="10" id="Gw9-3i-bdM"/>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="top" secondItem="fQL-ej-f6f" secondAttribute="top" constant="10" id="JpE-6m-QpJ"/>
+                        <constraint firstItem="wVc-lu-Pqh" firstAttribute="leading" secondItem="fQL-ej-f6f" secondAttribute="leading" constant="10" id="sx2-Al-2U2"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="D1e-8E-fga"/>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="Pfz-ns-fxp"/>
+                <constraint firstItem="fQL-ej-f6f" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="r6U-3K-HqE"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 83 - 0
app/RowLabel.swift

@@ -0,0 +1,83 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowLabel: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var text: UILabel!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+
+	
+	/**
+	Changes the text of The label. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		self.text.text = text.stripHtml()
+	}
+}

+ 79 - 0
app/RowLabel.xib

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowLabel" customModule="app">
+            <connections>
+                <outlet property="container" destination="sWl-jd-g1w" id="uN3-0d-wln"/>
+                <outlet property="text" destination="cAu-3X-Tbx" id="J1F-St-t3M"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sWl-jd-g1w" userLabel="Container">
+                    <rect key="frame" x="0.0" y="313.5" width="375" height="40.5"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9wy-u8-pKj" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="40.5"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cAu-3X-Tbx" userLabel="Text">
+                                    <rect key="frame" x="10" y="10" width="335" height="20.5"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="cAu-3X-Tbx" firstAttribute="width" secondItem="9wy-u8-pKj" secondAttribute="width" constant="-20" id="8vk-yq-iYR"/>
+                                <constraint firstItem="cAu-3X-Tbx" firstAttribute="centerY" secondItem="9wy-u8-pKj" secondAttribute="centerY" id="gGp-W9-8FT"/>
+                                <constraint firstItem="cAu-3X-Tbx" firstAttribute="height" secondItem="9wy-u8-pKj" secondAttribute="height" constant="-20" id="if1-Pg-hNH"/>
+                                <constraint firstItem="cAu-3X-Tbx" firstAttribute="centerX" secondItem="9wy-u8-pKj" secondAttribute="centerX" id="mED-iI-aHq"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="top" secondItem="9wy-u8-pKj" secondAttribute="top" constant="-10" id="E6z-L4-kxl"/>
+                        <constraint firstItem="9wy-u8-pKj" firstAttribute="bottom" secondItem="sWl-jd-g1w" secondAttribute="bottom" constant="10" id="mr3-wn-Fhg"/>
+                        <constraint firstAttribute="trailing" secondItem="9wy-u8-pKj" secondAttribute="trailing" constant="10" id="qfZ-sB-04Y"/>
+                        <constraint firstItem="9wy-u8-pKj" firstAttribute="leading" secondItem="sWl-jd-g1w" secondAttribute="leading" constant="10" id="wlF-xl-Kb8"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="sWl-jd-g1w" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="i65-Nb-Seg"/>
+                <constraint firstItem="sWl-jd-g1w" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="q8B-3g-WjE"/>
+                <constraint firstItem="sWl-jd-g1w" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="z0m-TJ-Jig"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 89 - 0
app/RowLablancaDay.swift

@@ -0,0 +1,89 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowLablancaDay: UIView {
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var number: UILabel!
+	@IBOutlet weak var month: UILabel!
+	@IBOutlet weak var name: UILabel!
+	@IBOutlet weak var price: UILabel!
+	@IBOutlet weak var separator: UIView!
+	
+	
+	
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	/**
+	Loads the view from the xib with the same name as the class.
+	*/
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+		
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+		
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		NSLog(":ROWLABLANCADAY:DEBUG: Init \(s), \(i)")
+		
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+}

+ 102 - 0
app/RowLablancaDay.xib

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina3_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowLablancaDay" customModule="app">
+            <connections>
+                <outlet property="container" destination="gfH-i8-jRE" id="wgl-1w-I1S"/>
+                <outlet property="month" destination="5Qr-iE-jB1" id="N9E-Yg-Dx5"/>
+                <outlet property="name" destination="Bq6-IK-wMo" id="f8D-Fk-GR1"/>
+                <outlet property="number" destination="fyr-yz-Mdw" id="tbR-wz-NFB"/>
+                <outlet property="price" destination="EBl-yy-csC" id="iW2-CE-0GB"/>
+                <outlet property="separator" destination="jGw-ai-rD9" id="qZ8-a1-fSi"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RowLablancaDay" customModule="app">
+            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gfH-i8-jRE" userLabel="Container">
+                    <rect key="frame" x="0.0" y="197.5" width="320" height="85"/>
+                    <subviews>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="25" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fyr-yz-Mdw" userLabel="Number">
+                            <rect key="frame" x="0.0" y="0.0" width="60" height="50"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="50" id="B8H-ex-mmQ"/>
+                                <constraint firstAttribute="width" constant="60" id="VZe-Ub-0PF"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Agosto" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Qr-iE-jB1" userLabel="Month">
+                            <rect key="frame" x="0.0" y="50" width="80" height="20.5"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="80" id="RZL-5X-uNW"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                            <nil key="textColor"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Margo Txiki" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bq6-IK-wMo" userLabel="Name">
+                            <rect key="frame" x="80" y="0.0" width="160" height="60"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="60" id="INd-c0-4oI"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="italicSystem" pointSize="17"/>
+                            <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="60 E" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EBl-yy-csC" userLabel="Price">
+                            <rect key="frame" x="240" y="0.0" width="70" height="85"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="70" id="E4j-HZ-ldc"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
+                            <color key="textColor" red="0.0" green="0.47058823529999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jGw-ai-rD9" userLabel="BSeparator">
+                            <rect key="frame" x="16" y="79" width="288" height="1"/>
+                            <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="1" id="J4D-Ti-cxq"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    <constraints>
+                        <constraint firstItem="EBl-yy-csC" firstAttribute="height" secondItem="gfH-i8-jRE" secondAttribute="height" id="0Y2-3c-XrT"/>
+                        <constraint firstItem="fyr-yz-Mdw" firstAttribute="leading" secondItem="gfH-i8-jRE" secondAttribute="leading" id="35s-RT-Oj6"/>
+                        <constraint firstItem="Bq6-IK-wMo" firstAttribute="top" secondItem="gfH-i8-jRE" secondAttribute="top" id="8jB-bt-jc1"/>
+                        <constraint firstAttribute="trailing" secondItem="Bq6-IK-wMo" secondAttribute="trailing" constant="80" id="EQ4-Hb-Tak"/>
+                        <constraint firstItem="fyr-yz-Mdw" firstAttribute="top" secondItem="gfH-i8-jRE" secondAttribute="top" id="J4i-zA-a0P"/>
+                        <constraint firstItem="5Qr-iE-jB1" firstAttribute="leading" secondItem="gfH-i8-jRE" secondAttribute="leading" id="NIm-B3-jCe"/>
+                        <constraint firstItem="jGw-ai-rD9" firstAttribute="width" secondItem="gfH-i8-jRE" secondAttribute="width" multiplier="0.9" id="PFQ-Ss-B4n"/>
+                        <constraint firstItem="5Qr-iE-jB1" firstAttribute="top" secondItem="fyr-yz-Mdw" secondAttribute="bottom" id="SK6-qC-aSb"/>
+                        <constraint firstItem="jGw-ai-rD9" firstAttribute="centerX" secondItem="gfH-i8-jRE" secondAttribute="centerX" id="cXu-Ex-OPq"/>
+                        <constraint firstAttribute="bottom" secondItem="EBl-yy-csC" secondAttribute="bottom" id="eKu-rV-ta5"/>
+                        <constraint firstAttribute="bottom" secondItem="jGw-ai-rD9" secondAttribute="bottom" constant="5" id="iXz-7T-gxt"/>
+                        <constraint firstItem="Bq6-IK-wMo" firstAttribute="leading" secondItem="fyr-yz-Mdw" secondAttribute="trailing" constant="20" id="p56-bu-QTp"/>
+                        <constraint firstAttribute="height" constant="85" id="r9E-HA-2EY"/>
+                        <constraint firstAttribute="trailing" secondItem="EBl-yy-csC" secondAttribute="trailing" constant="10" id="r9k-aS-TeZ"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <constraints>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="YtF-gj-uYr"/>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="mOr-Je-9MW"/>
+                <constraint firstItem="gfH-i8-jRE" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="ocq-OY-EmP"/>
+            </constraints>
+        </view>
+    </objects>
+</document>

+ 121 - 0
app/RowPastActivity.swift

@@ -0,0 +1,121 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowPastActivity: UIView {
+	
+	//This view
+	var v: UIView!
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var title: UILabel!
+	@IBOutlet weak var image: UIImageView!
+	@IBOutlet weak var descript: UILabel!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		v = self
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+		
+		// Set tap recognizer
+		/*print("ROW_PAST_ACTIVITY:DEBUG: set tap recognizer")
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openActivity (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		addGestureRecognizer(tapRecognizer)*/
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	
+	
+	/**
+	Changes the title of the activity. Decodes HTML.
+	:param: text The new title.
+	*/
+	func setTitle(text: String){
+		title.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the description of the activity. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		descript.text = text.stripHtml()
+	}
+	
+	/**
+	Changes the image of the activity.
+	If null or empty, the igage is hidden.
+	:param: path The new text.
+	*/
+	func setImage(filename: String){
+		if (filename == ""){
+			NSLog("ROW_PAST_ACTIVITY:DEBUG: No image")
+			//TODO hide the imageview
+		}
+		else{
+			NSLog(":ROW_PAST_ACTIVITY:DEBUG: Set image \(filename)")
+			let path = "img/actividades/thumb/\(filename)"
+			image.setImage(localPath: path, remotePath: "https://margolariak.com/\(path)")
+		}
+	}
+	
+	func openActivity(_ sender:UITapGestureRecognizer? = nil){
+		NSLog(":ROW_PAST_ACTIVITY:DEBUG: open activity")
+	}
+}

+ 103 - 0
app/RowPastActivity.xib

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowPastActivity" customModule="app">
+            <connections>
+                <outlet property="container" destination="0f3-n8-snP" id="8j2-8w-POc"/>
+                <outlet property="descript" destination="LX0-An-ebo" id="z3b-XC-PGL"/>
+                <outlet property="image" destination="dtJ-G2-LyM" id="XkE-dY-Uil"/>
+                <outlet property="title" destination="5y2-jo-1Ha" id="Axu-Cg-JJ5"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0f3-n8-snP" userLabel="Container">
+                    <rect key="frame" x="0.0" y="273.5" width="375" height="120"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m2C-OM-hgM" userLabel="Entry">
+                            <rect key="frame" x="10" y="10" width="355" height="120"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5y2-jo-1Ha" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="335" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="dtJ-G2-LyM" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="71" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="5JB-2b-om6"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LX0-An-ebo" userLabel="Text">
+                                    <rect key="frame" x="97" y="40" width="248" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="5y2-jo-1Ha" firstAttribute="leading" secondItem="m2C-OM-hgM" secondAttribute="leading" constant="10" id="5t3-5D-Bw9"/>
+                                <constraint firstAttribute="trailing" secondItem="5y2-jo-1Ha" secondAttribute="trailing" constant="10" id="8e4-5r-Akk"/>
+                                <constraint firstItem="dtJ-G2-LyM" firstAttribute="width" secondItem="m2C-OM-hgM" secondAttribute="width" multiplier="0.2" id="GYq-dz-9OC"/>
+                                <constraint firstAttribute="trailing" secondItem="LX0-An-ebo" secondAttribute="trailing" constant="10" id="STs-WD-4SU"/>
+                                <constraint firstItem="dtJ-G2-LyM" firstAttribute="leading" secondItem="m2C-OM-hgM" secondAttribute="leading" constant="10" id="UPa-J0-dqk"/>
+                                <constraint firstItem="LX0-An-ebo" firstAttribute="top" secondItem="m2C-OM-hgM" secondAttribute="top" constant="40" id="cuE-pv-oLu"/>
+                                <constraint firstItem="dtJ-G2-LyM" firstAttribute="top" secondItem="m2C-OM-hgM" secondAttribute="top" constant="40" id="ed0-bE-O9g"/>
+                                <constraint firstItem="5y2-jo-1Ha" firstAttribute="top" secondItem="m2C-OM-hgM" secondAttribute="top" constant="10" id="nZ9-2T-9r8"/>
+                                <constraint firstItem="LX0-An-ebo" firstAttribute="width" secondItem="m2C-OM-hgM" secondAttribute="width" multiplier="0.7" id="yaA-lG-dUP"/>
+                            </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                                    <color key="value" red="0.42745098040000001" green="0.41176470590000003" blue="0.56470588239999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="1"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="3"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="m2C-OM-hgM" secondAttribute="trailing" constant="10" id="1dr-q7-OCF"/>
+                        <constraint firstAttribute="top" secondItem="m2C-OM-hgM" secondAttribute="top" constant="-10" id="2wX-Nf-cYh"/>
+                        <constraint firstAttribute="height" constant="120" id="Btv-5Q-hKb"/>
+                        <constraint firstItem="m2C-OM-hgM" firstAttribute="bottom" secondItem="0f3-n8-snP" secondAttribute="bottom" constant="10" id="lgl-YA-QZP"/>
+                        <constraint firstItem="m2C-OM-hgM" firstAttribute="leading" secondItem="0f3-n8-snP" secondAttribute="leading" constant="10" id="zBz-05-y7c"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="0f3-n8-snP" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="9st-8M-YFq"/>
+                <constraint firstItem="0f3-n8-snP" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="cwD-TG-T2H"/>
+                <constraint firstItem="0f3-n8-snP" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="iW1-1C-Wc1"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="PhotoPlaceholder" width="170" height="108"/>
+    </resources>
+</document>

+ 154 - 0
app/RowSchedule.swift

@@ -0,0 +1,154 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIView to be formatted as sections.
+*/
+@IBDesignable class RowSchedule: UIView {
+
+	
+	// Outlets
+	@IBOutlet weak var container: UIView!
+	@IBOutlet weak var lbTime: UILabel!
+	@IBOutlet weak var lbTitle: UILabel!
+	@IBOutlet weak var lbText: UILabel!
+	@IBOutlet weak var lbLocation: UILabel!
+	
+	/**
+	Default constructor
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
+	
+	private func loadViewFromNib() {
+		let bundle = Bundle(for: type(of: self))
+		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
+	}
+	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
+	init(s: String, i: Int) {
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
+		loadViewFromNib()
+		self.frame = self.bounds
+		self.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		self.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+		container.translatesAutoresizingMaskIntoConstraints = true
+		
+		container.frame = self.bounds
+		self.addSubview(container)
+		
+		// Set tap recognizer
+		/*print("ROW_BLOG:DEBUG: set tap recognizer")
+		let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector (self.openPost (_:)))
+		tapRecognizer.delegate = (UIApplication.shared.delegate as! AppDelegate).controller
+		addGestureRecognizer(tapRecognizer)*/
+	}
+	
+	/**
+	Default constructor for the interface builder
+	*/
+	override init(frame: CGRect){
+		super.init(frame: frame)
+	}
+	
+	/**
+	Sets the time of the event.
+	:param: str String with the time to set.
+	*/
+	func setTime(str: String){
+		self.lbTime.text = str
+	}
+	
+	/**
+	Sets the time of the event.
+	:param: hours Hour of the event start.
+	:param: minutes Minutes of the event start.
+	*/
+	func setTime(hours: Int, minutes: Int){
+		var strMinutes: String = ""
+		if "\(minutes)".length == 1{
+			strMinutes = "0\(minutes)"
+		}
+		else{
+			strMinutes = "\(minutes)"
+		}
+		self.lbTime.text = "\(hours):\(strMinutes)"
+	}
+	
+	/**
+	Sets the time of the event.
+	:param: dtime Datetime of the event start.
+	*/
+	func setTime(dtime: NSDate){
+		let calendar = Calendar.current
+		let hours = calendar.component(.hour, from: dtime as Date)
+		let minutes = calendar.component(.minute, from: dtime as Date)
+		var strMinutes: String = ""
+		if "\(minutes)".length == 1{
+			strMinutes = "0\(minutes)"
+		}
+		else{
+			strMinutes = "\(minutes)"
+		}
+		self.lbTime.text = "\(hours):\(strMinutes)"
+	}
+	
+	/**
+	Sets the title of the event.
+	:param: text The title of the event.
+	*/
+	func setTitle(text: String){
+		self.lbTitle.text = text
+	}
+	
+	/**
+	Sets the location of the event.
+	:param: text The location of the event.
+	*/
+	func setLocation(text: String){
+		self.lbLocation.text = text
+	}
+	
+	/**
+	Sets the description of the event. Decodes HTML.
+	:param: text The new text.
+	*/
+	func setText(text: String){
+		self.lbText.text = text.stripHtml()
+	}
+	
+	/**
+	Opens an event dialog.
+	*/
+	func openEvent(_ sender:UITapGestureRecognizer? = nil){
+		print("ROW_BLOG:DEBUG: openpost")
+	}
+}

+ 139 - 0
app/RowSchedule.xib

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowSchedule" customModule="app">
+            <connections>
+                <outlet property="container" destination="HZR-5W-2l9" id="Pbz-zj-AcP"/>
+                <outlet property="lbLocation" destination="Edl-Ib-zzS" id="P41-6d-DGV"/>
+                <outlet property="lbText" destination="pCF-JC-n5h" id="yAA-gU-Dt5"/>
+                <outlet property="lbTime" destination="VVW-yL-wmh" id="PLK-PD-yaj"/>
+                <outlet property="lbTitle" destination="vSV-nw-MRt" id="LoG-Yq-S3M"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HZR-5W-2l9" userLabel="Container">
+                    <rect key="frame" x="0.0" y="273.5" width="375" height="120"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ko7-ge-5ca" userLabel="Entry">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="120"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VVW-yL-wmh" userLabel="Time">
+                                    <rect key="frame" x="10" y="10" width="55" height="22"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="55" id="qJV-iR-yg8"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" alpha="0.75" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="q6x-38-7dL" userLabel="Line">
+                                    <rect key="frame" x="76" y="-0.5" width="2" height="120"/>
+                                    <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="2" id="Qy1-BX-GQH"/>
+                                    </constraints>
+                                </imageView>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ScheduleBullet" translatesAutoresizingMaskIntoConstraints="NO" id="pxM-Zk-Eo7" userLabel="Bullet">
+                                    <rect key="frame" x="67" y="11" width="20" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="20" id="WHH-b4-kKt"/>
+                                        <constraint firstAttribute="height" constant="20" id="Ye0-5j-v5U"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vSV-nw-MRt" userLabel="Title">
+                                    <rect key="frame" x="92" y="10" width="283" height="22"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.1529411765" green="0.33333333329999998" blue="0.45098039220000002" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pCF-JC-n5h" userLabel="Text">
+                                    <rect key="frame" x="102" y="37" width="263" height="21"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Pinpoint" translatesAutoresizingMaskIntoConstraints="NO" id="BmB-4o-ng5" userLabel="Pinpoint">
+                                    <rect key="frame" x="107" y="68" width="10" height="13"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="10" id="Biy-y3-MT7"/>
+                                        <constraint firstAttribute="height" constant="13" id="OQG-JA-m2Q"/>
+                                    </constraints>
+                                </imageView>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Edl-Ib-zzS">
+                                    <rect key="frame" x="122" y="66.5" width="243" height="17"/>
+                                    <fontDescription key="fontDescription" type="italicSystem" pointSize="14"/>
+                                    <color key="textColor" red="0.32931472081218272" green="0.32931472081218272" blue="0.32931472081218272" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstItem="Edl-Ib-zzS" firstAttribute="trailing" secondItem="pCF-JC-n5h" secondAttribute="trailing" id="1VK-ft-zMD"/>
+                                <constraint firstItem="VVW-yL-wmh" firstAttribute="leading" secondItem="ko7-ge-5ca" secondAttribute="leading" constant="10" id="2bv-NZ-02c"/>
+                                <constraint firstItem="vSV-nw-MRt" firstAttribute="centerY" secondItem="VVW-yL-wmh" secondAttribute="centerY" id="4zW-mq-1iT"/>
+                                <constraint firstItem="vSV-nw-MRt" firstAttribute="leading" secondItem="pxM-Zk-Eo7" secondAttribute="trailing" constant="5" id="7KL-GL-vCQ"/>
+                                <constraint firstItem="Edl-Ib-zzS" firstAttribute="leading" secondItem="BmB-4o-ng5" secondAttribute="trailing" constant="5" id="7k0-y1-elz"/>
+                                <constraint firstItem="BmB-4o-ng5" firstAttribute="leading" secondItem="pCF-JC-n5h" secondAttribute="leading" constant="5" id="EbO-2o-ewf"/>
+                                <constraint firstItem="q6x-38-7dL" firstAttribute="centerX" secondItem="pxM-Zk-Eo7" secondAttribute="centerX" id="FOh-uA-HYL"/>
+                                <constraint firstItem="VVW-yL-wmh" firstAttribute="top" secondItem="ko7-ge-5ca" secondAttribute="top" constant="10" id="MGt-lg-S7C"/>
+                                <constraint firstItem="BmB-4o-ng5" firstAttribute="top" secondItem="pCF-JC-n5h" secondAttribute="bottom" constant="10" id="MOh-Ga-NOQ"/>
+                                <constraint firstItem="pxM-Zk-Eo7" firstAttribute="centerY" secondItem="VVW-yL-wmh" secondAttribute="centerY" id="ORZ-Cx-D0o"/>
+                                <constraint firstItem="pCF-JC-n5h" firstAttribute="width" secondItem="vSV-nw-MRt" secondAttribute="width" constant="-20" id="ZWn-od-vpP"/>
+                                <constraint firstItem="pxM-Zk-Eo7" firstAttribute="leading" secondItem="VVW-yL-wmh" secondAttribute="trailing" constant="2" id="g87-LH-Iby"/>
+                                <constraint firstItem="pCF-JC-n5h" firstAttribute="top" secondItem="vSV-nw-MRt" secondAttribute="bottom" constant="5" id="h98-Dl-4cw"/>
+                                <constraint firstAttribute="trailing" secondItem="vSV-nw-MRt" secondAttribute="trailing" id="jLW-at-0mc"/>
+                                <constraint firstItem="q6x-38-7dL" firstAttribute="top" secondItem="ko7-ge-5ca" secondAttribute="top" id="mdq-SM-9G4"/>
+                                <constraint firstItem="pCF-JC-n5h" firstAttribute="centerX" secondItem="vSV-nw-MRt" secondAttribute="centerX" id="nM3-9e-iDR"/>
+                                <constraint firstItem="Edl-Ib-zzS" firstAttribute="centerY" secondItem="BmB-4o-ng5" secondAttribute="centerY" id="olt-3s-reR"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                                    <real key="value" value="0.0"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="0.0"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="120" id="5eZ-Gg-zIC"/>
+                        <constraint firstAttribute="trailing" secondItem="ko7-ge-5ca" secondAttribute="trailing" id="H98-ZX-xoZ"/>
+                        <constraint firstItem="ko7-ge-5ca" firstAttribute="bottom" secondItem="HZR-5W-2l9" secondAttribute="bottom" id="O6V-Wc-nvy"/>
+                        <constraint firstItem="ko7-ge-5ca" firstAttribute="leading" secondItem="HZR-5W-2l9" secondAttribute="leading" id="giZ-PP-oZq"/>
+                        <constraint firstItem="q6x-38-7dL" firstAttribute="height" secondItem="HZR-5W-2l9" secondAttribute="height" id="nyx-DR-DHI"/>
+                        <constraint firstAttribute="top" secondItem="ko7-ge-5ca" secondAttribute="top" id="odh-eT-v0E"/>
+                    </constraints>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="0.0"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="HZR-5W-2l9" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Lp5-k0-ysc"/>
+                <constraint firstItem="HZR-5W-2l9" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="QJ3-of-4nA"/>
+                <constraint firstItem="HZR-5W-2l9" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="lFR-Ff-arx"/>
+            </constraints>
+        </view>
+    </objects>
+    <resources>
+        <image name="Pinpoint" width="10" height="13"/>
+        <image name="ScheduleBullet" width="12" height="12"/>
+    </resources>
+</document>

+ 189 - 0
app/ScheduleViewController.swift

@@ -0,0 +1,189 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import UIKit
+import CoreData
+
+/**
+The view controller of the app.
+*/
+class ScheduleViewController: UIViewController, UIGestureRecognizerDelegate {
+
+	// Outlets
+	@IBOutlet weak var btPrev: UIButton!
+	@IBOutlet weak var btNext: UIButton!
+	@IBOutlet weak var lbDayNumber: UILabel!
+	@IBOutlet weak var lbDayMonth: UILabel!
+	@IBOutlet weak var lbDayName: UILabel!
+	@IBOutlet weak var svScheduleList: UIStackView!
+	
+	// Margolari schedule indicator
+	var margolari: Bool = false
+	
+	// App delegate
+	var delegate: AppDelegate?
+	
+	func getContext () -> NSManagedObjectContext {
+		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
+	}
+	
+	/**
+	Run when the app loads.
+	*/
+	override func viewDidLoad() {
+		
+		NSLog(":SCHEDULECONTROLLER:LOG: Init schedule.")
+		
+		super.viewDidLoad()
+		self.loadSchedule(margolari: margolari)
+		
+		//TODO Title
+		
+		// TODO Set button action
+		//barButton.addTarget(self, action: #selector(self.back), for: .touchUpInside)
+	}
+	
+	/**
+	Returns to the main view controller.
+	*/
+	func back() {
+		NSLog(":SCHEDULECONTROLLER:DEBUG: Back")
+		self.dismiss(animated: true, completion: nil)
+	}
+	
+	
+	/**
+	Dispose of any resources that can be recreated.
+	*/
+	override func didReceiveMemoryWarning() {
+		super.didReceiveMemoryWarning()
+	}
+	
+	/**
+	Loads the schedule.
+	*/
+	public func loadSchedule(margolari: Bool){
+		
+		NSLog(":SCHEDULECONTROLLER:DEBUG: Loading schedule: Margolariak \(margolari)")
+		
+		var rowcount = 0
+		var row: RowSchedule
+		var start: NSDate
+		var title: String
+		var text: String
+		var locationId: Int
+		var location: String
+		
+		NSLog(":SCHEDULECONTROLLER:DEBUG: 1")
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let lang : String = getLanguage()
+		NSLog(":SCHEDULECONTROLLER:DEBUG: 2")
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		let fetchRequest: NSFetchRequest<Festival_event> = Festival_event.fetchRequest()
+		let sortDescriptor = NSSortDescriptor(key: "start", ascending: false)
+		let sortDescriptors = [sortDescriptor]
+		NSLog(":SCHEDULECONTROLLER:DEBUG: 3")
+		fetchRequest.sortDescriptors = sortDescriptors
+		
+		if margolari == true{
+			fetchRequest.predicate = NSPredicate(format: "gm = %i", 1)
+		}
+		else{
+			fetchRequest.predicate = NSPredicate(format: "gm = %i", 0)
+		}
+		
+		// TODO: filter by date, not by number
+		fetchRequest.fetchLimit = 20
+		
+		NSLog(":SCHEDULECONTROLLER:DEBUG: 4")
+		
+		do {
+			
+			// Get the result
+			let searchResults = try context.fetch(fetchRequest)
+			NSLog(":SCHEDULECONTROLLER:DEBUG: 5")
+			
+			NSLog(":SCHEDULECONTROLLER:DEBUG: Total events: \(searchResults.count)")
+			
+			for r in searchResults as [NSManagedObject] {
+				
+				title = r.value(forKey: "title_\(lang)") as! String
+				if let tx = r.value(forKey: "description_\(lang)"){
+					text = r.value(forKey: "description_\(lang)") as! String
+				}
+				else{
+					text = ""
+				}
+				start = r.value(forKey: "start")! as! NSDate
+				locationId = r.value(forKey: "place")! as! Int
+				row = RowSchedule.init(s: "rowSchedule\(rowcount)", i: rowcount)
+				
+				row.setTitle(text: title)
+				row.setText(text: text)
+				row.setTime(dtime: start)
+				
+				// Get location info from Place entity
+				let locationFetchRequest: NSFetchRequest<Place> = Place.fetchRequest()
+				locationFetchRequest.predicate = NSPredicate(format: "id == %i", locationId)
+				locationFetchRequest.fetchLimit = 1
+				do{
+					var locationSearchResults = try context.fetch(locationFetchRequest)
+					var locationR = locationSearchResults[0]
+					location = locationR.value(forKey: "name_\(lang)")! as! String
+					
+					row.setLocation(text: location)
+				} catch {
+					NSLog(":SCHEDULECONTROLLER:ERROR: Error getting location: \(error)")
+				}
+				
+				NSLog(":SCHEDULECONTROLLER:DEBUG: Adding row: height: \(row.frame.height)")
+				svScheduleList.addArrangedSubview(row)
+				//row.setNeedsLayout()
+				//row.layoutIfNeeded()
+				
+				rowcount = rowcount + 1
+			}
+
+			svScheduleList.setNeedsLayout()
+			svScheduleList.layoutIfNeeded()
+
+		} catch {
+			NSLog(":SCHEDULECONTROLLER:ERROR: Error with request: \(error)")
+		}
+
+	}
+	
+	/**
+	Gets the device language.
+	:return: Two letter language code of the device.
+	*/
+	func getLanguage() -> String{
+		let pre = NSLocale.preferredLanguages[0].subStr(start: 0, end: 1)
+		if(pre == "es" || pre == "en" || pre == "eu"){
+			return pre
+		}
+		else{
+			return "es"
+		}
+	}
+	
+}
+

+ 1268 - 76
app/Sync.swift

@@ -23,12 +23,15 @@ import CoreData
 import UIKit
 import UIKit
 
 
 /**
 /**
- Class to handle server sync.
- */
+Class to handle server sync.
+*/
 class Sync{
 class Sync{
 	
 	
+	var initial: Bool = false
+	
 	/**
 	/**
-	 Starts the sync process.
+	Starts the sync process.
+	Always asynchronously.
 	*/
 	*/
 	init(){
 	init(){
 		let url = buildUrl();
 		let url = buildUrl();
@@ -36,37 +39,49 @@ class Sync{
 	}
 	}
 	
 	
 	/**
 	/**
-	 Builds the URL to perform the sync against.
-	 :returns: The URL.
+	Starts the sync process, synchronously or asynchronously.
+	:param: synchronous True for synchronous sync, false for asynchronously
+	*/
+	init(synchronous: Bool){
+		if synchronous == true{
+			NSLog(":SYNC:LOG: Synchronous sync started.")
+			self.initial = true
+		}
+		let url = buildUrl();
+		sync(url: url)
+	}
+	
+	/**
+	Builds the URL to perform the sync against.
+	:returns: The URL.
 	*/
 	*/
 	func buildUrl() -> URL{
 	func buildUrl() -> URL{
 		let url = URL(string: "https://margolariak.com/API/v1/sync.php?client=com.margolariak.app")
 		let url = URL(string: "https://margolariak.com/API/v1/sync.php?client=com.margolariak.app")
 		//TODO add parameters
 		//TODO add parameters
 		return url!
 		return url!
-		
 	}
 	}
 	
 	
-	
-	
 	/**
 	/**
-	 Performs an asynchronous sync.
-	 It fethes the info from the server and stores as Core Data
-	 :param: url The url to sync.
+	Performs an asynchronous sync.
+	It fethes the info from the server and stores as Core Data
+	:param: url The url to sync.
 	*/
 	*/
 	func sync(url: URL){
 	func sync(url: URL){
 		
 		
+		NSLog(":SYNC:LOG: Sync started.")
+		
 		//Synchronously get data
 		//Synchronously get data
 		let task = URLSession.shared.dataTask(with: url) { data, response, error in
 		let task = URLSession.shared.dataTask(with: url) { data, response, error in
 			guard error == nil else {
 			guard error == nil else {
-				print("Sync error")
+				NSLog(":SYNC:ERROR: Unknown error.")
 				return
 				return
 			}
 			}
 			guard let data = data else {
 			guard let data = data else {
-				print("Data is empty")
+				NSLog(":SYNC:ERROR: Data is empty.")
 				return
 				return
 			}
 			}
 			
 			
-			print("Got the Sync JSON")
+			NSLog(":SYNC:LOG: Data received.")
 			
 			
 			var strData = String(data:data, encoding: String.Encoding.utf8)
 			var strData = String(data:data, encoding: String.Encoding.utf8)
 			
 			
@@ -80,85 +95,288 @@ class Sync{
 			let dataActivityComment : [String] = self.getTable(data: strData!, table: "activity_comment")
 			let dataActivityComment : [String] = self.getTable(data: strData!, table: "activity_comment")
 			let dataActivityImage : [String] = self.getTable(data: strData!, table: "activity_image")
 			let dataActivityImage : [String] = self.getTable(data: strData!, table: "activity_image")
 			let dataActivityTag : [String] = self.getTable(data: strData!, table: "activity_tag")
 			let dataActivityTag : [String] = self.getTable(data: strData!, table: "activity_tag")
-			//let dataAlbum : [String] = self.getTable(data: strData!, table: "album")
-			//let dataFestival : [String] = self.getTable(data: strData!, table: "festival")
-			//let dataFestivalDay : [String] = self.getTable(data: strData!, table: "festival_day")
-			//let dataFestivalEvent : [String] = self.getTable(data: strData!, table: "festival_event")
+			let dataActivityItinerary : [String] = self.getTable(data: strData!, table: "activity_itinerary")
+			let dataAlbum : [String] = self.getTable(data: strData!, table: "album")
+			let dataFestival : [String] = self.getTable(data: strData!, table: "festival")
+			let dataFestivalDay : [String] = self.getTable(data: strData!, table: "festival_day")
+			let dataFestivalEvent : [String] = self.getTable(data: strData!, table: "festival_event")
 			//let dataFestivalEventImage : [String] = self.getTable(data: strData!, table: "festival_event_image")
 			//let dataFestivalEventImage : [String] = self.getTable(data: strData!, table: "festival_event_image")
-			//let dataFestivalOffer : [String] = self.getTable(data: strData!, table: "festival_offer")
-			//let dataPeople : [String] = self.getTable(data: strData!, table: "people")
-			//let dataPhoto : [String] = self.getTable(data: strData!, table: "photo")
-			//let dataPhotoAlbum : [String] = self.getTable(data: strData!, table: "photo_album")
+			let dataFestivalOffer : [String] = self.getTable(data: strData!, table: "festival_offer")
+			let dataPeople : [String] = self.getTable(data: strData!, table: "people")
+			let dataPhoto : [String] = self.getTable(data: strData!, table: "photo")
+			let dataPhotoAlbum : [String] = self.getTable(data: strData!, table: "photo_album")
 			//let dataPhotoComment : [String] = self.getTable(data: strData!, table: "photo_comment")
 			//let dataPhotoComment : [String] = self.getTable(data: strData!, table: "photo_comment")
-			//let dataPlace : [String] = self.getTable(data: strData!, table: "place")
+			let dataPlace : [String] = self.getTable(data: strData!, table: "place")
 			let dataPost : [String] = self.getTable(data: strData!, table: "post")
 			let dataPost : [String] = self.getTable(data: strData!, table: "post")
 			let dataPostComment : [String] = self.getTable(data: strData!, table: "post_comment")
 			let dataPostComment : [String] = self.getTable(data: strData!, table: "post_comment")
 			let dataPostImage : [String] = self.getTable(data: strData!, table: "post_image")
 			let dataPostImage : [String] = self.getTable(data: strData!, table: "post_image")
 			let dataPostTag : [String] = self.getTable(data: strData!, table: "post_tag")
 			let dataPostTag : [String] = self.getTable(data: strData!, table: "post_tag")
-			//let dataSponsor : [String] = self.getTable(data: strData!, table: "sponsor")
+			let dataSponsor : [String] = self.getTable(data: strData!, table: "sponsor")
+			let dataSettings: [String] = self.getTable(data: strData!, table: "settings")
 			
 			
 			//One by one, save the received data
 			//One by one, save the received data
 			self.saveTableActivity(entries : dataActivity)
 			self.saveTableActivity(entries : dataActivity)
 			self.saveTableActivityComment(entries : dataActivityComment)
 			self.saveTableActivityComment(entries : dataActivityComment)
 			self.saveTableActivityImage(entries : dataActivityImage)
 			self.saveTableActivityImage(entries : dataActivityImage)
 			self.saveTableActivityTag(entries : dataActivityTag)
 			self.saveTableActivityTag(entries : dataActivityTag)
+			self.saveTableActivityItinerary(entries : dataActivityItinerary)
 			
 			
 			self.saveTablePost(entries: dataPost)
 			self.saveTablePost(entries: dataPost)
 			self.saveTablePostComment(entries: dataPostComment)
 			self.saveTablePostComment(entries: dataPostComment)
 			self.saveTablePostImage(entries: dataPostImage)
 			self.saveTablePostImage(entries: dataPostImage)
 			self.saveTablePostTag(entries: dataPostTag)
 			self.saveTablePostTag(entries: dataPostTag)
 			
 			
-			//TODO: Tester, Debug only
+			self.saveTablePlace(entries: dataPlace)
+			self.saveTablePeople(entries: dataPeople)
+			
+			self.saveTableAlbum(entries: dataAlbum)
+			self.saveTablePhoto(entries: dataPhoto)
+			self.saveTablePhotoAlbum(entries: dataPhotoAlbum)
+			
+			self.saveTableFestival(entries: dataFestival)
+			self.saveTableFestivalDay(entries: dataFestivalDay)
+			self.saveTableFestivalOffer(entries: dataFestivalOffer)
+			self.saveTableFestivalEvent(entries: dataFestivalEvent)
+			
+			self.saveTableSponsor(entries: dataSponsor)
+			
+			self.saveSettings(entries: dataSettings)
+			
+			
+			//DEBUG: Tester, Debug only
 			// Test if a entity has entries
 			// Test if a entity has entries
-			let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+			/*let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 			let appDelegate = UIApplication.shared.delegate as! AppDelegate
 			let appDelegate = UIApplication.shared.delegate as! AppDelegate
 			context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
 			context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
-			let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()
+			let fetchRequest: NSFetchRequest<Post> = Post.fetchRequest()  //Entity to debug
 			
 			
 			do {
 			do {
 				//go get the results
 				//go get the results
 				let searchResults = try context.fetch(fetchRequest)
 				let searchResults = try context.fetch(fetchRequest)
 				
 				
-				print ("Num of results = \(searchResults.count)")
+				NSLog(":SYNC:DEBUG: Num of results = \(searchResults.count).")
 				for r in searchResults as [NSManagedObject] {
 				for r in searchResults as [NSManagedObject] {
-					print("\(r.value(forKey: "id"))")
+					NSLog(":SYNC:DEBUG: id: \(r.value(forKey: "id")).")
 				}
 				}
 			} catch {
 			} catch {
-				print("Error with request: \(error)")
-			}
+				NSLog(":SYNC:DEBUG: Error with request: \(error).")
+			}*/
 			//End tester
 			//End tester
+			
+			// If it's the initial sync, hide the segue
+			if self.initial == true{
+				NSLog(":SYNC:LOG: Finishing synchronous sync.")
+				let delegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
+				delegate.controller?.initialSync(showScreen: false)
+				
+			}
 		}
 		}
 		
 		
 		task.resume()
 		task.resume()
-
+		
 	}
 	}
 	
 	
+	/**
+	Extracts table rows from the raw data received.
+	:param: param Received data in JSON format.
+	:param: table The name of the table to look for.
+	:return: Array of strings containing the rows of the table, in JSON format.
+	*/
 	func getTable(data: String, table: String) -> [String]{
 	func getTable(data: String, table: String) -> [String]{
 		//Does the table exists?
 		//Does the table exists?
-		if data.indexOf(target: "\"\(table)\"") == nil{
-			print("No data in table \(table)")
+		if data.indexOf(target: "\"\(table)\":[") == nil{
+			NSLog(":SYNC:LOG: Empty table: \(table).")
 			return [String]()
 			return [String]()
 		}
 		}
-		let iS : Int? = data.indexOf(target: "\"\(table)\"")
+		let iS : Int? = data.indexOf(target: "\"\(table)\":[")
 		var str = data.subStr(start: iS!, end: data.length - 1)
 		var str = data.subStr(start: iS!, end: data.length - 1)
 		let iE : Int? = str.indexOf(target: "}]}")!
 		let iE : Int? = str.indexOf(target: "}]}")!
 		str = str.subStr(start: 0, end: iE!)
 		str = str.subStr(start: 0, end: iE!)
 		str = str.subStr(start: table.length + 3,end: str.length - 1)
 		str = str.subStr(start: table.length + 3,end: str.length - 1)
-	
+		
 		//Separate the entries
 		//Separate the entries
 		var entries : [String] = str.components(separatedBy: "},{")
 		var entries : [String] = str.components(separatedBy: "},{")
-	
+		
 		//Modify the first and the last one to remove bracers
 		//Modify the first and the last one to remove bracers
 		entries[0] = entries[0].subStr(start: 1, end: entries[0].length - 1)
 		entries[0] = entries[0].subStr(start: 1, end: entries[0].length - 1)
 		entries[entries.count - 1] = entries[entries.count - 1].subStr(start: 0, end: entries[entries.count - 1].length - 2)
 		entries[entries.count - 1] = entries[entries.count - 1].subStr(start: 0, end: entries[entries.count - 1].length - 2)
-	
+		
+		NSLog(":SYNC:LOG: Table \(table) has \(entries.count) rows.")
+		
 		//Return the array
 		//Return the array
 		return entries
 		return entries
 	}
 	}
-
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTablePlace(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Place.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Place", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Place")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Places entity: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Places entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			//Get id
+			var str = entry
+			let id : Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			
+			//Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es : String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en : String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu : String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get address_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_es : String = str.subStr(start : str.indexOf(target : "\"address_es\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get address_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_en : String = str.subStr(start : str.indexOf(target : "\"address_en\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get address_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_eu : String = str.subStr(start : str.indexOf(target : "\"address_eu\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get cp
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let cp : String = str.subStr(start : str.indexOf(target : "\"cp\":")! + 6, end : str.indexOf(target : ",\"")! - 2)
+			
+			//Get lat
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let lat : Float = Float(str.subStr(start : str.indexOf(target : "\"lat\":")! + 7, end : str.indexOf(target : ",\"")! - 2))!
+			
+			//Get lon
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let lon : Float = Float(str.subStr(start : str.indexOf(target : "\"lon\":")! + 7, end : str.length - 2))!
+			
+			//Save CoreData
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			row.setValue(id, forKey: "id")
+			row.setValue(name_es, forKey: "name_es")
+			row.setValue(name_en, forKey: "name_en")
+			row.setValue(name_eu, forKey: "name_eu")
+			row.setValue(address_es, forKey: "address_es")
+			row.setValue(address_en, forKey: "address_en")
+			row.setValue(address_eu, forKey: "address_eu")
+			row.setValue(cp, forKey: "cp")
+			row.setValue(lat, forKey: "lat")
+			row.setValue(lon, forKey: "lon")
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Place with id \(id): \(error), \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Place with id \(id).")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTablePeople(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table People.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "People", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "People")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up People entity: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up People entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es: String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_es, forKey: "name_es")
+			
+			//Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en: String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_en, forKey: "name_en")
+			
+			//Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu : String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_eu, forKey: "name_eu")
+			
+			//Get link
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let link : String = str.subStr(start : str.indexOf(target : "\"link\":")! + 8, end : str.length - 2)
+			row.setValue(link, forKey: "link")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Place with id \(id): \(error), \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Place with id \(id).")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTablePost(entries : [String]){
 	func saveTablePost(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Post.")
+		
 		let dateFormatter = DateFormatter()
 		let dateFormatter = DateFormatter()
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		
 		
@@ -177,9 +395,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Post entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Post entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Post entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -230,8 +448,6 @@ class Sync{
 			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
 			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
 			let dtime = dateFormatter.date(from : str.subStr(start : str.indexOf(target : "\"dtime\":")! + 9, end : str.length - 2))!
 			let dtime = dateFormatter.date(from : str.subStr(start : str.indexOf(target : "\"dtime\":")! + 9, end : str.length - 2))!
 			
 			
-			
-			
 			//Save CoreData
 			//Save CoreData
 			row = NSManagedObject(entity: entity!, insertInto: context)
 			row = NSManagedObject(entity: entity!, insertInto: context)
 			//set the entity values
 			//set the entity values
@@ -250,16 +466,21 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Post with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Post with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Post with id \(id).")
 			}
 			}
-			
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTablePostComment(entries : [String]){
 	func saveTablePostComment(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Post_comment.")
+		
 		let dateFormatter = DateFormatter()
 		let dateFormatter = DateFormatter()
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		
 		
@@ -278,9 +499,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Post_comment entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Post_comment entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Post_comment entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -322,16 +543,22 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Activity_comment with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Activity_comment with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Activity_comment with id \(id).")
 			}
 			}
 			
 			
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTablePostImage(entries : [String]){
 	func saveTablePostImage(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Post_image.")
+		
 		//Set up context
 		//Set up context
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
@@ -347,9 +574,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Post_comment entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Post_comment entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Post_comment entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -380,15 +607,21 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Post_image with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Post_image with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Post_image with id \(id).")
 			}
 			}
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTablePostTag(entries : [String]){
 	func saveTablePostTag(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Post_tag.")
+		
 		//Set up context
 		//Set up context
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
@@ -404,9 +637,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Post_tag entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Post_tag entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Post_tag entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -427,15 +660,21 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Post_tag for post: \(post), tag: \(tag). Error: \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Post_tag for post: \(post), tag: \(tag): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Post_tag for post: \(post), tag: \(tag).")
 			}
 			}
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTableActivity(entries : [String]){
 	func saveTableActivity(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Activity.")
+		
 		let dateFormatter = DateFormatter()
 		let dateFormatter = DateFormatter()
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		
 		
@@ -454,9 +693,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Activity entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Activity entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Activity entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -573,20 +812,26 @@ class Sync{
 			if (album != -1){
 			if (album != -1){
 				row.setValue(album, forKey: "album")
 				row.setValue(album, forKey: "album")
 			}
 			}
-
+			
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Activity with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Activity with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Activity with id \(id).")
 			}
 			}
-
+			
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTableActivityComment(entries : [String]){
 	func saveTableActivityComment(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Activity_comment.")
+		
 		let dateFormatter = DateFormatter()
 		let dateFormatter = DateFormatter()
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		dateFormatter.timeZone = TimeZone.ReferenceType.local
 		
 		
@@ -605,9 +850,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Activity_comment entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Activity_comment entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Activity_comment entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -649,16 +894,22 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Activity_comment with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Activity_comment with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Activity_comment with id \(id).")
 			}
 			}
 			
 			
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTableActivityImage(entries : [String]){
 	func saveTableActivityImage(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Activity_image.")
+		
 		//Set up context
 		//Set up context
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
@@ -674,9 +925,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Activity_comment entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Activity_comment entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Activity_comment entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -707,15 +958,21 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Activity_image with id \(id) \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Activity_image with id \(id): \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Activity_image with id \(id).")
 			}
 			}
 		}
 		}
 	}
 	}
 	
 	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
 	func saveTableActivityTag(entries : [String]){
 	func saveTableActivityTag(entries : [String]){
 		
 		
+		NSLog(":SYNC:LOG: Saving table Activity_tag.")
+		
 		//Set up context
 		//Set up context
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
 		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
@@ -731,9 +988,9 @@ class Sync{
 		do {
 		do {
 			try context.execute(request)
 			try context.execute(request)
 		} catch let error as NSError  {
 		} catch let error as NSError  {
-			print("Could not clean up Activity_tag entity: \(error), \(error.userInfo)")
+			NSLog(":SYNC:ERROR: Could not clean up Activity_tag entity: \(error), \(error.userInfo).")
 		} catch {
 		} catch {
-			
+			NSLog(":SYNC:ERROR: Could not clean up Activity_tag entity.")
 		}
 		}
 		
 		
 		//Loop new entries
 		//Loop new entries
@@ -754,10 +1011,945 @@ class Sync{
 			do {
 			do {
 				try context.save()
 				try context.save()
 			} catch let error as NSError  {
 			} catch let error as NSError  {
-				print("Could not store Activity_tag for activity: \(activity), tag: \(tag). Error: \(error), \(error.userInfo)")
+				NSLog(":SYNC:ERROR: Could not store Activity_tag for activity \(activity), tag: \(tag): Error: \(error), \(error.userInfo).")
 			} catch {
 			} catch {
-				
+				NSLog(":SYNC:ERROR: Could not store Activity_tag for activity \(activity), tag: \(tag).")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	//CHECK: New (and probably better format than the others.)
+	func saveTableActivityItinerary(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Activity_itinerary.")
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Activity_itinerary", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Activity_itinerary")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Activity_itinerary entity: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Activity_itinerary entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id : Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get activity
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let activity : Int = Int(str.subStr(start : str.indexOf(target : "\"activity\":")! + 12, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(activity, forKey: "activity")
+			
+			//Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es : String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_es, forKey: "name_es")
+			
+			//Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en : String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_en, forKey: "name_en")
+			
+			//Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu : String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_eu, forKey: "name_eu")
+			
+			//Get description_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_es : String = str.subStr(start : str.indexOf(target : "\"description_es\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_es != "ul"){ //From "null"
+				row.setValue(description_es, forKey: "description_es")
+			}
+			
+			//Get description_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_en : String = str.subStr(start : str.indexOf(target : "\"description_en\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_en != "ul"){ //From "null"
+				row.setValue(description_en, forKey: "description_en")
+			}
+			
+			//Get description_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_eu : String = str.subStr(start : str.indexOf(target : "\"description_eu\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_eu != "ul"){ //From "null"
+				row.setValue(description_eu, forKey: "description_eu")
+			}
+			
+			//Get start
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+			let start = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(start, forKey: "start")
+
+			//Get end
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let end = str.subStr(start : str.indexOf(target : "\"end\":")! + 7, end : str.indexOf(target : ",\"")! - 2)
+			if (end != "ul"){ //From "null"
+				row.setValue(dateFormatter.date(from: end), forKey: "end")
+			}
+			
+			//Get place
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let place : Int = Int(str.subStr(start : str.indexOf(target : "\"place\":")! + 9, end : str.length - 2))!
+			row.setValue(place, forKey: "place")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Activity_itinerary with id \(id): \(error), \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Activity_itinerary with id \(id).")
 			}
 			}
 		}
 		}
 	}
 	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableAlbum(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Album.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Album", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Album")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Album: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Album entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id : Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get permalink
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let permalink : String = str.subStr(start : str.indexOf(target : "\"permalink\":")! + 13, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(permalink, forKey: "permalink")
+			
+			//Get title_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_es : String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_es, forKey: "title_es")
+			
+			//Get title_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_en : String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_en, forKey: "title_en")
+			
+			//Get title_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_eu : String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_eu, forKey: "title_eu")
+			
+			//Get description_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_es : String = str.subStr(start : str.indexOf(target : "\"description_es\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_es != "ul"){ //From "null"
+				row.setValue(description_es, forKey: "description_es")
+			}
+			
+			//Get description_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_en : String = str.subStr(start : str.indexOf(target : "\"description_en\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_en != "ul"){ //From "null"
+				row.setValue(description_en, forKey: "description_en")
+			}
+			
+			//Get description_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_eu : String = str.subStr(start : str.indexOf(target : "\"description_eu\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_eu != "ul"){ //From "null"
+				row.setValue(description_eu, forKey: "description_eu")
+			}
+			
+			//Get open
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let open : Int = Int(str.subStr(start : str.indexOf(target : "\"open\":")! + 8, end : str.length - 2))!
+			row.setValue(open, forKey: "open")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Album with id \(id): \(error), \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Album with id \(id).")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTablePhoto(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Photo.")
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Photo", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Photo")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Photo: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Photo entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id : Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get file
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let file : String = str.subStr(start : str.indexOf(target : "\"file\":")! + 8, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(file, forKey: "file")
+			
+			//Get permalink
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let permalink : String = str.subStr(start : str.indexOf(target : "\"permalink\":")! + 13, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(permalink, forKey: "permalink")
+			
+			//Get title_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_es : String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_es, forKey: "title_es")
+			
+			//Get title_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_en : String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_en, forKey: "title_en")
+			
+			//Get title_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_eu : String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_eu, forKey: "title_eu")
+			
+			//Get description_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_es : String = str.subStr(start : str.indexOf(target : "\"description_es\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_es != "ul"){ //From "null"
+				row.setValue(description_es, forKey: "description_es")
+			}
+			
+			//Get description_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_en : String = str.subStr(start : str.indexOf(target : "\"description_en\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_en != "ul"){ //From "null"
+				row.setValue(description_en, forKey: "description_en")
+			}
+			
+			//Get description_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_eu : String = str.subStr(start : str.indexOf(target : "\"description_eu\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_eu != "ul"){ //From "null"
+				row.setValue(description_eu, forKey: "description_eu")
+			}
+			
+			//Get uploaded
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+			let uploaded = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"uploaded\":")! + 12, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(uploaded, forKey: "uploaded")
+			
+			//TODO: Ignoting place
+			//TODO: Ignoring width
+			//TODO: Ignoring height
+			//TODO: Ignoring size
+			//TODO: Ignoring username
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Photo with id \(id): \(error), \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Photo with id \(id).")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTablePhotoAlbum(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Photo_album.")
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Photo_album", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Photo_album")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Photo_album: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Photo_album entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get photo
+			var str = entry
+			let photo : Int = Int(str.subStr(start : str.indexOf(target : "\"photo\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(photo, forKey: "photo")
+			
+			//Get album
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let album : Int = Int(str.subStr(start : str.indexOf(target : "\"album\":")! + 9, end : str.length - 2))!
+			row.setValue(album, forKey: "album")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Photo_album entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Photo_album entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableFestival(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Festival.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Festival", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Festival")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Festival: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Festival entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get year
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let file: Int = Int(str.subStr(start : str.indexOf(target : "\"year\":")! + 8, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(file, forKey: "year")
+			
+			//Get text_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_es: String = str.subStr(start : str.indexOf(target : "\"text_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_es, forKey: "text_es")
+			
+			//Get text_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_en: String = str.subStr(start : str.indexOf(target : "\"text_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_en, forKey: "text_en")
+			
+			//Get text_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_eu: String = str.subStr(start : str.indexOf(target : "\"text_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_eu, forKey: "text_eu")
+			
+			//Get summary_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let summary_es: String = str.subStr(start : str.indexOf(target : "\"summary_es\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(summary_es, forKey: "summary_es")
+			
+			//Get summary_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let summary_en: String = str.subStr(start : str.indexOf(target : "\"summary_en\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(summary_en, forKey: "summary_en")
+			
+			//Get summary_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let summary_eu: String = str.subStr(start : str.indexOf(target : "\"summary_eu\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(summary_eu, forKey: "summary_eu")
+			
+			//Get img
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let img: String = str.subStr(start : str.indexOf(target : "\"img\":")! + 7, end : str.length - 2)
+			row.setValue(img, forKey: "img")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Festival entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Festival entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableFestivalDay(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table FestivalDay.")
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Festival_day", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Festival_day")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_day: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_day entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get date
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd"
+			let date = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"date\":")! + 8, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(date, forKey: "date")
+			
+			//Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es: String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_es, forKey: "name_es")
+			
+			//Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en: String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_en, forKey: "name_en")
+			
+			//Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu: String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_eu, forKey: "name_eu")
+			
+			//Get price
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let price: Int = Int(str.subStr(start : str.indexOf(target : "\"price\":")! + 9, end : str.length - 2))!
+			row.setValue(price, forKey: "price")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Festival_day entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Festival_day entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableFestivalOffer(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table FestivalOffer.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Festival_offer", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Festival_offer")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_offer: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_offer entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			// Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			// Get year
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let year: Int = Int(str.subStr(start : str.indexOf(target : "\"year\":")! + 8, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(year, forKey: "year")
+			
+			// Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es: String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_es, forKey: "name_es")
+			
+			// Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en: String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_en, forKey: "name_en")
+			
+			// Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu: String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_eu, forKey: "name_eu")
+			
+			// Get description_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_es : String = str.subStr(start : str.indexOf(target : "\"description_es\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_es != "ul"){ //From "null"
+				row.setValue(description_es, forKey: "description_es")
+			}
+			
+			// Get description_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_en : String = str.subStr(start : str.indexOf(target : "\"description_en\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_en != "ul"){ //From "null"
+				row.setValue(description_en, forKey: "description_en")
+			}
+			
+			// Get description_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_eu : String = str.subStr(start : str.indexOf(target : "\"description_eu\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_eu != "ul"){ //From "null"
+				row.setValue(description_eu, forKey: "description_eu")
+			}
+			
+			// Get days
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let days: Int = Int(str.subStr(start : str.indexOf(target : "\"days\":")! + 8, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(days, forKey: "days")
+			
+			//Get price
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let price: Int = Int(str.subStr(start : str.indexOf(target : "\"price\":")! + 9, end : str.length - 2))!
+			row.setValue(price, forKey: "price")
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Festival_offer entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Festival_offer entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableFestivalEvent(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table FestivalEvent.")
+		
+		let dateFormatter = DateFormatter()
+		dateFormatter.timeZone = TimeZone.ReferenceType.local
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Festival_event", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Festival_event")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_event: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Festival_event entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			//Get gm
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let gm: Int = Int(str.subStr(start : str.indexOf(target : "\"gm\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(gm, forKey: "gm")
+			
+			//Get title_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_es : String = str.subStr(start : str.indexOf(target : "\"title_es\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_es, forKey: "title_es")
+			
+			//Get title_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_en : String = str.subStr(start : str.indexOf(target : "\"title_en\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_en, forKey: "title_en")
+			
+			//Get title_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let title_eu : String = str.subStr(start : str.indexOf(target : "\"title_eu\":")! + 12, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(title_eu, forKey: "title_eu")
+			
+			//Get description_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_es : String = str.subStr(start : str.indexOf(target : "\"description_es\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_es != "ul"){ //From "null"
+				row.setValue(description_es, forKey: "description_es")
+			}
+			
+			//Get description_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_en : String = str.subStr(start : str.indexOf(target : "\"description_en\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_en != "ul"){ //From "null"
+				row.setValue(description_en, forKey: "description_en")
+			}
+			
+			//Get description_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let description_eu : String = str.subStr(start : str.indexOf(target : "\"description_eu\":")! + 18, end : str.indexOf(target : ",\"")! - 2)
+			if (description_eu != "ul"){ //From "null"
+				row.setValue(description_eu, forKey: "description_eu")
+			}
+			
+			//Get host
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let strHost: String = str.subStr(start : str.indexOf(target : "\"host\":")! + 8, end : str.indexOf(target : ",\"")! - 2)
+			if (strHost != "ul"){ //From "null"
+				let host: Int = Int(strHost)!
+				row.setValue(host, forKey: "host")
+			}
+			
+			//Get place
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let place: Int = Int(str.subStr(start : str.indexOf(target : "\"place\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(place, forKey: "place")
+			
+			//Get start
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+			let start = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(start, forKey: "start")
+
+			// Get day
+			// Special item, not in the sync content
+			dateFormatter.dateFormat = "yyyy-MM-dd"
+			var day = dateFormatter.date(from: str.subStr(start : str.indexOf(target : "\"start\":")! + 9, end : str.indexOf(target : ",\"")! - 11))!
+			// If on the first hours of the next day...
+			let calendar = Calendar.current
+			let hours = calendar.component(.hour, from: day as! Date)
+			// ... the event belongs to the previous day.
+			if hours < 6{
+				day = Calendar.current.date(byAdding: .day, value: -1, to: day)!	
+			}
+			row.setValue(day, forKey: "day")
+
+			
+			//Get end
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+			let strEnd: String =  str.subStr(start : str.indexOf(target : "\"end\":")! + 7, end : str.length - 2)
+			if (strEnd != "ul"){ //From "null"
+				let end = dateFormatter.date(from: strEnd)!
+				row.setValue(end, forKey: "end")
+			}
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Festival_event entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Festival_event entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the data in the table.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveTableSponsor(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving table Sponsor.")
+		
+		//Set up context
+		let appDelegate = UIApplication.shared.delegate as! AppDelegate
+		let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
+		context.persistentStoreCoordinator = appDelegate.persistentStoreCoordinator
+		
+		let entity =  NSEntityDescription.entity(forEntityName: "Sponsor", in: context)
+		
+		var row: NSManagedObject
+		
+		//Delete all previous entries
+		let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: "Sponsor")
+		let request = NSBatchDeleteRequest(fetchRequest: fetch)
+		do {
+			try context.execute(request)
+		} catch let error as NSError  {
+			NSLog(":SYNC:ERROR: Could not clean up Sponsor: \(error), \(error.userInfo).")
+		} catch {
+			NSLog(":SYNC:ERROR: Could not clean up Sponsor entity.")
+		}
+		
+		//Loop new entries
+		for entry in entries{
+			
+			row = NSManagedObject(entity: entity!, insertInto: context)
+			
+			//Get id
+			var str = entry
+			let id: Int = Int(str.subStr(start : str.indexOf(target : "\"id\":")! + 6, end : str.indexOf(target : ",\"")! - 2))!
+			row.setValue(id, forKey: "id")
+			
+			// Get name_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_es: String = str.subStr(start : str.indexOf(target : "\"name_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_es, forKey: "name_es")
+			
+			// Get name_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_en: String = str.subStr(start : str.indexOf(target : "\"name_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_en, forKey: "name_en")
+			
+			// Get name_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let name_eu: String = str.subStr(start : str.indexOf(target : "\"name_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(name_eu, forKey: "name_eu")
+			
+			// Get text_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_es: String = str.subStr(start : str.indexOf(target : "\"text_es\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_es, forKey: "text_es")
+			
+			// Get text_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_en: String = str.subStr(start : str.indexOf(target : "\"text_en\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_en, forKey: "text_en")
+			
+			// Get text_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let text_eu: String = str.subStr(start : str.indexOf(target : "\"text_eu\":")! + 11, end : str.indexOf(target : ",\"")! - 2)
+			row.setValue(text_eu, forKey: "text_eu")
+			
+			// Get image
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let image: String = str.subStr(start : str.indexOf(target : "\"image\":")! + 9, end : str.indexOf(target : ",\"")! - 2)
+			if (image != "ul"){ //From "null"
+				row.setValue(image, forKey: "image")
+			}
+			
+			// Get address_es
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_es: String = str.subStr(start : str.indexOf(target : "\"address_es\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			if (address_es != "ul"){ //From "null"
+				row.setValue(address_es, forKey: "address_es")
+			}
+			
+			// Get address_en
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_en: String = str.subStr(start : str.indexOf(target : "\"address_en\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			if (address_en != "ul"){ //From "null"
+				row.setValue(address_en, forKey: "address_en")
+			}
+			
+			// Get address_eu
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let address_eu: String = str.subStr(start : str.indexOf(target : "\"address_eu\":")! + 14, end : str.indexOf(target : ",\"")! - 2)
+			if (address_eu != "ul"){ //From "null"
+				row.setValue(address_eu, forKey: "address_eu")
+			}
+			
+			//Get link
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let link: String = str.subStr(start : str.indexOf(target : "\"link\":")! + 8, end : str.indexOf(target : ",\"")! - 2)
+			if (link != "ul"){ //From "null"
+				row.setValue(link, forKey: "link")
+			}
+			
+			//Get lat
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let strLat: String = str.subStr(start : str.indexOf(target : "\"lat\":")! + 7, end : str.indexOf(target : ",\"")! - 2)
+			if (strLat != "ul"){ //From "null"
+				let lat: Float = Float(str.subStr(start : str.indexOf(target : "\"lat\":")! + 7, end : str.indexOf(target : ",\"")! - 2))!
+				row.setValue(lat, forKey: "lat")
+			}
+			
+			//Get lon
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let strLon: String = str.subStr(start : str.indexOf(target : "\"lon\":")! + 7, end : str.length - 2)
+			if (strLon != "ul"){ //From "null"
+				let lon: Float = Float(str.subStr(start : str.indexOf(target : "\"lon\":")! + 7, end : str.length - 2))!
+				row.setValue(lon, forKey: "lon")
+			}
+			
+			//Save CoreData
+			do {
+				try context.save()
+			} catch let error as NSError  {
+				NSLog(":SYNC:ERROR: Could not store Sponsor entry \(error.userInfo).")
+			} catch {
+				NSLog(":SYNC:ERROR: Could not store Sponsor entry.")
+			}
+		}
+	}
+	
+	/**
+	Saves the received settings.
+	:param: entries Array of strings containing the rows of the table, in JSON format.
+	*/
+	func saveSettings(entries : [String]){
+		
+		NSLog(":SYNC:LOG: Saving settings.")
+		let defaults = UserDefaults.standard
+		
+		// Loop new entries
+		for entry in entries{
+			
+			// Get setting name
+			var str = entry
+			let name: String = str.subStr(start : str.indexOf(target : "\"name\":")! + 8, end : str.indexOf(target : ",\"")! - 2)
+			
+			// Get setting value
+			str = str.subStr(start : str.indexOf(target : ",\"")! + 1, end : str.length - 1)
+			let value: Int = Int(str.subStr(start : str.indexOf(target : "\"value\":")! + 9, end : str.length - 2))!
+			
+			// Save only the needed settings
+			if ["festivals", "comments", "photos"].contains(name){
+				NSLog(":SYNC:LOG: Setting \(name) \(value)")
+				defaults.set(value, forKey: name)
+			}
+
+		}
+	}
 }
 }

+ 42 - 0
app/UIApplcation.swift

@@ -0,0 +1,42 @@
+// Copyright (C) 2016 Inigo Valentin
+//
+// This file is part of the Gasteizko Margolariak IOS app.
+//
+// The Gasteizko Margolariak IOS app is free software: you can
+// redistribute it and/or modify it under the terms of the
+// GNU General Public License as published by the Free Software
+// Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// The Gasteizko Margolariak IOS app is distributed in the
+// hope that it will be useful, but WITHOUT ANY WARRANTY;
+// without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+// Public License for more details.
+//
+// You should have received a copy of the GNU General Public
+// License along with the Gasteizko Margolariak IOS app.
+// If not, see <http://www.gnu.org/licenses/>.
+
+import Foundation
+import UIKit
+
+/**
+Extension of UIApplication to get the root view controller.
+*/
+extension UIApplication {
+	class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
+		if let navigationController = controller as? UINavigationController {
+			return topViewController(controller: navigationController.visibleViewController)
+		}
+		if let tabController = controller as? UITabBarController {
+			if let selected = tabController.selectedViewController {
+				return topViewController(controller: selected)
+			}
+		}
+		if let presented = controller?.presentedViewController {
+			return topViewController(controller: presented)
+		}
+		return controller
+	}
+}

+ 66 - 6
app/UIImageView.swift

@@ -40,14 +40,74 @@ extension UIImageView {
 		let filePath = url.appendingPathComponent(localPath)?.path
 		let filePath = url.appendingPathComponent(localPath)?.path
 		let fileManager = FileManager.default
 		let fileManager = FileManager.default
 		if fileManager.fileExists(atPath: filePath!) {
 		if fileManager.fileExists(atPath: filePath!) {
-			print("FILE AVAILABLE: \(filePath)")
-			//TODO Set image
+			print("IMAGE:LOG: File available: \(filePath)")
+			
+			//Set image
+			do{
+				//let iurl = URL(string: filePath!)
+				let idata = try Data(contentsOf: URL(fileURLWithPath: filePath!))
+				self.image = UIImage(data: idata as Data)
+			}
+			catch (let error){
+				print("IMAGE:ERROR: Error setting image: \(error.localizedDescription)")
+				return -1
+			}
 			return 0
 			return 0
 		} else {
 		} else {
-			print("FILE NOT AVAILABLE: \(filePath)")
-			print("Downloading from \(remotePath)")
-			//TODO Download
-			//TODO Set image
+			print("IMAGE:LOG: File not available: \(filePath)")
+			print("IMAGE:LOG: Downloading from \(remotePath)")
+			
+			//Create required directories
+			var fileFolderUrl = URL(fileURLWithPath: filePath!)
+			fileFolderUrl.deleteLastPathComponent()
+			do{
+				try fileManager.createDirectory(at:  fileFolderUrl, withIntermediateDirectories: true, attributes: nil)
+			}
+			catch(let error){
+				print("IMAGE:ERROR: Error creating directories at \(fileFolderUrl.path): \(error.localizedDescription)")
+			}
+			
+			// Create destination URL
+			let destinationFileUrl = URL(fileURLWithPath: filePath!)
+			
+			//Create URL to the source file you want to download
+			let fileURL = URL(string: remotePath)
+			
+			let sessionConfig = URLSessionConfiguration.default
+			let session = URLSession(configuration: sessionConfig)
+			
+			let request = URLRequest(url:fileURL!)
+			
+			let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
+				if let tempLocalUrl = tempLocalUrl, error == nil {
+					
+					// Success
+					if let statusCode = (response as? HTTPURLResponse)?.statusCode {
+						print("IMAGE:LOG: Successfully downloaded. Status code: \(statusCode)")
+					}
+					
+					do {
+						try FileManager.default.copyItem(at: tempLocalUrl, to: destinationFileUrl)
+					} catch (let writeError) {
+						print("IMAGE:ERROR: Error creating a file \(destinationFileUrl) : \(writeError)")
+					}
+					
+					// Set the image
+					do{
+						let idata = try Data(contentsOf: URL(fileURLWithPath: filePath!))
+						self.image = UIImage(data: idata as Data)
+					}
+					catch (let error){
+						print("IMAGE:ERROR: Error setting image: \(error.localizedDescription)")
+					}
+					
+				} else {
+					print("IMAGE:ERROR: Error took place while downloading a file: %@", error?.localizedDescription);
+				}
+			}
+			task.resume()
+		
+		
 			return 1
 			return 1
 		}
 		}
 
 

+ 16 - 0
app/UIView.swift

@@ -59,4 +59,20 @@ import UIKit
 			return layer.cornerRadius
 			return layer.cornerRadius
 		}
 		}
 	}
 	}
+	
+	var parentViewController: ViewController? {
+		var parentResponder: UIResponder? = self
+		var i = 0
+		while parentResponder != nil {
+			print("UIVIEW:DEBUG: parentViewController level \(i)")
+			parentResponder = parentResponder!.next
+			if let viewController = parentResponder as? ViewController {
+				print("UIVIEW:DEBUG: parentViewController found  controller.")
+				return viewController
+			}
+		}
+		print("UIVIEW:DEBUG: parentViewController no controller found.")
+		return nil
+	}
+	
 }
 }

+ 159 - 10
app/ViewController.swift

@@ -24,25 +24,121 @@ import CoreData
 /**
 /**
   The view controller of the app.
   The view controller of the app.
  */
  */
-class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
+class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UIGestureRecognizerDelegate {
+	
+	var delegate: AppDelegate?
 	
 	
 	//The menu collection.
 	//The menu collection.
 	var sectionCollection: UICollectionView!
 	var sectionCollection: UICollectionView!
+	
+	// Need to save the sync segue.
+	var syncSegue: UIStoryboardSegue?
 
 
 	//Each of the sections of the app.
 	//Each of the sections of the app.
-	@IBOutlet weak var containerViewGallery: UIView!
-	@IBOutlet weak var containerViewBlog: UIView!
-	@IBOutlet weak var containerViewActivities: UIView!
-	@IBOutlet weak var containerViewLablanca: UIView!
-	@IBOutlet weak var containerViewLocation: UIView!
-	@IBOutlet weak var containerViewHome: HomeView!
+	@IBOutlet var containerViewGallery: GalleryView!
+	@IBOutlet var containerViewBlog: BlogView!
+	@IBOutlet var containerViewActivities: ActivitiesView!
+	@IBOutlet var containerViewLablanca: LablancaView!
+	@IBOutlet var containerViewLocation: UIView!
+	@IBOutlet var containerViewHome: HomeView!
+	
+	var passId: Int = -1
+	
+	/**
+	 Controller initializer.
+	*/
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+	}
 	
 	
+	/**
+	 Retrieves the application context.
+	 :return: The application context.
+	*/
 	func getContext () -> NSManagedObjectContext {
 	func getContext () -> NSManagedObjectContext {
 		//let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		//let appDelegate = UIApplication.shared.delegate as! AppDelegate
 		//return appDelegate.persistentContainer.viewContext
 		//return appDelegate.persistentContainer.viewContext
 		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
 		return NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
 	}
 	}
 	
 	
+	/**
+	 Shows a post by loading the controller.
+	 :param: id The post id.
+	*/
+	func showPost(id: Int){
+		NSLog(":CONTROLLER:DEBUG: Showing Post \(id)")
+		self.passId = id
+		performSegue(withIdentifier: "SeguePost", sender: nil)
+	}
+	
+	/**
+	 Shows a post by loading the controller.
+	 :param: id The album id.
+	*/
+	func showAlbum(id: Int){
+		NSLog(":CONTROLLER:DEBUG: Showing album \(id)")
+		self.passId = id
+		performSegue(withIdentifier: "SegueAlbum", sender: nil)
+	}
+	
+	func showSchedule(margolari: Bool){
+		NSLog(":CONTROLLER:DEBUG: Showing schedule. Margolari: \(margolari)")
+		if margolari == true{
+			self.passId = 1
+		}
+		else{
+			self.passId = 0
+		}
+		// TODO: Uncomment when ready
+		performSegue(withIdentifier: "SegueSchedule", sender: nil)
+	}
+	
+	/**
+	 Handles the initial sync process.
+	 It can start it, showing the sync screen, or finish it, hidding the screen.
+	 :param: showScreen True to start the sync, false to end it.
+	*/
+	func initialSync(showScreen: Bool){
+		if showScreen == true{
+			NSLog(":CONTROLLER:DEBUG: Showing initial sync screen.")
+			performSegue(withIdentifier: "SegueSync", sender: nil)
+			Sync(synchronous: true)
+		}
+		else{
+			NSLog(":CONTROLLER:DEBUG: Re-populating views and hidding initial sync screen.")
+			NSLog(":CONTROLLER:DEBUG: Re-populating disabled: Throws error.")
+			//populate()
+			syncSegue?.destination.dismiss(animated: true, completion: nil)
+		}
+	}
+	
+	/**
+	 Run before performing a segue.
+	 Assigns id if neccessary.
+	 :param: segue The segue to perform.
+	 :sender: The calling view.
+	*/
+	override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+		NSLog(":CONTROLLER:DEBUG: preparing for segue '\(segue.identifier)' with id \(self.passId)")
+		if segue.identifier == "SeguePost"{
+			(segue.destination as! PostViewController).id = passId
+		}
+		if segue.identifier == "SegueAlbum"{
+			(segue.destination as! AlbumViewController).id = passId
+		}
+		if segue.identifier == "SegueSchedule"{
+			if passId == 1{
+				(segue.destination as! ScheduleViewController).margolari = true
+			}
+			else{
+				(segue.destination as! ScheduleViewController).margolari = false
+			}
+		}
+		if segue.identifier == "SegueSync"{
+			self.syncSegue = segue
+		}
+	}
+	
 	/**
 	/**
 	 Run when the app loads.
 	 Run when the app loads.
 	*/
 	*/
@@ -55,11 +151,64 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		self.containerViewBlog.alpha = 0
 		self.containerViewBlog.alpha = 0
 		self.containerViewGallery.alpha = 0
 		self.containerViewGallery.alpha = 0
 				
 				
-		print("ViewController:viewDidLoad()")
-		Sync()
+		NSLog(":CONTROLLER:LOG: viewDidLoad()")
+		NSLog(":CONTROLLER:DEBUG: Skyp sync")
+		//Sync()
 		
 		
 		super.viewDidLoad()
 		super.viewDidLoad()
-		// Do any additional setup after loading the view, typically from a nib.
+
+		//self.containerViewBlog.setController(controller: self as ViewController)
+		
+		delegate = UIApplication.shared.delegate as! AppDelegate
+		delegate?.controller = self
+		
+	}
+
+	func populate(){
+		//self.containerViewHome.populate()
+		//self.containerLocation.populate()
+		//self.containerLablanca.populate()
+		self.containerViewActivities.populate()
+		self.containerViewBlog.populate()
+		//self.containerGallery.populate()
+	}
+	
+	/**
+	 Executed when the view is actually shown.
+	 Performs the initial sync in the first run.
+	 It also generates a user id if none exists.
+	 :param: animated Wether the controller appearance must be animated or not.
+	*/
+	override func viewDidAppear(_ animated: Bool) {
+		super.viewDidAppear(animated)
+		if UserDefaults.standard.object(forKey: "userId") == nil{
+			let newUid = randomString(length: 16)
+			let defaults = UserDefaults.standard
+			defaults.set(newUid, forKey: "userId")
+			initialSync(showScreen: true)
+		}
+		
+	}
+	
+	/**
+	 Generates a random string to be used as a user identifier.
+	 :param: length The length of the generated string.
+	 :return: A random alphanumeric string with the indicated length.
+	*/
+	func randomString(length: Int) -> String {
+		
+		let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+		let len = UInt32(letters.length)
+		
+		var randomString = ""
+		
+		for _ in 0 ..< length {
+			let rand = arc4random_uniform(len)
+			var nextChar = letters.character(at: Int(rand))
+			randomString += NSString(characters: &nextChar, length: 1) as String
+		}
+		
+		return randomString
 	}
 	}
 
 
 	/**
 	/**

+ 15 - 5
app/app.xcdatamodeld/app.xcdatamodel/contents

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11759" systemVersion="16B2657" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
+<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="12141" systemVersion="16E195" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
     <entity name="Activity" representedClassName=".Activity" syncable="YES" codeGenerationType="class">
     <entity name="Activity" representedClassName=".Activity" syncable="YES" codeGenerationType="class">
         <attribute name="after_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="after_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="after_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="after_es" optional="YES" attributeType="String" syncable="YES"/>
@@ -53,6 +53,7 @@
         <attribute name="tag" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="tag" optional="YES" attributeType="String" syncable="YES"/>
     </entity>
     </entity>
     <entity name="Album" representedClassName=".Album" syncable="YES" codeGenerationType="class">
     <entity name="Album" representedClassName=".Album" syncable="YES" codeGenerationType="class">
+        <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
@@ -80,14 +81,15 @@
         <attribute name="name_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="name_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="name_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="name_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="name_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="name_eu" optional="YES" attributeType="String" syncable="YES"/>
-        <attribute name="price" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="price" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
     </entity>
     </entity>
     <entity name="Festival_event" representedClassName=".Festival_event" syncable="YES" codeGenerationType="class">
     <entity name="Festival_event" representedClassName=".Festival_event" syncable="YES" codeGenerationType="class">
+        <attribute name="day" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="end" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
         <attribute name="end" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
-        <attribute name="gm" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
+        <attribute name="gm" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="host" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="host" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="place" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
         <attribute name="place" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
@@ -133,6 +135,13 @@
         <attribute name="title_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="title_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="title_eu" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="title_eu" optional="YES" attributeType="String" syncable="YES"/>
     </entity>
     </entity>
+    <entity name="People" representedClassName="People" syncable="YES" codeGenerationType="class">
+        <attribute name="id" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
+        <attribute name="link" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_en" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_es" optional="YES" attributeType="String" syncable="YES"/>
+        <attribute name="name_eu" optional="YES" attributeType="String" syncable="YES"/>
+    </entity>
     <entity name="Photo" representedClassName=".Photo" syncable="YES" codeGenerationType="class">
     <entity name="Photo" representedClassName=".Photo" syncable="YES" codeGenerationType="class">
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_en" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
         <attribute name="description_es" optional="YES" attributeType="String" syncable="YES"/>
@@ -224,10 +233,10 @@
         <element name="Activity_image" positionX="-36" positionY="-3897" width="128" height="105"/>
         <element name="Activity_image" positionX="-36" positionY="-3897" width="128" height="105"/>
         <element name="Activity_itinerary" positionX="-18" positionY="-3888" width="128" height="210"/>
         <element name="Activity_itinerary" positionX="-18" positionY="-3888" width="128" height="210"/>
         <element name="Activity_tag" positionX="0" positionY="-3852" width="128" height="75"/>
         <element name="Activity_tag" positionX="0" positionY="-3852" width="128" height="75"/>
-        <element name="Album" positionX="18" positionY="-3861" width="128" height="180"/>
+        <element name="Album" positionX="18" positionY="-3861" width="128" height="195"/>
         <element name="Festival" positionX="36" positionY="-3852" width="128" height="180"/>
         <element name="Festival" positionX="36" positionY="-3852" width="128" height="180"/>
         <element name="Festival_day" positionX="-9" positionY="-3906" width="128" height="135"/>
         <element name="Festival_day" positionX="-9" positionY="-3906" width="128" height="135"/>
-        <element name="Festival_event" positionX="0" positionY="-3897" width="128" height="225"/>
+        <element name="Festival_event" positionX="0" positionY="-3897" width="128" height="240"/>
         <element name="Festival_event_image" positionX="9" positionY="-3888" width="128" height="105"/>
         <element name="Festival_event_image" positionX="9" positionY="-3888" width="128" height="105"/>
         <element name="Festival_offer" positionX="18" positionY="-3879" width="128" height="195"/>
         <element name="Festival_offer" positionX="18" positionY="-3879" width="128" height="195"/>
         <element name="Location" positionX="27" positionY="-3870" width="128" height="90"/>
         <element name="Location" positionX="27" positionY="-3870" width="128" height="90"/>
@@ -241,5 +250,6 @@
         <element name="Post_tag" positionX="45" positionY="-3852" width="128" height="75"/>
         <element name="Post_tag" positionX="45" positionY="-3852" width="128" height="75"/>
         <element name="Sponsor" positionX="-9" positionY="-3906" width="128" height="255"/>
         <element name="Sponsor" positionX="-9" positionY="-3906" width="128" height="255"/>
         <element name="Version" positionX="-9" positionY="-3906" width="128" height="75"/>
         <element name="Version" positionX="-9" positionY="-3906" width="128" height="75"/>
+        <element name="People" positionX="-9" positionY="-3906" width="128" height="120"/>
     </elements>
     </elements>
 </model>
 </model>