Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Example/LUX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
6410ADE325993FD100022E72 /* UIColor+HexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6410ADE225993FD100022E72 /* UIColor+HexTests.swift */; };
6410ADE7259942A500022E72 /* CollectionViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6410ADE6259942A500022E72 /* CollectionViewModelTests.swift */; };
6410ADEB2599480300022E72 /* LUXSessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6410ADEA2599480300022E72 /* LUXSessionTests.swift */; };
64133B2526AF6E3C003B61DC /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 64133B2426AF6E3C003B61DC /* StoreKit.framework */; };
64133B2826AF8BC8003B61DC /* Configuration.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 64133B2626AF6E68003B61DC /* Configuration.storekit */; };
6418E0D825AA77480050BEFB /* LUXTableViewCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6418E0D725AA77480050BEFB /* LUXTableViewCellTests.swift */; };
6418E0DC25AA7ED40050BEFB /* LoginViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6418E0DB25AA7ED40050BEFB /* LoginViewControllerTests.swift */; };
6418E0E025AA9E530050BEFB /* LUXCollectionViewCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6418E0DF25AA9E530050BEFB /* LUXCollectionViewCellTests.swift */; };
Expand Down Expand Up @@ -107,6 +109,9 @@
6410ADE225993FD100022E72 /* UIColor+HexTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+HexTests.swift"; sourceTree = "<group>"; };
6410ADE6259942A500022E72 /* CollectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewModelTests.swift; sourceTree = "<group>"; };
6410ADEA2599480300022E72 /* LUXSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LUXSessionTests.swift; sourceTree = "<group>"; };
64133B2426AF6E3C003B61DC /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
64133B2626AF6E68003B61DC /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Configuration.storekit; sourceTree = "<group>"; };
64133B2726AF6F5F003B61DC /* Subscriptions.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Subscriptions.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
6418E0D725AA77480050BEFB /* LUXTableViewCellTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LUXTableViewCellTests.swift; sourceTree = "<group>"; };
6418E0DB25AA7ED40050BEFB /* LoginViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewControllerTests.swift; sourceTree = "<group>"; };
6418E0DF25AA9E530050BEFB /* LUXCollectionViewCellTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LUXCollectionViewCellTests.swift; sourceTree = "<group>"; };
Expand All @@ -132,6 +137,7 @@
buildActionMask = 2147483647;
files = (
B5DDDA9015D5B0752B631707 /* Pods_LUX_Example.framework in Frameworks */,
64133B2526AF6E3C003B61DC /* StoreKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -149,6 +155,7 @@
1D9211F776B1E433C8B86795 /* Frameworks */ = {
isa = PBXGroup;
children = (
64133B2426AF6E3C003B61DC /* StoreKit.framework */,
B42B4BEA58B69C8BD8FE4014 /* Pods_LUX_Example.framework */,
84AB7549E70A7D5F45143895 /* Pods_LUX_Tests.framework */,
);
Expand Down Expand Up @@ -180,6 +187,7 @@
607FACD21AFB9204008FA782 /* Example for LUX */ = {
isa = PBXGroup;
children = (
64133B2726AF6F5F003B61DC /* Subscriptions.playground */,
64E57AAF261CD70300FF91C8 /* MultiSizeCollectionVIewLayout.playground */,
49CBFADB2540F8250007D7E6 /* CollectionViewModel.playground */,
491D44E2244A29F1009D6A3A /* SectionTableViewModel.playground */,
Expand All @@ -195,6 +203,7 @@
607FACDC1AFB9204008FA782 /* Images.xcassets */,
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
607FACD31AFB9204008FA782 /* Supporting Files */,
64133B2626AF6E68003B61DC /* Configuration.storekit */,
);
name = "Example for LUX";
path = LUX;
Expand Down Expand Up @@ -369,6 +378,7 @@
buildActionMask = 2147483647;
files = (
49D3C363239C414700D59DF0 /* config.yml in Resources */,
64133B2826AF8BC8003B61DC /* Configuration.storekit in Resources */,
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
ReferencedContainer = "container:LUX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<StoreKitConfigurationFileReference
identifier = "../LUX/Configuration.storekit">
</StoreKitConfigurationFileReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
93 changes: 93 additions & 0 deletions Example/LUX/Configuration.storekit
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"identifier" : "3A04A699",
"nonRenewingSubscriptions" : [

],
"products" : [

],
"settings" : {

},
"subscriptionGroups" : [
{
"id" : "D4D7ADB7",
"localizations" : [

],
"name" : "Test Subscriptions",
"subscriptions" : [
{
"adHocOffers" : [

],
"displayPrice" : "0.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "5E311D41",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "This is a monthly subscription.",
"displayName" : "Monthly Subscription",
"locale" : "en_US"
}
],
"productID" : "com.LUX.monthly",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Monthly Subscription",
"subscriptionGroupID" : "D4D7ADB7",
"type" : "RecurringSubscription"
},
{
"adHocOffers" : [

],
"displayPrice" : "5.00",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "CE003214",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "This is a 6 Month subscription.",
"displayName" : "6 Months Subscription",
"locale" : "en_US"
}
],
"productID" : "com.LUX.biyearly",
"recurringSubscriptionPeriod" : "P6M",
"referenceName" : "BiYearly Subscription",
"subscriptionGroupID" : "D4D7ADB7",
"type" : "RecurringSubscription"
},
{
"adHocOffers" : [

],
"displayPrice" : "9",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "6F4B3CA8",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "This is a yearly subscription.",
"displayName" : "Yearly Subscription",
"locale" : "en_US"
}
],
"productID" : "com.LUX.yearly",
"recurringSubscriptionPeriod" : "P1Y",
"referenceName" : "Yearly Subscription",
"subscriptionGroupID" : "D4D7ADB7",
"type" : "RecurringSubscription"
}
]
}
],
"version" : {
"major" : 1,
"minor" : 1
}
}
5 changes: 3 additions & 2 deletions Example/LUX/SectionTableViewModel.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FlexDataSource
import LithoOperators
import PlaygroundVCHelpers
import fuikit
import LithoUtils

//Models
enum House: String, Codable, CaseIterable {
Expand Down Expand Up @@ -66,7 +67,7 @@ let emperorConfigurator: (Emperor, UITableViewCell) -> Void = { emperor, cell in
}

//linking models to views
let emperorToItemCreator: (@escaping (Emperor) -> Void) -> (Emperor) -> FlexDataSourceItem = { onTap in emperorConfigurator >||> (onTap >|||> LUXTappableModelItem.init) }
let emperorToItemCreator: (@escaping (Emperor) -> Void) -> (Emperor) -> FlexDataSourceItem = { onTap in emperorConfigurator -*> (onTap --*> LUXTappableModelItem.init) }
func reignToSection(_ emperorToItem: @escaping (Emperor) -> FlexDataSourceItem) -> (Reign) -> FlexDataSourceSection {
return {
let section = FlexDataSourceSection()
Expand All @@ -92,7 +93,7 @@ let cycleSignal: AnyPublisher<Cycle, Never> = modelPublisher(from: dataSignal)
let cancel = cycleSignal.sink { vc.title = "\($0.ordinal ?? 0)th Cycle" }

let refreshManager = LUXRefreshableNetworkCallManager(call)
let vm = LUXSectionsTableViewModel(refreshManager, modelsSignal.map(reignToSection(emperorToItemCreator(onTap)) >||> map).eraseToAnyPublisher())
let vm = LUXSectionsTableViewModel(refreshManager, modelsSignal.map(reignToSection(emperorToItemCreator(onTap)) -*> map).eraseToAnyPublisher())
let cancel3 = dataSignal.sink { _ in vm.endRefreshing() }

vm.tableDelegate = FUITableViewDelegate(onSelect: (vm.dataSource as! FlexDataSource).tappableOnSelect)
Expand Down
36 changes: 36 additions & 0 deletions Example/LUX/Subscriptions.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import UIKit
import LUX
import PlaygroundVCHelpers
import FunNet
import PlaygroundSupport
import Slippers
import LithoOperators
import Prelude
import fuikit
import StoreKit

let vc = LUXSubscriptionViewController.makeFromXIB(name: "LUXSubscriptionViewController", bundle: Bundle(for: LUXSubscriptionViewController.self))

struct StoreKitIdentifiers: Codable {
var identifiers: [String]
}

let call = CombineNetCall(configuration: ServerConfiguration(host: "lithobyte.co", apiRoute: "api/v1"), Endpoint())
call.firingFunc = { call in
call.publisher.data = JsonProvider.encode(StoreKitIdentifiers(identifiers: ["com.LUX.monthly", "com.LUX.biyearly", "com.LUX.yearly"]))
}

let delegate = LUXSubscriptionDelegate()

vc.onViewDidLoad = { (vc: FUITableViewViewController) in
delegate.fetchProducts(from: call, unwrapper: ^\StoreKitIdentifiers.identifiers)
}
let vm = subscriptionViewModel(onTap: { print($0.localizedTitle) }, delegate: delegate)
vc.onViewDidAppear = { (vc: FUITableViewViewController, animated: Bool) in
vm.tableView = vc.tableView
vm.tableView?.reloadData()
vm.refresh()
}

PlaygroundPage.current.liveView = vc
PlaygroundPage.current.needsIndefiniteExecution = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason I can't get the products to show up in the tableview, but I think that's because it's in a playground rather than a project. I'm having a hard time finding any help online (pretty niche situation) but i'll keep at it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playgrounds do have that issue – have you logged/messed with the view to make sure it's getting displayed?

4 changes: 4 additions & 0 deletions Example/LUX/Subscriptions.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>
8 changes: 7 additions & 1 deletion Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PODS:
- LUX/CollectionViews (= 0.2.20)
- LUX/Networking (= 0.2.20)
- LUX/Search (= 0.2.20)
- LUX/StoreKit (= 0.2.20)
- LUX/TableViews (= 0.2.20)
- LUX/Utilities (= 0.2.20)
- LUX/AppOpenFlow (0.2.20):
Expand Down Expand Up @@ -83,6 +84,11 @@ PODS:
- LithoUtils/Core
- LUX/BaseSearch
- LUX/TableViews
- LUX/StoreKit (0.2.20):
- FlexDataSource
- LithoOperators
- LithoUtils/Core
- PlaygroundVCHelpers
- LUX/TableViews (0.2.20):
- LithoUtils/Core
- LUX/BaseTableViews
Expand Down Expand Up @@ -161,7 +167,7 @@ SPEC CHECKSUMS:
FunNet: e66d2df77a5663556970a1914c5911ecde2842ef
LithoOperators: 8fc0c6a49e34a8d1ca01b777844f58e36c062d9f
LithoUtils: 672d313a7fede3968e22f082b293cbc01ebcb7f0
LUX: 98b3495fc34d7fdb4ec47b4ad5a9d69e5838343d
LUX: 801e4c9f28b4989704d3fc2d741093799f0813a3
PlaygroundVCHelpers: c7cc8994d2851ebd1590217101b4c6888d1c9cc8
Prelude: fe4cc0fd961d34edf48fe6b04d05c863449efb0a
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
Expand Down
9 changes: 9 additions & 0 deletions LUX.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,13 @@ Pod::Spec.new do |s|
sp.dependency 'LUX/BaseSearch'
end

s.subspec 'StoreKit' do |sp|
sp.source_files = 'LUX/Classes/StoreKit/**/*.swift'
sp.resources = 'LUX/Classes/StoreKit/**/*.xib'
sp.ios.deployment_target = '13.0'
sp.dependency 'FlexDataSource'
sp.dependency 'LithoOperators'
sp.dependency 'PlaygroundVCHelpers'
end

end
Loading