Manos Chorianopoulos

add mfy category sections

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -13,6 +13,7 @@
1E108A9528A3F9280008B8E7 /* pf_square_sans_pro_bold_italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E108A9028A3F9280008B8E7 /* pf_square_sans_pro_bold_italic.ttf */; };
1E108A9628A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */; };
1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; };
1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; };
1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; };
1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */; };
1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; };
......@@ -174,6 +175,7 @@
1E108A9028A3F9280008B8E7 /* pf_square_sans_pro_bold_italic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = pf_square_sans_pro_bold_italic.ttf; sourceTree = "<group>"; };
1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = pf_square_sans_pro_bold.ttf; sourceTree = "<group>"; };
1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; };
1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; };
1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualViewController.swift; sourceTree = "<group>"; };
1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; };
......@@ -462,6 +464,7 @@
E6A77A35282BB4CB0045BBA8 /* MakeItAPresentViewController.swift */,
E6A7785A282933E40045BBA8 /* Helpers */,
E6A77861282933E50045BBA8 /* Main.storyboard */,
1E4410B028F5855000859F92 /* CampaignCategory.swift */,
1EDCDFAB28DB29E8002ED8F0 /* AnalysisMoreViewCell.swift */,
1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */,
1EB236AA28816B680063777A /* ShareViewController.swift */,
......@@ -943,6 +946,7 @@
E6A7794A282933E70045BBA8 /* FMDatabaseAdditions.m in Sources */,
E6A77903282933E60045BBA8 /* WLAPSItem.m in Sources */,
1ECA079128D9E3BA00D2BDE0 /* CSMButton.swift in Sources */,
1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */,
E6A7790B282933E60045BBA8 /* WLPushManager.m in Sources */,
A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */,
E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */,
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
//
// CampaignCategory.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 11/10/22.
//
import Foundation
public class CampaignCategory: Codable {
// attributes
public var name: String?
public var index: Int
public var items: Array<swiftApi.CampaignItemModel>
// initialization
public init(_ name: String) {
self.name = name == "ΑΛΛΕΣ" ? name : String(name.dropFirst())
self.index = Int(name.prefix(1)) ?? 0
self.items = [swiftApi.CampaignItemModel]()
}
public init(_ name: String, index: Int) {
self.name = name == "ΑΛΛΕΣ" ? name : String(name.dropFirst())
self.index = index
self.items = [swiftApi.CampaignItemModel]()
}
}
enum CampaignCategoryFactory {
static func create(withTitle title: String) -> CampaignCategory {
var index = 100
let indexChr:Character = title[title.index(title.startIndex, offsetBy: 1)]
if indexChr.isNumber {
index = indexChr.wholeNumberValue!
}
return CampaignCategory(title, index: index)
}
}