Browse Source

Start sheet

master
Shadowfacts 2 years ago
parent
commit
481f40519c
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
  1. 78
      .gitignore
  2. 202
      SheetImagePicker.xcodeproj/project.pbxproj
  3. 5
      SheetImagePicker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist
  4. 31
      SheetImagePicker/Detent.swift
  5. 89
      SheetImagePicker/SheetContainerViewController.swift
  6. 37
      SheetImagePickerTest/AppDelegate.swift
  7. 98
      SheetImagePickerTest/Assets.xcassets/AppIcon.appiconset/Contents.json
  8. 6
      SheetImagePickerTest/Assets.xcassets/Contents.json
  9. 25
      SheetImagePickerTest/Base.lproj/LaunchScreen.storyboard
  10. 24
      SheetImagePickerTest/Base.lproj/Main.storyboard
  11. 64
      SheetImagePickerTest/Info.plist
  12. 53
      SheetImagePickerTest/SceneDelegate.swift
  13. 36
      SheetImagePickerTest/ViewController.swift

78
.gitignore

@ -0,0 +1,78 @@
.DS_Store
MyPlayground.playground/
### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
.build/
# CocoaPods - Refactored to standalone file
# Carthage - Refactored to standalone file
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
## Various settings
## Other
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

202
SheetImagePicker.xcodeproj/project.pbxproj

@ -8,12 +8,56 @@
/* Begin PBXBuildFile section */
D610D2D6233945AF009EB06A /* SheetImagePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = D610D2D4233945AF009EB06A /* SheetImagePicker.h */; settings = {ATTRIBUTES = (Public, ); }; };
D610D2E3233945B9009EB06A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D610D2E2233945B9009EB06A /* AppDelegate.swift */; };
D610D2E5233945B9009EB06A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D610D2E4233945B9009EB06A /* SceneDelegate.swift */; };
D610D2E7233945B9009EB06A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D610D2E6233945B9009EB06A /* ViewController.swift */; };
D610D2EA233945B9009EB06A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D610D2E8233945B9009EB06A /* Main.storyboard */; };
D610D2EC233945BB009EB06A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D610D2EB233945BB009EB06A /* Assets.xcassets */; };
D610D2EF233945BB009EB06A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D610D2ED233945BB009EB06A /* LaunchScreen.storyboard */; };
D610D2F5233945C0009EB06A /* SheetImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D610D2D1233945AF009EB06A /* SheetImagePicker.framework */; };
D610D2F6233945C0009EB06A /* SheetImagePicker.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D610D2D1233945AF009EB06A /* SheetImagePicker.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D610D2FD23394E00009EB06A /* SheetContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D610D2FC23394E00009EB06A /* SheetContainerViewController.swift */; };
D610D2FF23395975009EB06A /* Detent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D610D2FE23395975009EB06A /* Detent.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
D610D2F7233945C0009EB06A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D610D2C8233945AF009EB06A /* Project object */;
proxyType = 1;
remoteGlobalIDString = D610D2D0233945AF009EB06A;
remoteInfo = SheetImagePicker;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
D610D2F9233945C0009EB06A /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
D610D2F6233945C0009EB06A /* SheetImagePicker.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
D610D2D1233945AF009EB06A /* SheetImagePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SheetImagePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D610D2D4233945AF009EB06A /* SheetImagePicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SheetImagePicker.h; sourceTree = "<group>"; };
D610D2D5233945AF009EB06A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D610D2E0233945B9009EB06A /* SheetImagePickerTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SheetImagePickerTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
D610D2E2233945B9009EB06A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D610D2E4233945B9009EB06A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
D610D2E6233945B9009EB06A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
D610D2E9233945B9009EB06A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
D610D2EB233945BB009EB06A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D610D2EE233945BB009EB06A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D610D2F0233945BB009EB06A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D610D2FC23394E00009EB06A /* SheetContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetContainerViewController.swift; sourceTree = "<group>"; };
D610D2FE23395975009EB06A /* Detent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Detent.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -24,6 +68,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
D610D2DD233945B9009EB06A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D610D2F5233945C0009EB06A /* SheetImagePicker.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@ -31,7 +83,9 @@
isa = PBXGroup;
children = (
D610D2D3233945AF009EB06A /* SheetImagePicker */,
D610D2E1233945B9009EB06A /* SheetImagePickerTest */,
D610D2D2233945AF009EB06A /* Products */,
D610D2F4233945C0009EB06A /* Frameworks */,
);
sourceTree = "<group>";
};
@ -39,6 +93,7 @@
isa = PBXGroup;
children = (
D610D2D1233945AF009EB06A /* SheetImagePicker.framework */,
D610D2E0233945B9009EB06A /* SheetImagePickerTest.app */,
);
name = Products;
sourceTree = "<group>";
@ -47,11 +102,34 @@
isa = PBXGroup;
children = (
D610D2D4233945AF009EB06A /* SheetImagePicker.h */,
D610D2FC23394E00009EB06A /* SheetContainerViewController.swift */,
D610D2FE23395975009EB06A /* Detent.swift */,
D610D2D5233945AF009EB06A /* Info.plist */,
);
path = SheetImagePicker;
sourceTree = "<group>";
};
D610D2E1233945B9009EB06A /* SheetImagePickerTest */ = {
isa = PBXGroup;
children = (
D610D2E2233945B9009EB06A /* AppDelegate.swift */,
D610D2E4233945B9009EB06A /* SceneDelegate.swift */,
D610D2E6233945B9009EB06A /* ViewController.swift */,
D610D2E8233945B9009EB06A /* Main.storyboard */,
D610D2EB233945BB009EB06A /* Assets.xcassets */,
D610D2ED233945BB009EB06A /* LaunchScreen.storyboard */,
D610D2F0233945BB009EB06A /* Info.plist */,
);
path = SheetImagePickerTest;
sourceTree = "<group>";
};
D610D2F4233945C0009EB06A /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -84,17 +162,41 @@
productReference = D610D2D1233945AF009EB06A /* SheetImagePicker.framework */;
productType = "com.apple.product-type.framework";
};
D610D2DF233945B9009EB06A /* SheetImagePickerTest */ = {
isa = PBXNativeTarget;
buildConfigurationList = D610D2F1233945BB009EB06A /* Build configuration list for PBXNativeTarget "SheetImagePickerTest" */;
buildPhases = (
D610D2DC233945B9009EB06A /* Sources */,
D610D2DD233945B9009EB06A /* Frameworks */,
D610D2DE233945B9009EB06A /* Resources */,
D610D2F9233945C0009EB06A /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
D610D2F8233945C0009EB06A /* PBXTargetDependency */,
);
name = SheetImagePickerTest;
productName = SheetImagePickerTest;
productReference = D610D2E0233945B9009EB06A /* SheetImagePickerTest.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D610D2C8233945AF009EB06A /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = Shadowfacts;
TargetAttributes = {
D610D2D0233945AF009EB06A = {
CreatedOnToolsVersion = 11.0;
LastSwiftMigration = 1100;
};
D610D2DF233945B9009EB06A = {
CreatedOnToolsVersion = 11.0;
};
};
};
@ -112,6 +214,7 @@
projectRoot = "";
targets = (
D610D2D0233945AF009EB06A /* SheetImagePicker */,
D610D2DF233945B9009EB06A /* SheetImagePickerTest */,
);
};
/* End PBXProject section */
@ -124,6 +227,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
D610D2DE233945B9009EB06A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D610D2EF233945BB009EB06A /* LaunchScreen.storyboard in Resources */,
D610D2EC233945BB009EB06A /* Assets.xcassets in Resources */,
D610D2EA233945B9009EB06A /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -131,11 +244,50 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D610D2FD23394E00009EB06A /* SheetContainerViewController.swift in Sources */,
D610D2FF23395975009EB06A /* Detent.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D610D2DC233945B9009EB06A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D610D2E7233945B9009EB06A /* ViewController.swift in Sources */,
D610D2E3233945B9009EB06A /* AppDelegate.swift in Sources */,
D610D2E5233945B9009EB06A /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
D610D2F8233945C0009EB06A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D610D2D0233945AF009EB06A /* SheetImagePicker */;
targetProxy = D610D2F7233945C0009EB06A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
D610D2E8233945B9009EB06A /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
D610D2E9233945B9009EB06A /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
D610D2ED233945BB009EB06A /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
D610D2EE233945BB009EB06A /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
D610D2D7233945AF009EB06A /* Debug */ = {
isa = XCBuildConfiguration;
@ -260,6 +412,7 @@
D610D2DA233945AF009EB06A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = HGYVAQA9FW;
@ -276,6 +429,7 @@
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.SheetImagePicker;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -284,6 +438,7 @@
D610D2DB233945AF009EB06A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = HGYVAQA9FW;
@ -305,6 +460,44 @@
};
name = Release;
};
D610D2F2233945BB009EB06A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = HGYVAQA9FW;
INFOPLIST_FILE = SheetImagePickerTest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.SheetImagePickerTest;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
D610D2F3233945BB009EB06A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = HGYVAQA9FW;
INFOPLIST_FILE = SheetImagePickerTest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.SheetImagePickerTest;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -326,6 +519,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D610D2F1233945BB009EB06A /* Build configuration list for PBXNativeTarget "SheetImagePickerTest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D610D2F2233945BB009EB06A /* Debug */,
D610D2F3233945BB009EB06A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D610D2C8233945AF009EB06A /* Project object */;

5
SheetImagePicker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist

@ -9,6 +9,11 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>SheetImagePickerTest.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>

31
SheetImagePicker/Detent.swift

@ -0,0 +1,31 @@
//
// Detent.swift
// SheetImagePicker
//
// Created by Shadowfacts on 9/23/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
public enum Detent {
case top
case middle
case bottom
case other(CGFloat)
}
extension Detent {
func offset(in view: UIView) -> CGFloat {
switch self {
case .top:
return max(view.safeAreaInsets.top, 50)
case .middle:
return view.bounds.midY
case .bottom:
return view.bounds.height - view.safeAreaInsets.bottom - 100//max(view.safeAreaInsets.bottom, 100)
case let .other(value):
return value
}
}
}

89
SheetImagePicker/SheetContainerViewController.swift

@ -0,0 +1,89 @@
//
// SheetContainerViewController.swift
// SheetImagePicker
//
// Created by Shadowfacts on 9/23/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
public class SheetContainerViewController: UIViewController {
let content: UIViewController
public var detents: [Detent] = [.bottom, .middle, .top] {
didSet {
}
}
var topConstraint: NSLayoutConstraint!
lazy var initialConstant: CGFloat = view.bounds.height / 2
public init(content: UIViewController) {
self.content = content
super.init(nibName: nil, bundle: nil)
}
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override public func viewDidLoad() {
super.viewDidLoad()
addChild(content)
content.didMove(toParent: self)
view.addSubview(content.view)
topConstraint = content.view.topAnchor.constraint(equalTo: view.topAnchor, constant: initialConstant)
NSLayoutConstraint.activate([
content.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
content.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
topConstraint,
content.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(panGestureRecognized(_:)))
content.view.addGestureRecognizer(panGesture)
}
@objc func panGestureRecognized(_ recognizer: UIPanGestureRecognizer) {
switch recognizer.state {
case .began:
initialConstant = topConstraint.constant
case .changed:
let translation = recognizer.translation(in: content.view)
var realOffset = initialConstant + translation.y
if realOffset < view.safeAreaInsets.top {
print(realOffset)
realOffset = view.safeAreaInsets.top - realOffset / pow(CGFloat(M_E), realOffset / view.safeAreaInsets.top)
}
topConstraint.constant = realOffset
case .ended:
if let offset = nearestDetentOffset(offset: topConstraint.constant) {
let distance = abs(topConstraint.constant - offset)
self.topConstraint.constant = offset
let velocity = recognizer.velocity(in: view)
let springVelocity = velocity.y / distance
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: springVelocity, animations: {
self.view.layoutIfNeeded()
})
}
default:
return
}
}
func nearestDetentOffset(offset: CGFloat) -> CGFloat? {
return detents.map { $0.offset(in: view) }.min { (a, b) -> Bool in
return abs(offset - a) < abs(offset - b)
}
}
}

37
SheetImagePickerTest/AppDelegate.swift

@ -0,0 +1,37 @@
//
// AppDelegate.swift
// SheetImagePickerTest
//
// Created by Shadowfacts on 9/23/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

98
SheetImagePickerTest/Assets.xcassets/AppIcon.appiconset/Contents.json

@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

6
SheetImagePickerTest/Assets.xcassets/Contents.json

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

25
SheetImagePickerTest/Base.lproj/LaunchScreen.storyboard

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

24
SheetImagePickerTest/Base.lproj/Main.storyboard

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

64
SheetImagePickerTest/Info.plist

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

53
SheetImagePickerTest/SceneDelegate.swift

@ -0,0 +1,53 @@
//
// SceneDelegate.swift
// SheetImagePickerTest
//
// Created by Shadowfacts on 9/23/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

36
SheetImagePickerTest/ViewController.swift

@ -0,0 +1,36 @@
//
// ViewController.swift
// SheetImagePickerTest
//
// Created by Shadowfacts on 9/23/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
import SheetImagePicker
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let content = UIViewController()
content.view.translatesAutoresizingMaskIntoConstraints = false
content.view.backgroundColor = .red
let sheet = SheetContainerViewController(content: content)
sheet.view.backgroundColor = .blue
addChild(sheet)
sheet.didMove(toParent: self)
view.addSubview(sheet.view)
NSLayoutConstraint.activate([
sheet.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
sheet.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
sheet.view.topAnchor.constraint(equalTo: view.topAnchor),
sheet.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
}
Loading…
Cancel
Save