Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make framework compatible with carthage #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
platform :ios, '9.0'

target 'TRMosaicLayout_Example' do
pod 'TRMosaicLayout', :path => '../'
Expand Down
10 changes: 5 additions & 5 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- TRMosaicLayout (0.2.0)
- TRMosaicLayout (1.0.0)

DEPENDENCIES:
- AFNetworking
- TRMosaicLayout (from `../`)

EXTERNAL SOURCES:
TRMosaicLayout:
:path: "../"
:path: ../

SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
TRMosaicLayout: 2f1af0d457377ebc135912b658a65040be9e1651
TRMosaicLayout: 16f29d2a3fe7e966def6e4369e0b9815821842fd

PODFILE CHECKSUM: e96d6eea1053de5262ca744bcf605356ee8c9f04
PODFILE CHECKSUM: 3aadf19c450bf9615ab51ea88c6d09500c606f82

COCOAPODS: 1.1.0.beta.2
COCOAPODS: 1.3.1
242 changes: 228 additions & 14 deletions Example/TRMosaicLayout.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,23 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "TRMosaicLayout_Example.app"
BlueprintName = "TRMosaicLayout_Example"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "TRMosaicLayout_Tests.xctest"
BlueprintName = "TRMosaicLayout_Tests"
BlueprintIdentifier = "7E42B0011FE278F50059C58F"
BuildableName = "TRMosaicLayout.framework"
BlueprintName = "TRMosaicLayout"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -42,26 +28,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "TRMosaicLayout_Tests.xctest"
BlueprintName = "TRMosaicLayout_Tests"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "TRMosaicLayout_Example.app"
BlueprintName = "TRMosaicLayout_Example"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
Expand All @@ -75,16 +42,15 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "TRMosaicLayout_Example.app"
BlueprintName = "TRMosaicLayout_Example"
BlueprintIdentifier = "7E42B0011FE278F50059C58F"
BuildableName = "TRMosaicLayout.framework"
BlueprintName = "TRMosaicLayout"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand All @@ -94,16 +60,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "TRMosaicLayout_Example.app"
BlueprintName = "TRMosaicLayout_Example"
BlueprintIdentifier = "7E42B0011FE278F50059C58F"
BuildableName = "TRMosaicLayout.framework"
BlueprintName = "TRMosaicLayout"
ReferencedContainer = "container:TRMosaicLayout.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
16 changes: 16 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// swift-tools-version:5.1
import PackageDescription

let package = Package(
name: "TRMosaicLayout",
platforms: [.iOS(.v13)],
products: [
.library(name: "TRMosaicLayout", targets: ["TRMosaicLayout"])
],
targets: [
.target(
name: "TRMosaicLayout",
path: "TRMosaicLayout/Classes"
)
]
)
2 changes: 2 additions & 0 deletions TRMosaicLayout/Classes/TRMosaicColumn.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//
//

import UIKit

struct TRMosaicColumns {

var columns:[TRMosaicColumn]
Expand Down
19 changes: 19 additions & 0 deletions TRMosaicLayout/Classes/TRMosaicLayout.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// TRMosaicLayout.h
// TRMosaicLayout
//
// Created by 4D on 14/12/2017.
// Copyright © 2017 CocoaPods. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for TRMosaicLayout.
FOUNDATION_EXPORT double TRMosaicLayoutVersionNumber;

//! Project version string for TRMosaicLayout.
FOUNDATION_EXPORT const unsigned char TRMosaicLayoutVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <TRMosaicLayout/PublicHeader.h>


14 changes: 8 additions & 6 deletions TRMosaicLayout/Classes/TRMosaicLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ open class TRMosaicLayout: UICollectionViewLayout {

var lastBigCellOnLeftSide = false
// Loops through all items in the first section, this layout has only one section
for cellIndex in 0..<collectionView!.numberOfItems(inSection: 0) {

(lastBigCellOnLeftSide, smallCellIndexPathBuffer) = createCellLayout(withIndexPath: cellIndex,
bigCellSide: lastBigCellOnLeftSide,
cellBuffer: smallCellIndexPathBuffer)
if let collectionView = collectionView, collectionView.numberOfSections > 0 {
for cellIndex in 0..<collectionView.numberOfItems(inSection: 0) {

(lastBigCellOnLeftSide, smallCellIndexPathBuffer) = createCellLayout(withIndexPath: cellIndex,
bigCellSide: lastBigCellOnLeftSide,
cellBuffer: smallCellIndexPathBuffer)
}
}

if !smallCellIndexPathBuffer.isEmpty {
Expand All @@ -79,7 +81,7 @@ open class TRMosaicLayout: UICollectionViewLayout {
*/
func createCellLayout(withIndexPath index: Int, bigCellSide: Bool, cellBuffer: [IndexPath]) -> (Bool, [IndexPath]) {
let cellIndexPath = IndexPath(item: index, section: 0)
let cellType:TRMosaicCellType = mosaicCellType(index: cellIndexPath)
let cellType: TRMosaicCellType = mosaicCellType(index: cellIndexPath)

var newBuffer = cellBuffer
var newSide = bigCellSide
Expand Down
24 changes: 24 additions & 0 deletions TRMosaicLayout/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>