Commit 8db29285 by Daniel Dahan

updated project to Grid from GridView

parent 50d1b21d
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
name = "Grid">
<FileRef
location = "group:Programmatic/Grid/Grid.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "MaterialLayer"> name = "MaterialLayer">
<FileRef <FileRef
location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj"> location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj">
...@@ -98,13 +105,6 @@ ...@@ -98,13 +105,6 @@
location = "group:Programmatic/CaptureView/CaptureView.xcodeproj"> location = "group:Programmatic/CaptureView/CaptureView.xcodeproj">
</FileRef> </FileRef>
</Group> </Group>
<Group
location = "container:"
name = "GridView">
<FileRef
location = "group:Programmatic/GridView/GridView.xcodeproj">
</FileRef>
</Group>
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
......
...@@ -7,22 +7,22 @@ ...@@ -7,22 +7,22 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9656CD121C6C664700EBCEF1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9656CD111C6C664700EBCEF1 /* Material.framework */; }; 9656CD211C6CFA6200EBCEF1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD201C6CFA6200EBCEF1 /* AppDelegate.swift */; };
9656CD131C6C664700EBCEF1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9656CD111C6C664700EBCEF1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9656CD231C6CFA6200EBCEF1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD221C6CFA6200EBCEF1 /* ViewController.swift */; };
965C58CD1C6B936400CFB4E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C58CC1C6B936400CFB4E1 /* AppDelegate.swift */; }; 9656CD281C6CFA6200EBCEF1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9656CD271C6CFA6200EBCEF1 /* Assets.xcassets */; };
965C58CF1C6B936400CFB4E1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C58CE1C6B936400CFB4E1 /* ViewController.swift */; }; 9656CD2B1C6CFA6200EBCEF1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9656CD291C6CFA6200EBCEF1 /* LaunchScreen.storyboard */; };
965C58D41C6B936400CFB4E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D31C6B936400CFB4E1 /* Assets.xcassets */; }; 9656CD331C6CFACC00EBCEF1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9656CD321C6CFACC00EBCEF1 /* Material.framework */; };
965C58D71C6B936400CFB4E1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D51C6B936400CFB4E1 /* LaunchScreen.storyboard */; }; 9656CD341C6CFACC00EBCEF1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9656CD321C6CFACC00EBCEF1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
965C58E11C6B949B00CFB4E1 /* Embed Frameworks */ = { 9656CD351C6CFACC00EBCEF1 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase; isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9656CD131C6C664700EBCEF1 /* Material.framework in Embed Frameworks */, 9656CD341C6CFACC00EBCEF1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -30,93 +30,93 @@ ...@@ -30,93 +30,93 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9656CD111C6C664700EBCEF1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; }; 9656CD1D1C6CFA6200EBCEF1 /* Grid.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Grid.app; sourceTree = BUILT_PRODUCTS_DIR; };
965C58C91C6B936400CFB4E1 /* GridView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GridView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9656CD201C6CFA6200EBCEF1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
965C58CC1C6B936400CFB4E1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 9656CD221C6CFA6200EBCEF1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
965C58CE1C6B936400CFB4E1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 9656CD271C6CFA6200EBCEF1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
965C58D31C6B936400CFB4E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 9656CD2A1C6CFA6200EBCEF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
965C58D61C6B936400CFB4E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 9656CD2C1C6CFA6200EBCEF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
965C58D81C6B936400CFB4E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 9656CD321C6CFACC00EBCEF1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
965C58C61C6B936400CFB4E1 /* Frameworks */ = { 9656CD1A1C6CFA6200EBCEF1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9656CD121C6C664700EBCEF1 /* Material.framework in Frameworks */, 9656CD331C6CFACC00EBCEF1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
965C58C01C6B936400CFB4E1 = { 9656CD141C6CFA6200EBCEF1 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9656CD111C6C664700EBCEF1 /* Material.framework */, 9656CD321C6CFACC00EBCEF1 /* Material.framework */,
965C58CB1C6B936400CFB4E1 /* GridView */, 9656CD1F1C6CFA6200EBCEF1 /* Grid */,
965C58CA1C6B936400CFB4E1 /* Products */, 9656CD1E1C6CFA6200EBCEF1 /* Products */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
965C58CA1C6B936400CFB4E1 /* Products */ = { 9656CD1E1C6CFA6200EBCEF1 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
965C58C91C6B936400CFB4E1 /* GridView.app */, 9656CD1D1C6CFA6200EBCEF1 /* Grid.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
965C58CB1C6B936400CFB4E1 /* GridView */ = { 9656CD1F1C6CFA6200EBCEF1 /* Grid */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
965C58CC1C6B936400CFB4E1 /* AppDelegate.swift */, 9656CD201C6CFA6200EBCEF1 /* AppDelegate.swift */,
965C58CE1C6B936400CFB4E1 /* ViewController.swift */, 9656CD221C6CFA6200EBCEF1 /* ViewController.swift */,
965C58D31C6B936400CFB4E1 /* Assets.xcassets */, 9656CD271C6CFA6200EBCEF1 /* Assets.xcassets */,
965C58D51C6B936400CFB4E1 /* LaunchScreen.storyboard */, 9656CD291C6CFA6200EBCEF1 /* LaunchScreen.storyboard */,
965C58D81C6B936400CFB4E1 /* Info.plist */, 9656CD2C1C6CFA6200EBCEF1 /* Info.plist */,
); );
path = GridView; path = Grid;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
965C58C81C6B936400CFB4E1 /* GridView */ = { 9656CD1C1C6CFA6200EBCEF1 /* Grid */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 965C58DB1C6B936400CFB4E1 /* Build configuration list for PBXNativeTarget "GridView" */; buildConfigurationList = 9656CD2F1C6CFA6200EBCEF1 /* Build configuration list for PBXNativeTarget "Grid" */;
buildPhases = ( buildPhases = (
965C58C51C6B936400CFB4E1 /* Sources */, 9656CD191C6CFA6200EBCEF1 /* Sources */,
965C58C61C6B936400CFB4E1 /* Frameworks */, 9656CD1A1C6CFA6200EBCEF1 /* Frameworks */,
965C58C71C6B936400CFB4E1 /* Resources */, 9656CD1B1C6CFA6200EBCEF1 /* Resources */,
965C58E11C6B949B00CFB4E1 /* Embed Frameworks */, 9656CD351C6CFACC00EBCEF1 /* Embed Frameworks */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
); );
name = GridView; name = Grid;
productName = GridView; productName = Grid;
productReference = 965C58C91C6B936400CFB4E1 /* GridView.app */; productReference = 9656CD1D1C6CFA6200EBCEF1 /* Grid.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
965C58C11C6B936400CFB4E1 /* Project object */ = { 9656CD151C6CFA6200EBCEF1 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0720; LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720; LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "CosmicMind, Inc."; ORGANIZATIONNAME = "CosmicMind, Inc.";
TargetAttributes = { TargetAttributes = {
965C58C81C6B936400CFB4E1 = { 9656CD1C1C6CFA6200EBCEF1 = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
}; };
}; };
}; };
buildConfigurationList = 965C58C41C6B936400CFB4E1 /* Build configuration list for PBXProject "GridView" */; buildConfigurationList = 9656CD181C6CFA6200EBCEF1 /* Build configuration list for PBXProject "Grid" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
...@@ -124,45 +124,45 @@ ...@@ -124,45 +124,45 @@
en, en,
Base, Base,
); );
mainGroup = 965C58C01C6B936400CFB4E1; mainGroup = 9656CD141C6CFA6200EBCEF1;
productRefGroup = 965C58CA1C6B936400CFB4E1 /* Products */; productRefGroup = 9656CD1E1C6CFA6200EBCEF1 /* Products */;
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
965C58C81C6B936400CFB4E1 /* GridView */, 9656CD1C1C6CFA6200EBCEF1 /* Grid */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
965C58C71C6B936400CFB4E1 /* Resources */ = { 9656CD1B1C6CFA6200EBCEF1 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
965C58D71C6B936400CFB4E1 /* LaunchScreen.storyboard in Resources */, 9656CD2B1C6CFA6200EBCEF1 /* LaunchScreen.storyboard in Resources */,
965C58D41C6B936400CFB4E1 /* Assets.xcassets in Resources */, 9656CD281C6CFA6200EBCEF1 /* Assets.xcassets in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
965C58C51C6B936400CFB4E1 /* Sources */ = { 9656CD191C6CFA6200EBCEF1 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
965C58CF1C6B936400CFB4E1 /* ViewController.swift in Sources */, 9656CD231C6CFA6200EBCEF1 /* ViewController.swift in Sources */,
965C58CD1C6B936400CFB4E1 /* AppDelegate.swift in Sources */, 9656CD211C6CFA6200EBCEF1 /* AppDelegate.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */ /* Begin PBXVariantGroup section */
965C58D51C6B936400CFB4E1 /* LaunchScreen.storyboard */ = { 9656CD291C6CFA6200EBCEF1 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
965C58D61C6B936400CFB4E1 /* Base */, 9656CD2A1C6CFA6200EBCEF1 /* Base */,
); );
name = LaunchScreen.storyboard; name = LaunchScreen.storyboard;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
/* End PBXVariantGroup section */ /* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
965C58D91C6B936400CFB4E1 /* Debug */ = { 9656CD2D1C6CFA6200EBCEF1 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
}; };
name = Debug; name = Debug;
}; };
965C58DA1C6B936400CFB4E1 /* Release */ = { 9656CD2E1C6CFA6200EBCEF1 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
...@@ -253,24 +253,24 @@ ...@@ -253,24 +253,24 @@
}; };
name = Release; name = Release;
}; };
965C58DC1C6B936400CFB4E1 /* Debug */ = { 9656CD301C6CFA6200EBCEF1 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = GridView/Info.plist; INFOPLIST_FILE = Grid/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.GridView; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Grid;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Debug; name = Debug;
}; };
965C58DD1C6B936400CFB4E1 /* Release */ = { 9656CD311C6CFA6200EBCEF1 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = GridView/Info.plist; INFOPLIST_FILE = Grid/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.GridView; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.Grid;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
}; };
name = Release; name = Release;
...@@ -278,25 +278,25 @@ ...@@ -278,25 +278,25 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
965C58C41C6B936400CFB4E1 /* Build configuration list for PBXProject "GridView" */ = { 9656CD181C6CFA6200EBCEF1 /* Build configuration list for PBXProject "Grid" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
965C58D91C6B936400CFB4E1 /* Debug */, 9656CD2D1C6CFA6200EBCEF1 /* Debug */,
965C58DA1C6B936400CFB4E1 /* Release */, 9656CD2E1C6CFA6200EBCEF1 /* Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
965C58DB1C6B936400CFB4E1 /* Build configuration list for PBXNativeTarget "GridView" */ = { 9656CD2F1C6CFA6200EBCEF1 /* Build configuration list for PBXNativeTarget "Grid" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
965C58DC1C6B936400CFB4E1 /* Debug */, 9656CD301C6CFA6200EBCEF1 /* Debug */,
965C58DD1C6B936400CFB4E1 /* Release */, 9656CD311C6CFA6200EBCEF1 /* Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
rootObject = 965C58C11C6B936400CFB4E1 /* Project object */; rootObject = 9656CD151C6CFA6200EBCEF1 /* Project object */;
} }
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "self:GridView.xcodeproj"> location = "self:Grid.xcodeproj">
</FileRef> </FileRef>
</Workspace> </Workspace>
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
<array> <array>
<string>armv7</string> <string>armv7</string>
</array> </array>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*/ */
/** /**
The following ViewController demonstrates using Grid to make complex layouts.
*/ */
import UIKit import UIKit
...@@ -40,10 +40,10 @@ class ViewController: UIViewController { ...@@ -40,10 +40,10 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
// prepareHorizontalGridViewExample() // prepareHorizontalGridViewExample()
// prepareVerticalGridViewExample() // prepareVerticalGridViewExample()
// prepareSmallCardViewExample() // prepareSmallCardViewExample()
// prepareMediumCardViewExample() // prepareMediumCardViewExample()
prepareLargeCardViewExample() prepareLargeCardViewExample()
} }
...@@ -55,8 +55,8 @@ class ViewController: UIViewController { ...@@ -55,8 +55,8 @@ class ViewController: UIViewController {
/// Prepares the medium card example. /// Prepares the medium card example.
private func prepareLargeCardViewExample() { private func prepareLargeCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 350)) let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 400))
cardView.pulseColor = MaterialColor.blueGrey.lighten5 cardView.pulseColor = MaterialColor.blueGrey.base
cardView.grid.axis.direction = .Vertical cardView.grid.axis.direction = .Vertical
cardView.depth = .Depth1 cardView.depth = .Depth1
view.addSubview(cardView) view.addSubview(cardView)
...@@ -65,6 +65,7 @@ class ViewController: UIViewController { ...@@ -65,6 +65,7 @@ class ViewController: UIViewController {
imageView.grid.rows = 7 imageView.grid.rows = 7
imageView.grid.columns = 6 imageView.grid.columns = 6
imageView.grid.spacing = 4 imageView.grid.spacing = 4
imageView.backgroundColor = MaterialColor.clear
cardView.addSubview(imageView) cardView.addSubview(imageView)
var image: UIImage? = UIImage(named: "CosmicMindInverted") var image: UIImage? = UIImage(named: "CosmicMindInverted")
...@@ -78,6 +79,7 @@ class ViewController: UIViewController { ...@@ -78,6 +79,7 @@ class ViewController: UIViewController {
rightImageViewCollection.grid.columns = 3 rightImageViewCollection.grid.columns = 3
rightImageViewCollection.grid.axis.direction = .Vertical rightImageViewCollection.grid.axis.direction = .Vertical
rightImageViewCollection.grid.spacing = 4 rightImageViewCollection.grid.spacing = 4
rightImageViewCollection.backgroundColor = MaterialColor.clear
imageView.addSubview(rightImageViewCollection) imageView.addSubview(rightImageViewCollection)
image = UIImage(named: "CosmicMindInverted") image = UIImage(named: "CosmicMindInverted")
...@@ -169,7 +171,7 @@ class ViewController: UIViewController { ...@@ -169,7 +171,7 @@ class ViewController: UIViewController {
/// Prepares the medium card example. /// Prepares the medium card example.
private func prepareMediumCardViewExample() { private func prepareMediumCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 240)) let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 240))
cardView.pulseColor = MaterialColor.blueGrey.lighten5 cardView.pulseColor = MaterialColor.blueGrey.base
cardView.depth = .Depth1 cardView.depth = .Depth1
view.addSubview(cardView) view.addSubview(cardView)
...@@ -254,7 +256,7 @@ class ViewController: UIViewController { ...@@ -254,7 +256,7 @@ class ViewController: UIViewController {
/// Prepares the small card example. /// Prepares the small card example.
private func prepareSmallCardViewExample() { private func prepareSmallCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 152)) let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 152))
cardView.pulseColor = MaterialColor.blueGrey.lighten5 cardView.pulseColor = MaterialColor.blueGrey.base
cardView.depth = .Depth1 cardView.depth = .Depth1
view.addSubview(cardView) view.addSubview(cardView)
...@@ -378,7 +380,7 @@ class ViewController: UIViewController { ...@@ -378,7 +380,7 @@ class ViewController: UIViewController {
label2.text = "B" label2.text = "B"
label2.backgroundColor = MaterialColor.blue.base label2.backgroundColor = MaterialColor.blue.base
// view.grid.columns = 9 // view.grid.columns = 9
view.grid.spacing = 16 view.grid.spacing = 16
view.grid.contentInset.left = 16 view.grid.contentInset.left = 16
view.grid.contentInset.right = 16 view.grid.contentInset.right = 16
......
...@@ -59,6 +59,12 @@ public class GridAxis { ...@@ -59,6 +59,12 @@ public class GridAxis {
} }
} }
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
*/
public init(grid: Grid, rows: Int = 12, columns: Int = 12) { public init(grid: Grid, rows: Int = 12, columns: Int = 12) {
self.grid = grid self.grid = grid
self.rows = rows self.rows = rows
...@@ -84,6 +90,12 @@ public class GridOffset { ...@@ -84,6 +90,12 @@ public class GridOffset {
} }
} }
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
*/
public init(grid: Grid, rows: Int = 0, columns: Int = 0) { public init(grid: Grid, rows: Int = 0, columns: Int = 0) {
self.grid = grid self.grid = grid
self.rows = rows self.rows = rows
...@@ -140,6 +152,12 @@ public class Grid { ...@@ -140,6 +152,12 @@ public class Grid {
} }
} }
/**
Initializer.
- Parameter rows: The number of rows, Vertical axis the grid will use.
- Parameter columns: The number of columns, Horizontal axis the grid will use.
- Parameter spacing: The spacing between rows or columns.
*/
public init(rows: Int = 12, columns: Int = 12, spacing: CGFloat = 0) { public init(rows: Int = 12, columns: Int = 12, spacing: CGFloat = 0) {
self.rows = rows self.rows = rows
self.columns = columns self.columns = columns
...@@ -152,17 +170,14 @@ public class Grid { ...@@ -152,17 +170,14 @@ public class Grid {
public func reloadLayout() { public func reloadLayout() {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
var n: Int = 0 var n: Int = 0
var m: Int = 0
for var i: Int = 0, l: Int = v.count - 1; i <= l; ++i { for var i: Int = 0, l: Int = v.count - 1; i <= l; ++i {
let view: UIView = v[i] let view: UIView = v[i]
if let sv: UIView = view.superview { if let sv: UIView = view.superview {
sv.layoutIfNeeded()
if .Horizontal == axis.direction {
let w: CGFloat = (sv.bounds.width - contentInset.left - contentInset.right + spacing) / CGFloat(axis.inherited ? columns : axis.columns) let w: CGFloat = (sv.bounds.width - contentInset.left - contentInset.right + spacing) / CGFloat(axis.inherited ? columns : axis.columns)
let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom + spacing) / CGFloat(axis.inherited ? rows : axis.rows)
let c: Int = view.grid.columns let c: Int = view.grid.columns
let r: Int = view.grid.rows
let co: Int = view.grid.offset.columns let co: Int = view.grid.offset.columns
let ro: Int = view.grid.offset.rows
if .Horizontal == axis.direction {
// View height. // View height.
let vh: CGFloat = sv.bounds.height - contentInset.top - contentInset.bottom let vh: CGFloat = sv.bounds.height - contentInset.top - contentInset.bottom
...@@ -173,34 +188,24 @@ public class Grid { ...@@ -173,34 +188,24 @@ public class Grid {
// View width. // View width.
let vw: CGFloat = (w * CGFloat(c)) - spacing let vw: CGFloat = (w * CGFloat(c)) - spacing
if 0 == i {
view.frame = CGRectMake(vl, contentInset.top, vw, vh) view.frame = CGRectMake(vl, contentInset.top, vw, vh)
} else if l == i {
view.frame = CGRectMake(vl, contentInset.top, vw, vh)
} else {
view.frame = CGRectMake(vl, contentInset.top, vw, vh)
}
n += c + co - 1 n += c + co - 1
} else if .Vertical == axis.direction { } else if .Vertical == axis.direction {
let h: CGFloat = (sv.bounds.height - contentInset.top - contentInset.bottom + spacing) / CGFloat(axis.inherited ? rows : axis.rows)
let r: Int = view.grid.rows
let ro: Int = view.grid.offset.rows
// View width. // View width.
let vw: CGFloat = sv.bounds.width - contentInset.left - contentInset.right let vw: CGFloat = sv.bounds.width - contentInset.left - contentInset.right
// View top. // View top.
let vt: CGFloat = CGFloat(i + m + ro) * h + contentInset.top let vt: CGFloat = CGFloat(i + n + ro) * h + contentInset.top
// View height. // View height.
let vh: CGFloat = (h * CGFloat(r)) - spacing let vh: CGFloat = (h * CGFloat(r)) - spacing
if 0 == i {
view.frame = CGRectMake(contentInset.left, vt, vw, vh)
} else if l == i {
view.frame = CGRectMake(contentInset.left, vt, vw, vh)
} else {
view.frame = CGRectMake(contentInset.left, vt, vw, vh) view.frame = CGRectMake(contentInset.left, vt, vw, vh)
} n += r + ro - 1
m += r + ro - 1
} }
} }
} }
...@@ -208,31 +213,48 @@ public class Grid { ...@@ -208,31 +213,48 @@ public class Grid {
} }
} }
private func associatedObject<T: AnyObject>(base: AnyObject, key: UnsafePointer<UInt8>, initialiser: () -> T) -> T { /**
Gets the Obj-C reference for the Grid object within the UIView extension.
- Parameter base: Base object.
- Parameter key: Memory key pointer.
- Parameter initializer: Object initializer.
- Returns: The associated reference for the initializer object.
*/
private func GridAssociatedObject<T: AnyObject>(base: AnyObject, key: UnsafePointer<UInt8>, initializer: () -> T) -> T {
if let associated: T = objc_getAssociatedObject(base, key) as? T { if let associated: T = objc_getAssociatedObject(base, key) as? T {
return associated return associated
} }
let associated = initialiser() let associated = initializer()
objc_setAssociatedObject(base, key, associated, .OBJC_ASSOCIATION_RETAIN) objc_setAssociatedObject(base, key, associated, .OBJC_ASSOCIATION_RETAIN)
return associated return associated
} }
private func associateObject<T: AnyObject>(base: AnyObject, key: UnsafePointer<UInt8>, value: T) { /**
Sets the Obj-C reference for the Grid object within the UIView extension.
- Parameter base: Base object.
- Parameter key: Memory key pointer.
- Parameter value: The object instance to set for the associated object.
- Returns: The associated reference for the initializer object.
*/
private func GridAssociateObject<T: AnyObject>(base: AnyObject, key: UnsafePointer<UInt8>, value: T) {
objc_setAssociatedObject(base, key, value, .OBJC_ASSOCIATION_RETAIN) objc_setAssociatedObject(base, key, value, .OBJC_ASSOCIATION_RETAIN)
} }
/// A memory reference to the Grid instance for UIView extensions.
private var gridKey: UInt8 = 0 private var gridKey: UInt8 = 0
/// Grid extension for UIView.
public extension UIView { public extension UIView {
/// Grid reference.
public var grid: Grid { public var grid: Grid {
get { get {
return associatedObject(self, key: &gridKey) { return GridAssociatedObject(self, key: &gridKey) {
return Grid() return Grid()
} }
} }
set(value) { set(value) {
associateObject(self, key: &gridKey, value: value) GridAssociateObject(self, key: &gridKey, value: value)
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment