func getURL(ofPhotoWith mPhasset: PHAsset, completionHandler : @escaping ((_ responseURL : URL?) -> Void)) { | |
if mPhasset.mediaType == .image { | |
let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions() | |
options.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData) -> Bool in | |
return true | |
} | |
mPhasset.requestContentEditingInput(with: options, completionHandler: { (contentEditingInput, info) in | |
completionHandler(contentEditingInput!.fullSizeImageURL) | |
}) |
애플에서 제공한 문서 에서 자세한 내용을 확인할 수 있습니다.
<중요> 테스트를 진행하 때는 반드시 로컬 IPv6 네트워크만 활성화 되어 있어야 합니다. 예를 들어 셀룰러 서비스가 켜져 있다면 비활성화 하여 Wi-Fi만으로 테스트가 진행되도록 설정해야 합니다.
(1) MAC 컴퓨터 (혹은 노트북)이 Wi-Fi가 아닌 방식으로 인터넷에 연결되어 있는 지 확인하세요.
(2) 시스템 환경 설정을 실행하세요.
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
import UIKit | |
extension UIColor { | |
convenience init(hex: String, alpha: CGFloat = 1) { | |
assert(hex[hex.startIndex] == "#", "Expected hex string of format #RRGGBB") | |
let scanner = NSScanner(string: hex) | |
scanner.scanLocation = 1 // skip # | |
var rgb: UInt32 = 0 |
Author: https://www.cyanhall.com/
Core Animation's original name is Layer Kit
Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree
. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.
In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer
. The only major feature of UIView that isn’t handled by CALayer is user interaction.
There are four hierarchies, each performing a different role:
extension UIViewController { | |
func topMostViewController() -> UIViewController { | |
if self.presentedViewController == nil { | |
return self | |
} | |
if let navigation = self.presentedViewController as? UINavigationController { | |
return navigation.visibleViewController.topMostViewController() | |
} | |
if let tab = self.presentedViewController as? UITabBarController { | |
if let selectedTab = tab.selectedViewController { |
These rules are adopted from the AngularJS commit conventions.
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the\
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
#!/bin/bash | |
# save the file as <git_directory>/.git/hooks/pre-commit | |
echo "Running Maven clean test for errors" | |
# retrieving current working directory | |
CWD=`pwd` | |
MAIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
# go to main project dir | |
cd $MAIN_DIR/../../ |