├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── .travis.yml ├── LICENSE ├── Package.swift ├── QDesignerPreview.png ├── QGridDemo.gif ├── QGridDesignerDemo.gif ├── QGridLogo.png ├── QGridTestApp ├── QGridTestApp.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── QGridTestApp.xcscheme ├── QGridTestApp │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── QGridAppIcon-1024.png │ │ │ ├── QGridAppIcon-60@2x.png │ │ │ ├── QGridAppIcon-60@3x.png │ │ │ ├── QGridAppIcon-76.png │ │ │ ├── QGridAppIcon-76@2x.png │ │ │ └── QGridAppIcon-83.5@2x.png │ │ ├── Contents.json │ │ ├── QGridLogo.imageset │ │ │ ├── Contents.json │ │ │ └── QGridLogo1.png │ │ ├── QMobileLogo.imageset │ │ │ ├── Contents.json │ │ │ └── Q mobile 2.png │ │ ├── albert_einstein.imageset │ │ │ ├── Contents.json │ │ │ └── albert_einstein.png │ │ ├── alexander_bell.imageset │ │ │ ├── Contents.json │ │ │ └── alexander_bell.png │ │ ├── benjamin_franklin.imageset │ │ │ ├── Contents.json │ │ │ └── benjamin_franklin.png │ │ ├── charles_babbage.imageset │ │ │ ├── Contents.json │ │ │ └── charles_babbage.png │ │ ├── henry_ford.imageset │ │ │ ├── Contents.json │ │ │ └── henry_ford.png │ │ ├── leonardo_da_vinci.imageset │ │ │ ├── Contents.json │ │ │ └── leonardo_da_vinci.png │ │ ├── marie_curie.imageset │ │ │ ├── Contents.json │ │ │ └── marie_curie.png │ │ ├── nikola_tesla.imageset │ │ │ ├── Contents.json │ │ │ └── nikola_tesla.png │ │ └── thomas_edison.imageset │ │ │ ├── Contents.json │ │ │ └── thomas_edison.png │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── PeopleView.swift │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── QGridTestApp.entitlements │ ├── Resources │ │ └── people.json │ ├── SceneDelegate.swift │ └── Storage.swift └── Screenshots │ ├── People1.png │ ├── People2.png │ ├── People3.png │ └── People4.png ├── README.md └── Sources └── QGrid └── QGrid.swift /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | osx_image: xcode11 2 | language: swift 3 | script: 4 | - set -o pipefail 5 | - xcodebuild -version 6 | - xcodebuild -project QGridTestApp/QGridTestApp.xcodeproj -scheme QGridTestApp -sdk iphonesimulator -destination 'OS=13.0,name=iPhone Xʀ,platform=iOS Simulator' -configuration Debug ONLY_ACTIVE_ARCH=NO | xcpretty -c 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Q Mobile { http://Q-Mobile.IT } 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "QGrid", 7 | platforms: [ 8 | .iOS(.v13), 9 | .macOS(.v10_15), 10 | .tvOS(.v13) 11 | ], 12 | products: [ 13 | .library( 14 | name: "QGrid", 15 | targets: ["QGrid"]), 16 | ], 17 | dependencies: [], 18 | targets: [ 19 | .target( 20 | name: "QGrid", 21 | dependencies: []), 22 | ] 23 | ) 24 | -------------------------------------------------------------------------------- /QDesignerPreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QDesignerPreview.png -------------------------------------------------------------------------------- /QGridDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridDemo.gif -------------------------------------------------------------------------------- /QGridDesignerDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridDesignerDemo.gif -------------------------------------------------------------------------------- /QGridLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridLogo.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 52; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 922BA2CA22DA717700691539 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 922BA2C922DA717700691539 /* AppDelegate.swift */; }; 11 | 922BA2CC22DA717700691539 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 922BA2CB22DA717700691539 /* SceneDelegate.swift */; }; 12 | 922BA2D022DA717A00691539 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 922BA2CF22DA717A00691539 /* Assets.xcassets */; }; 13 | 922BA2D322DA717A00691539 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 922BA2D222DA717A00691539 /* Preview Assets.xcassets */; }; 14 | 922BA2D622DA717A00691539 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 922BA2D422DA717A00691539 /* LaunchScreen.storyboard */; }; 15 | 922BA2DF22DA775E00691539 /* QGrid in Frameworks */ = {isa = PBXBuildFile; productRef = 922BA2DE22DA775E00691539 /* QGrid */; }; 16 | 9296085122DE13BB0039ABA3 /* people.json in Resources */ = {isa = PBXBuildFile; fileRef = 9296085022DE13BB0039ABA3 /* people.json */; }; 17 | 9296085322DE17E30039ABA3 /* PeopleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296085222DE17E30039ABA3 /* PeopleView.swift */; }; 18 | 9296085522DE193E0039ABA3 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296085422DE193E0039ABA3 /* Storage.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 922BA2C622DA717700691539 /* QGridTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QGridTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 922BA2C922DA717700691539 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 922BA2CB22DA717700691539 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 25 | 922BA2CF22DA717A00691539 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 922BA2D222DA717A00691539 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 27 | 922BA2D522DA717A00691539 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 922BA2D722DA717A00691539 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 9294B5F022EF6D4B0029E781 /* QGridTestApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = QGridTestApp.entitlements; sourceTree = ""; }; 30 | 9296085022DE13BB0039ABA3 /* people.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = people.json; sourceTree = ""; }; 31 | 9296085222DE17E30039ABA3 /* PeopleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeopleView.swift; sourceTree = ""; }; 32 | 9296085422DE193E0039ABA3 /* Storage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; 33 | 92A4DA6722DF2CC000069E30 /* QGrid */ = {isa = PBXFileReference; lastKnownFileType = folder; name = QGrid; path = ..; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 922BA2C322DA717700691539 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | 922BA2DF22DA775E00691539 /* QGrid in Frameworks */, 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 922BA2BD22DA717700691539 = { 49 | isa = PBXGroup; 50 | children = ( 51 | 92A4DA6722DF2CC000069E30 /* QGrid */, 52 | 922BA2C822DA717700691539 /* QGridTestApp */, 53 | 922BA2C722DA717700691539 /* Products */, 54 | ); 55 | sourceTree = ""; 56 | }; 57 | 922BA2C722DA717700691539 /* Products */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 922BA2C622DA717700691539 /* QGridTestApp.app */, 61 | ); 62 | name = Products; 63 | sourceTree = ""; 64 | }; 65 | 922BA2C822DA717700691539 /* QGridTestApp */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 9296084F22DE13BB0039ABA3 /* Resources */, 69 | 922BA2C922DA717700691539 /* AppDelegate.swift */, 70 | 922BA2CB22DA717700691539 /* SceneDelegate.swift */, 71 | 9296085222DE17E30039ABA3 /* PeopleView.swift */, 72 | 9296085422DE193E0039ABA3 /* Storage.swift */, 73 | 922BA2CF22DA717A00691539 /* Assets.xcassets */, 74 | 9294B5F022EF6D4B0029E781 /* QGridTestApp.entitlements */, 75 | 922BA2D422DA717A00691539 /* LaunchScreen.storyboard */, 76 | 922BA2D722DA717A00691539 /* Info.plist */, 77 | 922BA2D122DA717A00691539 /* Preview Content */, 78 | ); 79 | path = QGridTestApp; 80 | sourceTree = ""; 81 | }; 82 | 922BA2D122DA717A00691539 /* Preview Content */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 922BA2D222DA717A00691539 /* Preview Assets.xcassets */, 86 | ); 87 | path = "Preview Content"; 88 | sourceTree = ""; 89 | }; 90 | 9296084F22DE13BB0039ABA3 /* Resources */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 9296085022DE13BB0039ABA3 /* people.json */, 94 | ); 95 | path = Resources; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXNativeTarget section */ 101 | 922BA2C522DA717700691539 /* QGridTestApp */ = { 102 | isa = PBXNativeTarget; 103 | buildConfigurationList = 922BA2DA22DA717A00691539 /* Build configuration list for PBXNativeTarget "QGridTestApp" */; 104 | buildPhases = ( 105 | 922BA2C222DA717700691539 /* Sources */, 106 | 922BA2C322DA717700691539 /* Frameworks */, 107 | 922BA2C422DA717700691539 /* Resources */, 108 | ); 109 | buildRules = ( 110 | ); 111 | dependencies = ( 112 | ); 113 | name = QGridTestApp; 114 | packageProductDependencies = ( 115 | 922BA2DE22DA775E00691539 /* QGrid */, 116 | ); 117 | productName = QGridTestApp; 118 | productReference = 922BA2C622DA717700691539 /* QGridTestApp.app */; 119 | productType = "com.apple.product-type.application"; 120 | }; 121 | /* End PBXNativeTarget section */ 122 | 123 | /* Begin PBXProject section */ 124 | 922BA2BE22DA717700691539 /* Project object */ = { 125 | isa = PBXProject; 126 | attributes = { 127 | LastSwiftUpdateCheck = 1100; 128 | LastUpgradeCheck = 1100; 129 | ORGANIZATIONNAME = "q-mobile"; 130 | TargetAttributes = { 131 | 922BA2C522DA717700691539 = { 132 | CreatedOnToolsVersion = 11.0; 133 | }; 134 | }; 135 | }; 136 | buildConfigurationList = 922BA2C122DA717700691539 /* Build configuration list for PBXProject "QGridTestApp" */; 137 | compatibilityVersion = "Xcode 9.3"; 138 | developmentRegion = en; 139 | hasScannedForEncodings = 0; 140 | knownRegions = ( 141 | en, 142 | Base, 143 | ); 144 | mainGroup = 922BA2BD22DA717700691539; 145 | packageReferences = ( 146 | ); 147 | productRefGroup = 922BA2C722DA717700691539 /* Products */; 148 | projectDirPath = ""; 149 | projectRoot = ""; 150 | targets = ( 151 | 922BA2C522DA717700691539 /* QGridTestApp */, 152 | ); 153 | }; 154 | /* End PBXProject section */ 155 | 156 | /* Begin PBXResourcesBuildPhase section */ 157 | 922BA2C422DA717700691539 /* Resources */ = { 158 | isa = PBXResourcesBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 9296085122DE13BB0039ABA3 /* people.json in Resources */, 162 | 922BA2D622DA717A00691539 /* LaunchScreen.storyboard in Resources */, 163 | 922BA2D322DA717A00691539 /* Preview Assets.xcassets in Resources */, 164 | 922BA2D022DA717A00691539 /* Assets.xcassets in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | 922BA2C222DA717700691539 /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 922BA2CA22DA717700691539 /* AppDelegate.swift in Sources */, 176 | 9296085522DE193E0039ABA3 /* Storage.swift in Sources */, 177 | 922BA2CC22DA717700691539 /* SceneDelegate.swift in Sources */, 178 | 9296085322DE17E30039ABA3 /* PeopleView.swift in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin PBXVariantGroup section */ 185 | 922BA2D422DA717A00691539 /* LaunchScreen.storyboard */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | 922BA2D522DA717A00691539 /* Base */, 189 | ); 190 | name = LaunchScreen.storyboard; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | 922BA2D822DA717A00691539 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_NONNULL = YES; 201 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 203 | CLANG_CXX_LIBRARY = "libc++"; 204 | CLANG_ENABLE_MODULES = YES; 205 | CLANG_ENABLE_OBJC_ARC = YES; 206 | CLANG_ENABLE_OBJC_WEAK = YES; 207 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 208 | CLANG_WARN_BOOL_CONVERSION = YES; 209 | CLANG_WARN_COMMA = YES; 210 | CLANG_WARN_CONSTANT_CONVERSION = YES; 211 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INFINITE_RECURSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 219 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 220 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 222 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 223 | CLANG_WARN_STRICT_PROTOTYPES = YES; 224 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 225 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 226 | CLANG_WARN_UNREACHABLE_CODE = YES; 227 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 228 | COPY_PHASE_STRIP = NO; 229 | DEBUG_INFORMATION_FORMAT = dwarf; 230 | ENABLE_STRICT_OBJC_MSGSEND = YES; 231 | ENABLE_TESTABILITY = YES; 232 | GCC_C_LANGUAGE_STANDARD = gnu11; 233 | GCC_DYNAMIC_NO_PIC = NO; 234 | GCC_NO_COMMON_BLOCKS = YES; 235 | GCC_OPTIMIZATION_LEVEL = 0; 236 | GCC_PREPROCESSOR_DEFINITIONS = ( 237 | "DEBUG=1", 238 | "$(inherited)", 239 | ); 240 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 241 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 242 | GCC_WARN_UNDECLARED_SELECTOR = YES; 243 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 244 | GCC_WARN_UNUSED_FUNCTION = YES; 245 | GCC_WARN_UNUSED_VARIABLE = YES; 246 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 247 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 248 | MTL_FAST_MATH = YES; 249 | ONLY_ACTIVE_ARCH = YES; 250 | SDKROOT = iphoneos; 251 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 252 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 253 | }; 254 | name = Debug; 255 | }; 256 | 922BA2D922DA717A00691539 /* Release */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_ANALYZER_NONNULL = YES; 261 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_ENABLE_OBJC_WEAK = YES; 267 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_COMMA = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 274 | CLANG_WARN_EMPTY_BODY = YES; 275 | CLANG_WARN_ENUM_CONVERSION = YES; 276 | CLANG_WARN_INFINITE_RECURSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 286 | CLANG_WARN_UNREACHABLE_CODE = YES; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu11; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | MTL_FAST_MATH = YES; 303 | SDKROOT = iphoneos; 304 | SWIFT_COMPILATION_MODE = wholemodule; 305 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 306 | VALIDATE_PRODUCT = YES; 307 | }; 308 | name = Release; 309 | }; 310 | 922BA2DB22DA717A00691539 /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 314 | CODE_SIGN_ENTITLEMENTS = QGridTestApp/QGridTestApp.entitlements; 315 | CODE_SIGN_STYLE = Automatic; 316 | DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; 317 | DEVELOPMENT_ASSET_PATHS = "QGridTestApp/Preview\\ Content"; 318 | DEVELOPMENT_TEAM = VRN4DR64TJ; 319 | ENABLE_PREVIEWS = YES; 320 | INFOPLIST_FILE = QGridTestApp/Info.plist; 321 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 322 | LD_RUNPATH_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "@executable_path/Frameworks", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = "it.q-mobile.QGridTestApp"; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | SUPPORTS_MACCATALYST = YES; 329 | SWIFT_VERSION = 5.0; 330 | TARGETED_DEVICE_FAMILY = "1,2"; 331 | }; 332 | name = Debug; 333 | }; 334 | 922BA2DC22DA717A00691539 /* Release */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 338 | CODE_SIGN_ENTITLEMENTS = QGridTestApp/QGridTestApp.entitlements; 339 | CODE_SIGN_STYLE = Automatic; 340 | DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; 341 | DEVELOPMENT_ASSET_PATHS = "QGridTestApp/Preview\\ Content"; 342 | DEVELOPMENT_TEAM = VRN4DR64TJ; 343 | ENABLE_PREVIEWS = YES; 344 | INFOPLIST_FILE = QGridTestApp/Info.plist; 345 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 346 | LD_RUNPATH_SEARCH_PATHS = ( 347 | "$(inherited)", 348 | "@executable_path/Frameworks", 349 | ); 350 | PRODUCT_BUNDLE_IDENTIFIER = "it.q-mobile.QGridTestApp"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | SUPPORTS_MACCATALYST = YES; 353 | SWIFT_VERSION = 5.0; 354 | TARGETED_DEVICE_FAMILY = "1,2"; 355 | }; 356 | name = Release; 357 | }; 358 | /* End XCBuildConfiguration section */ 359 | 360 | /* Begin XCConfigurationList section */ 361 | 922BA2C122DA717700691539 /* Build configuration list for PBXProject "QGridTestApp" */ = { 362 | isa = XCConfigurationList; 363 | buildConfigurations = ( 364 | 922BA2D822DA717A00691539 /* Debug */, 365 | 922BA2D922DA717A00691539 /* Release */, 366 | ); 367 | defaultConfigurationIsVisible = 0; 368 | defaultConfigurationName = Release; 369 | }; 370 | 922BA2DA22DA717A00691539 /* Build configuration list for PBXNativeTarget "QGridTestApp" */ = { 371 | isa = XCConfigurationList; 372 | buildConfigurations = ( 373 | 922BA2DB22DA717A00691539 /* Debug */, 374 | 922BA2DC22DA717A00691539 /* Release */, 375 | ); 376 | defaultConfigurationIsVisible = 0; 377 | defaultConfigurationName = Release; 378 | }; 379 | /* End XCConfigurationList section */ 380 | 381 | /* Begin XCSwiftPackageProductDependency section */ 382 | 922BA2DE22DA775E00691539 /* QGrid */ = { 383 | isa = XCSwiftPackageProductDependency; 384 | productName = QGrid; 385 | }; 386 | /* End XCSwiftPackageProductDependency section */ 387 | }; 388 | rootObject = 922BA2BE22DA717700691539 /* Project object */; 389 | } 390 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp.xcodeproj/xcshareddata/xcschemes/QGridTestApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // QGridTestApp 4 | // 5 | // Created by Karol Kulesza on 7/13/19. 6 | // Copyright © 2019 q-mobile. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | // Override point for customization after application launch. 16 | return true 17 | } 18 | 19 | // MARK: UISceneSession Lifecycle 20 | 21 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 22 | // Called when a new scene session is being created. 23 | // Use this method to select a configuration to create the new scene with. 24 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 25 | } 26 | 27 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 28 | // Called when the user discards a scene session. 29 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 30 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "QGridAppIcon-60@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "QGridAppIcon-60@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "20x20", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "20x20", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "idiom" : "ipad", 57 | "size" : "29x29", 58 | "scale" : "1x" 59 | }, 60 | { 61 | "idiom" : "ipad", 62 | "size" : "29x29", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "idiom" : "ipad", 67 | "size" : "40x40", 68 | "scale" : "1x" 69 | }, 70 | { 71 | "idiom" : "ipad", 72 | "size" : "40x40", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "76x76", 77 | "idiom" : "ipad", 78 | "filename" : "QGridAppIcon-76.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "76x76", 83 | "idiom" : "ipad", 84 | "filename" : "QGridAppIcon-76@2x.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "83.5x83.5", 89 | "idiom" : "ipad", 90 | "filename" : "QGridAppIcon-83.5@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "1024x1024", 95 | "idiom" : "ios-marketing", 96 | "filename" : "QGridAppIcon-1024.png", 97 | "scale" : "1x" 98 | } 99 | ], 100 | "info" : { 101 | "version" : 1, 102 | "author" : "xcode" 103 | } 104 | } -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-1024.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-60@2x.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-60@3x.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-76.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-76@2x.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/AppIcon.appiconset/QGridAppIcon-83.5@2x.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/QGridLogo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "QGridLogo1.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/QGridLogo.imageset/QGridLogo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/QGridLogo.imageset/QGridLogo1.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/QMobileLogo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "Q mobile 2.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/QMobileLogo.imageset/Q mobile 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/QMobileLogo.imageset/Q mobile 2.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/albert_einstein.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "albert_einstein.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "albert_einstein.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/albert_einstein.imageset/albert_einstein.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/albert_einstein.imageset/albert_einstein.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/alexander_bell.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "alexander_bell.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "alexander_bell.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/alexander_bell.imageset/alexander_bell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/alexander_bell.imageset/alexander_bell.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/benjamin_franklin.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "benjamin_franklin.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "benjamin_franklin.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/benjamin_franklin.imageset/benjamin_franklin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/benjamin_franklin.imageset/benjamin_franklin.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/charles_babbage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "charles_babbage.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "charles_babbage.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/charles_babbage.imageset/charles_babbage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/charles_babbage.imageset/charles_babbage.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/henry_ford.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "henry_ford.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "henry_ford.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/henry_ford.imageset/henry_ford.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/henry_ford.imageset/henry_ford.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/leonardo_da_vinci.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "leonardo_da_vinci.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "leonardo_da_vinci.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/leonardo_da_vinci.imageset/leonardo_da_vinci.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/leonardo_da_vinci.imageset/leonardo_da_vinci.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/marie_curie.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "marie_curie.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "marie_curie.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/marie_curie.imageset/marie_curie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/marie_curie.imageset/marie_curie.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/nikola_tesla.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nikola_tesla.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "nikola_tesla.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/nikola_tesla.imageset/nikola_tesla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/nikola_tesla.imageset/nikola_tesla.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/thomas_edison.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "thomas_edison.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "thomas_edison.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Assets.xcassets/thomas_edison.imageset/thomas_edison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/QGridTestApp/Assets.xcassets/thomas_edison.imageset/thomas_edison.png -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/PeopleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PeopleView.swift 3 | // QGrid 4 | // 5 | // Created by Karol Kulesza on 7/06/19. 6 | // Copyright © 2019 Q Mobile { http://Q-Mobile.IT } 7 | // 8 | 9 | import SwiftUI 10 | import QGrid 11 | 12 | 13 | struct QConstants { 14 | static let showDesigner = true 15 | static let columnsMax = 8 16 | static let vSpacingMaxToGeometryRatio: CGFloat = 0.5 // 50% 17 | static let vPaddingMaxToGeometryRatio: CGFloat = 0.3 // 30% 18 | static let hPaddingMaxToGeometryRatio: CGFloat = 0.3 // 30% 19 | } 20 | 21 | struct PeopleView: View { 22 | @State var columns: CGFloat = 3.0 23 | @State var vSpacing: CGFloat = 10.0 24 | @State var hSpacing: CGFloat = 10.0 25 | @State var vPadding: CGFloat = 0.0 26 | @State var hPadding: CGFloat = 10.0 27 | 28 | var body: some View { 29 | GeometryReader { geometry in 30 | ZStack { 31 | self.backgroundGradient 32 | .edgesIgnoringSafeArea(.all) 33 | VStack { 34 | if (QConstants.showDesigner) { self.designerView(geometry) } 35 | self.gridView(geometry) 36 | } 37 | } 38 | } 39 | } 40 | 41 | private func gridView(_ geometry: GeometryProxy) -> some View { 42 | QGrid(Storage.people, 43 | columns: Int(self.columns), 44 | columnsInLandscape: Int(self.columns), 45 | vSpacing: min(self.vSpacing, self.vSpacingMax(geometry)), 46 | hSpacing: max(min(self.hSpacing, self.hSpacingMax(geometry)), 0.0), 47 | vPadding: min(self.vPadding, self.vPaddingMax(geometry)), 48 | hPadding: max(min(self.hPadding, self.hPaddingMax(geometry)), 0.0)) { 49 | GridCell(person: $0) 50 | } 51 | } 52 | 53 | private func designerView(_ geometry: GeometryProxy) -> some View { 54 | return 55 | VStack { 56 | layoutSlider(name: "Columns:", 57 | layoutParam: self.$columns, 58 | minValue: 1.0, 59 | maxValue: CGFloat(QConstants.columnsMax)) 60 | layoutSlider(name: "vSpacing:", 61 | layoutParam: self.$vSpacing, 62 | maxValue: self.vSpacingMax(geometry)) 63 | layoutSlider(name: "hSpacing:", 64 | layoutParam: self.$hSpacing, 65 | maxValue: self.hSpacingMax(geometry)) 66 | layoutSlider(name: "vPadding:", 67 | layoutParam: self.$vPadding, 68 | maxValue: self.vPaddingMax(geometry)) 69 | layoutSlider(name: "hPadding:", 70 | layoutParam: self.$hPadding, 71 | maxValue: self.hPaddingMax(geometry)) 72 | } 73 | .padding([.bottom], 10) 74 | } 75 | 76 | private func layoutSlider(name: String, 77 | layoutParam: Binding, 78 | minValue: CGFloat = 0.0, 79 | maxValue: CGFloat) -> some View { 80 | HStack { 81 | Text(name) 82 | Text("\(Int(min(layoutParam.wrappedValue, maxValue)))") 83 | Slider(value: layoutParam, in: minValue...maxValue, step: 1.0) 84 | } 85 | .font(.headline).foregroundColor(.white) 86 | .padding([.horizontal], 10) 87 | .padding([.bottom], -10) 88 | } 89 | 90 | private func vSpacingMax(_ geometry: GeometryProxy) -> CGFloat { 91 | return geometry.size.height * QConstants.vSpacingMaxToGeometryRatio 92 | } 93 | 94 | private func hSpacingMax(_ geometry: GeometryProxy) -> CGFloat { 95 | return max(geometry.size.width/self.columns - 2 * hPadding, 1.0) 96 | } 97 | 98 | private func vPaddingMax(_ geometry: GeometryProxy) -> CGFloat { 99 | return geometry.size.height * QConstants.vPaddingMaxToGeometryRatio 100 | } 101 | 102 | private func hPaddingMax(_ geometry: GeometryProxy) -> CGFloat { 103 | return geometry.size.width * QConstants.hPaddingMaxToGeometryRatio 104 | } 105 | 106 | private var backgroundGradient: LinearGradient { 107 | let gradient = Gradient(colors: [ 108 | Color(red: 192/255.0, green: 192/255.0, blue: 192/255.0), 109 | Color(red: 50/255.0, green: 50/255.0, blue: 50/255.0) 110 | ]) 111 | return LinearGradient(gradient: gradient, 112 | startPoint: .top, 113 | endPoint: .bottom) 114 | } 115 | } 116 | 117 | struct GridCell: View { 118 | var person: Person 119 | 120 | var body: some View { 121 | VStack() { 122 | Image(person.imageName) 123 | .resizable() 124 | .scaledToFit() 125 | .clipShape(Circle()) 126 | .shadow(color: .primary, radius: 5) 127 | .padding([.horizontal, .top], 7) 128 | Text(person.firstName).lineLimit(1) 129 | Text(person.lastName).lineLimit(1) 130 | } 131 | .font(.headline).foregroundColor(.white) 132 | } 133 | } 134 | 135 | #if DEBUG 136 | struct ListView_Previews : PreviewProvider { 137 | static var previews: some View { 138 | PeopleView() 139 | } 140 | } 141 | #endif 142 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/QGridTestApp.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Resources/people.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "firstName": "Nikola", 5 | "lastName": "Tesla", 6 | "imageName": "nikola_tesla" 7 | }, 8 | { 9 | "id": 2, 10 | "firstName": "Benjamin", 11 | "lastName": "Franklin", 12 | "imageName": "benjamin_franklin" 13 | }, 14 | { 15 | "id": 3, 16 | "firstName": "Henry", 17 | "lastName": "Ford", 18 | "imageName": "henry_ford" 19 | }, 20 | { 21 | "id": 4, 22 | "firstName": "Charles", 23 | "lastName": "Babbage", 24 | "imageName": "charles_babbage" 25 | }, 26 | { 27 | "id": 5, 28 | "firstName": "Alexander", 29 | "lastName": "Bell", 30 | "imageName": "alexander_bell" 31 | }, 32 | { 33 | "id": 6, 34 | "firstName": "Thomas", 35 | "lastName": "Edison", 36 | "imageName": "thomas_edison" 37 | }, 38 | { 39 | "id": 7, 40 | "firstName": "Albert", 41 | "lastName": "Einstein", 42 | "imageName": "albert_einstein" 43 | }, 44 | { 45 | "id": 8, 46 | "firstName": "Marie", 47 | "lastName": "Curie", 48 | "imageName": "marie_curie" 49 | }, 50 | { 51 | "id": 9, 52 | "firstName": "Leonardo", 53 | "lastName": "Da Vinci", 54 | "imageName": "leonardo_da_vinci" 55 | }, 56 | { 57 | "id": 10, 58 | "firstName": "Nikola", 59 | "lastName": "Tesla", 60 | "imageName": "nikola_tesla" 61 | }, 62 | { 63 | "id": 11, 64 | "firstName": "Benjamin", 65 | "lastName": "Franklin", 66 | "imageName": "benjamin_franklin" 67 | }, 68 | { 69 | "id": 12, 70 | "firstName": "Henry", 71 | "lastName": "Ford", 72 | "imageName": "henry_ford" 73 | }, 74 | { 75 | "id": 13, 76 | "firstName": "Charles", 77 | "lastName": "Babbage", 78 | "imageName": "charles_babbage" 79 | }, 80 | { 81 | "id": 14, 82 | "firstName": "Alexander", 83 | "lastName": "Bell", 84 | "imageName": "alexander_bell" 85 | }, 86 | { 87 | "id": 15, 88 | "firstName": "Thomas", 89 | "lastName": "Edison", 90 | "imageName": "thomas_edison" 91 | }, 92 | { 93 | "id": 16, 94 | "firstName": "Albert", 95 | "lastName": "Einstein", 96 | "imageName": "albert_einstein" 97 | }, 98 | { 99 | "id": 17, 100 | "firstName": "Marie", 101 | "lastName": "Curie", 102 | "imageName": "marie_curie" 103 | }, 104 | { 105 | "id": 18, 106 | "firstName": "Leonardo", 107 | "lastName": "Da Vinci", 108 | "imageName": "leonardo_da_vinci" 109 | }, 110 | { 111 | "id": 19, 112 | "firstName": "Nikola", 113 | "lastName": "Tesla", 114 | "imageName": "nikola_tesla" 115 | }, 116 | { 117 | "id": 20, 118 | "firstName": "Benjamin", 119 | "lastName": "Franklin", 120 | "imageName": "benjamin_franklin" 121 | }, 122 | { 123 | "id": 21, 124 | "firstName": "Henry", 125 | "lastName": "Ford", 126 | "imageName": "henry_ford" 127 | }, 128 | { 129 | "id": 22, 130 | "firstName": "Charles", 131 | "lastName": "Babbage", 132 | "imageName": "charles_babbage" 133 | }, 134 | { 135 | "id": 23, 136 | "firstName": "Alexander", 137 | "lastName": "Bell", 138 | "imageName": "alexander_bell" 139 | }, 140 | { 141 | "id": 24, 142 | "firstName": "Thomas", 143 | "lastName": "Edison", 144 | "imageName": "thomas_edison" 145 | }, 146 | { 147 | "id": 25, 148 | "firstName": "Albert", 149 | "lastName": "Einstein", 150 | "imageName": "albert_einstein" 151 | }, 152 | { 153 | "id": 26, 154 | "firstName": "Marie", 155 | "lastName": "Curie", 156 | "imageName": "marie_curie" 157 | }, 158 | { 159 | "id": 27, 160 | "firstName": "Leonardo", 161 | "lastName": "Da Vinci", 162 | "imageName": "leonardo_da_vinci" 163 | } 164 | ] 165 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // QGridTestApp 4 | // 5 | // Created by Karol Kulesza on 7/13/19. 6 | // Copyright © 2019 q-mobile. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | 21 | // Use a UIHostingController as window root view controller 22 | if let windowScene = scene as? UIWindowScene { 23 | let window = UIWindow(windowScene: windowScene) 24 | window.rootViewController = UIHostingController(rootView: PeopleView()) 25 | self.window = window 26 | window.makeKeyAndVisible() 27 | } 28 | } 29 | 30 | func sceneDidDisconnect(_ scene: UIScene) { 31 | // Called as the scene is being released by the system. 32 | // This occurs shortly after the scene enters the background, or when its session is discarded. 33 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 34 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 35 | } 36 | 37 | func sceneDidBecomeActive(_ scene: UIScene) { 38 | // Called when the scene has moved from an inactive state to an active state. 39 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 40 | } 41 | 42 | func sceneWillResignActive(_ scene: UIScene) { 43 | // Called when the scene will move from an active state to an inactive state. 44 | // This may occur due to temporary interruptions (ex. an incoming phone call). 45 | } 46 | 47 | func sceneWillEnterForeground(_ scene: UIScene) { 48 | // Called as the scene transitions from the background to the foreground. 49 | // Use this method to undo the changes made on entering the background. 50 | } 51 | 52 | func sceneDidEnterBackground(_ scene: UIScene) { 53 | // Called as the scene transitions from the foreground to the background. 54 | // Use this method to save data, release shared resources, and store enough scene-specific state information 55 | // to restore the scene back to its current state. 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /QGridTestApp/QGridTestApp/Storage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Storage.swift 3 | // QGrid 4 | // 5 | // Created by Karol Kulesza on 7/06/19. 6 | // Copyright © 2019 Q Mobile { http://Q-Mobile.IT } 7 | // 8 | 9 | import SwiftUI 10 | 11 | 12 | struct Person : Codable, Identifiable { 13 | var id: Int 14 | var firstName: String 15 | var lastName: String 16 | var imageName: String 17 | } 18 | 19 | struct Storage { 20 | static var people: [Person] = load("people.json") 21 | 22 | static func load(_ file: String) -> T { 23 | guard let url = Bundle.main.url(forResource: file, withExtension: nil), 24 | let data = try? Data(contentsOf: url), 25 | let typedData = try? JSONDecoder().decode(T.self, from: data) else { 26 | fatalError("Error while loading data from file: \(file)") 27 | } 28 | return typedData; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /QGridTestApp/Screenshots/People1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/Screenshots/People1.png -------------------------------------------------------------------------------- /QGridTestApp/Screenshots/People2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/Screenshots/People2.png -------------------------------------------------------------------------------- /QGridTestApp/Screenshots/People3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/Screenshots/People3.png -------------------------------------------------------------------------------- /QGridTestApp/Screenshots/People4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Q-Mobile/QGrid/8565654a123a0fa5e7969443cc2b13512c6cea33/QGridTestApp/Screenshots/People4.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | **[NOTE]** 3 | If you'd like to see `QGrid` in action, check out this demo of `QDesigner` (see video below). 4 | Install `QDesigner`: [https://apps.apple.com/us/app/qdesigner/id1500810470](https://apps.apple.com/us/app/qdesigner/id1500810470) 5 | Install a companion `QDesigner Client` on iPhone, to see your UI design on a target device, updated in real-time: 6 | [https://apps.apple.com/us/app/qdesignerclient/id1500946484](https://apps.apple.com/us/app/qdesignerclient/id1500946484) 7 | 8 | Learn more at: [https://Q-Mobile.IT/Q-Designer](https://Q-Mobile.IT/Q-Designer) 9 | 10 | [![QDesigner Preview](QDesignerPreview.png)](https://youtu.be/_nCM9O-v7mQ) 11 | 12 | ![QGrid: The missing SwiftUI collection view.](QGridLogo.png) 13 | 14 |

15 | “Build 16 | Platforms 17 | 18 | Swift Package Manager 19 | License: MIT 20 | Twitter: @karolkulesza 21 |

22 | 23 | `QGrid` is the missing SwiftUI collection view. It uses the same approach as SwiftUI's `List` view, by computing its cells from an underlying collection of identified data. 24 | 25 |
26 | 27 |
28 | 29 | ## 🔷 Requirements 30 | 31 |      ✅ macOS 10.15+ 32 |      ✅ Xcode 11.0 33 |      ✅ Swift 5+ 34 |      ✅ iOS 13+ 35 |      ✅ tvOS 13+ 36 | 37 | ## 🔷 Installation 38 | 39 | `QGrid` is available via [Swift Package Manager](https://swift.org/package-manager). 40 | 41 | Using Xcode 11, go to `File -> Swift Packages -> Add Package Dependency` and enter [https://github.com/Q-Mobile/QGrid](https://github.com/Q-Mobile/QGrid) 42 | 43 | ## 🔷 Usage 44 | 45 | #### ✴️ Basic scenario: 46 | 47 | In its simplest form, `QGrid` can be used with just this 1 line of code within the `body` of your View, assuming you already have a custom cell view: 48 | 49 | ```Swift 50 | struct PeopleView: View { 51 | var body: some View { 52 | QGrid(Storage.people, columns: 3) { GridCell(person: $0) } 53 | } 54 | } 55 | 56 | struct GridCell: View { 57 | var person: Person 58 | 59 | var body: some View { 60 | VStack() { 61 | Image(person.imageName) 62 | .resizable() 63 | .scaledToFit() 64 | .clipShape(Circle()) 65 | .shadow(color: .primary, radius: 5) 66 | .padding([.horizontal, .top], 7) 67 | Text(person.firstName).lineLimit(1) 68 | Text(person.lastName).lineLimit(1) 69 | } 70 | } 71 | } 72 | ``` 73 | 74 | #### ✴️ Customize the default layout configuration: 75 | 76 | You can customize how `QGrid` will layout your cells by providing some additional initializer parameters, which have default values: 77 | 78 | ```swift 79 | struct PeopleView: View { 80 | var body: some View { 81 | QGrid(Storage.people, 82 | columns: 3, 83 | columnsInLandscape: 4, 84 | vSpacing: 50, 85 | hSpacing: 20, 86 | vPadding: 100, 87 | hPadding: 20) { person in 88 | GridCell(person: person) 89 | } 90 | } 91 | } 92 | ``` 93 | 94 | ## 🔷 Example App 95 | 96 | 📱`QGridTestApp` directory in this repository contains a very simple application that uses `QGrid`. Open `QGridTestApp/QGridTestApp.xcodeproj` and either use the new Xcode Previews feature or just run the app. 97 | 98 | 99 |
100 | 101 | 102 | 105 | 108 | 109 |
103 | 104 | 106 | 107 |
110 | 111 | 112 | 115 | 116 | 117 | 120 | 121 |
113 | 114 |
118 | 119 |
122 |
123 | 124 | ## 🔷 QGrid Designer 125 | 126 | 📱`QGridTestApp` contains also the QGrid Designer area view, with sliders for dynamic run-time configuration of the QGrid view (with config option to hide it). Please refer to the following demo executed on the device: 127 | 128 |

129 | 130 |

131 | 132 | ## 🔷 Roadmap / TODOs 133 | 134 | Version `0.1.1` of `QGrid ` contains a very limited set of features. It could be extended by implementing the following tasks: 135 | 136 |      ☘️ Parameterize spacing&padding configuration depending on the device orientation 137 |      ☘️ Add the option to specify scroll direction 138 |      ☘️ Add content-only initializer to QGrid struct, without a collection of identified data as argument (As in SwiftUI’s `List`) 139 |      ☘️ Add support for other platforms (watchOS) 140 |      ☘️ Add `Stack` layout option (as in `UICollectionView`) 141 |      ☘️ Add unit/UI tests 142 |      ☘️ ... many other improvements 143 | 144 | ## 🔷 Contributing 145 | 146 | 👨🏻‍🔧 Feel free to contribute to `QGrid ` by creating a pull request, following these guidelines: 147 | 148 | 1. Fork `QGrid ` 149 | 2. Create your feature branch 150 | 3. Commit your changes, along with unit tests 151 | 4. Push to the branch 152 | 5. Create pull request 153 | 154 | 155 | ## 🔷 Author 156 | 157 |      👨‍💻 [Karol Kulesza](https://github.com/karolkulesza) ([@karolkulesza](https://twitter.com/karolkulesza)) 158 | 159 | 160 | ## 🔷 License 161 | 162 |      📄 QGrid is available under the MIT license. See the LICENSE file for more info. 163 | -------------------------------------------------------------------------------- /Sources/QGrid/QGrid.swift: -------------------------------------------------------------------------------- 1 | // 2 | // QGrid.swift 3 | // QGrid 4 | // 5 | // Created by Karol Kulesza on 7/06/19. 6 | // Copyright © 2019 Q Mobile { http://Q-Mobile.IT } 7 | // 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | import SwiftUI 28 | 29 | 30 | /// A container that presents rows of data arranged in multiple columns. 31 | @available(iOS 13.0, OSX 10.15, *) 32 | public struct QGrid: View 33 | where Data : RandomAccessCollection, Content : View, Data.Element : Identifiable { 34 | private struct QGridIndex : Identifiable { var id: Int } 35 | 36 | // MARK: - STORED PROPERTIES 37 | 38 | private let columns: Int 39 | private let columnsInLandscape: Int 40 | private let vSpacing: CGFloat 41 | private let hSpacing: CGFloat 42 | private let vPadding: CGFloat 43 | private let hPadding: CGFloat 44 | private let isScrollable: Bool 45 | private let showScrollIndicators: Bool 46 | 47 | private let data: [Data.Element] 48 | private let content: (Data.Element) -> Content 49 | 50 | // MARK: - INITIALIZERS 51 | 52 | /// Creates a QGrid that computes its cells from an underlying collection of identified data. 53 | /// 54 | /// - Parameters: 55 | /// - data: A collection of identified data. 56 | /// - columns: Target number of columns for this grid, in Portrait device orientation 57 | /// - columnsInLandscape: Target number of columns for this grid, in Landscape device orientation; If not provided, `columns` value will be used. 58 | /// - vSpacing: Vertical spacing: The distance between each row in grid. If not provided, the default value will be used. 59 | /// - hSpacing: Horizontal spacing: The distance between each cell in grid's row. If not provided, the default value will be used. 60 | /// - vPadding: Vertical padding: The distance between top/bottom edge of the grid and the parent view. If not provided, the default value will be used. 61 | /// - hPadding: Horizontal padding: The distance between leading/trailing edge of the grid and the parent view. If not provided, the default value will be used. 62 | /// - isScrollable: Boolean that determines whether or not the grid should scroll 63 | /// - content: A closure returning the content of the individual cell 64 | public init(_ data: Data, 65 | columns: Int, 66 | columnsInLandscape: Int? = nil, 67 | vSpacing: CGFloat = 10, 68 | hSpacing: CGFloat = 10, 69 | vPadding: CGFloat = 10, 70 | hPadding: CGFloat = 10, 71 | isScrollable: Bool = true, 72 | showScrollIndicators: Bool = false, 73 | content: @escaping (Data.Element) -> Content) { 74 | self.data = data.map { $0 } 75 | self.content = content 76 | self.columns = max(1, columns) 77 | self.columnsInLandscape = columnsInLandscape ?? max(1, columns) 78 | self.vSpacing = vSpacing 79 | self.hSpacing = hSpacing 80 | self.vPadding = vPadding 81 | self.hPadding = hPadding 82 | self.isScrollable = isScrollable 83 | self.showScrollIndicators = showScrollIndicators 84 | } 85 | 86 | // MARK: - COMPUTED PROPERTIES 87 | 88 | private var rows: Int { 89 | data.count / self.cols 90 | } 91 | 92 | private var cols: Int { 93 | #if os(tvOS) 94 | return columnsInLandscape 95 | #elseif os(macOS) 96 | return columnsInLandscape 97 | #else 98 | return UIDevice.current.orientation.isLandscape ? columnsInLandscape : columns 99 | #endif 100 | } 101 | 102 | /// Declares the content and behavior of this view. 103 | public var body : some View { 104 | GeometryReader { geometry in 105 | Group { 106 | if !self.data.isEmpty { 107 | if self.isScrollable { 108 | ScrollView(showsIndicators: self.showScrollIndicators) { 109 | self.content(using: geometry) 110 | } 111 | } else { 112 | self.content(using: geometry) 113 | } 114 | } 115 | } 116 | .padding(.horizontal, self.hPadding) 117 | .padding(.vertical, self.vPadding) 118 | } 119 | } 120 | 121 | // MARK: - `BODY BUILDER` 💪 FUNCTIONS 122 | 123 | private func rowAtIndex(_ index: Int, 124 | geometry: GeometryProxy, 125 | isLastRow: Bool = false) -> some View { 126 | HStack(spacing: self.hSpacing) { 127 | ForEach((0..<(isLastRow ? data.count % cols : cols)) 128 | .map { QGridIndex(id: $0) }) { column in 129 | self.content(self.data[index + column.id]) 130 | .frame(width: self.contentWidthFor(geometry)) 131 | } 132 | if isLastRow { Spacer() } 133 | } 134 | } 135 | 136 | private func content(using geometry: GeometryProxy) -> some View { 137 | VStack(spacing: self.vSpacing) { 138 | ForEach((0.. 0) { 144 | self.rowAtIndex(self.cols * self.rows, 145 | geometry: geometry, 146 | isLastRow: true) 147 | } 148 | } 149 | } 150 | 151 | // MARK: - HELPER FUNCTIONS 152 | 153 | private func contentWidthFor(_ geometry: GeometryProxy) -> CGFloat { 154 | let hSpacings = hSpacing * (CGFloat(self.cols) - 1) 155 | let width = geometry.size.width - hSpacings - hPadding * 2 156 | return width / CGFloat(self.cols) 157 | } 158 | } 159 | 160 | --------------------------------------------------------------------------------