Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MIAlertController.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |spec|
spec.name = 'MIAlertController'
spec.version = '1.3'
spec.version = '1.4'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://github.com/MarioIannotta/MIAlertController'
spec.homepage = 'https://github.com/Song-Street/MIAlertController'
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this, let's point to the master repository

spec.authors = { 'Mario Iannotta' => 'info@marioiannotta.com' }
spec.summary = 'A simple fully customizable alert controller'
spec.source = { :git => 'https://github.com/MarioIannotta/MIAlertController.git', :tag => spec.version.to_s }
spec.source = { :git => 'https://github.com/Song-Street/MIAlertController.git', :tag => spec.version.to_s, }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this too

spec.source_files = 'MIAlertController/*'
spec.ios.deployment_target = '9.0'
end
56 changes: 28 additions & 28 deletions MIAlertController/MIAlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ open class MIAlertController: UIViewController {
public var titleLabelTextAlignment = NSTextAlignment.center

// Message
public var messageLabelFont = UIFont.systemFont(ofSize: 16)
public var messageLabelFont = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.light)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be UIFont.systemFont(ofSize: 16, weight: .light)

public var messageLabelTextColor = UIColor.black
public var messageLabelTextAlignment = NSTextAlignment.center
public var messageVerticalSpaceFromTitle: CGFloat = 10
Expand All @@ -54,7 +54,7 @@ open class MIAlertController: UIViewController {

public var font = UIFont.boldSystemFont(ofSize: 15)
public var textColor = UIColor.black
public var textAlignment = UIControlContentHorizontalAlignment.center
public var textAlignment = UIControl.ContentHorizontalAlignment.center
public var backgroundColor = UIColor.clear
public var buttonHeight: CGFloat = 60
public var contentEdgeOffset = UIEdgeInsets.zero
Expand All @@ -63,7 +63,7 @@ open class MIAlertController: UIViewController {

}

public init(font: UIFont, textColor: UIColor, textAlignment: UIControlContentHorizontalAlignment, backgroundColor: UIColor, buttonHeight: CGFloat, contentEdgeOffset: UIEdgeInsets) {
public init(font: UIFont, textColor: UIColor, textAlignment: UIControl.ContentHorizontalAlignment, backgroundColor: UIColor, buttonHeight: CGFloat, contentEdgeOffset: UIEdgeInsets) {

self.font = font
self.textColor = textColor
Expand All @@ -77,7 +77,7 @@ open class MIAlertController: UIViewController {
}

public enum `Type` {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't commit this kind of changes

case `default`
case destructive
case cancel
Expand All @@ -91,7 +91,7 @@ open class MIAlertController: UIViewController {
return Config(
font: UIFont.systemFont(ofSize: 16),
textColor: UIColor(red: 33/255.0, green: 129/255.0, blue: 247/255.0, alpha: 1),
textAlignment: .center,
textAlignment: UIControl.ContentHorizontalAlignment.center,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could by just .center

backgroundColor: UIColor.clear,
buttonHeight: 60,
contentEdgeOffset: UIEdgeInsets.zero
Expand All @@ -102,7 +102,7 @@ open class MIAlertController: UIViewController {
return Config(
font: UIFont.boldSystemFont(ofSize: 16),
textColor: UIColor(red: 218/255.0, green: 75/255.0, blue: 56/255.0, alpha: 1),
textAlignment: .center,
textAlignment: UIControl.ContentHorizontalAlignment.center,
backgroundColor: UIColor.clear,
buttonHeight: 60,
contentEdgeOffset: UIEdgeInsets.zero
Expand All @@ -113,7 +113,7 @@ open class MIAlertController: UIViewController {
return Config(
font: UIFont.boldSystemFont(ofSize: 16),
textColor: UIColor(red: 33/255.0, green: 129/255.0, blue: 247/255.0, alpha: 1),
textAlignment: .center,
textAlignment: UIControl.ContentHorizontalAlignment.center,
backgroundColor: UIColor.clear,
buttonHeight: 60,
contentEdgeOffset: UIEdgeInsets.zero
Expand Down Expand Up @@ -142,10 +142,10 @@ open class MIAlertController: UIViewController {

let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: config.buttonHeight))

button.setTitle(title, for: UIControlState())
button.setTitle(title, for: UIControl.State())
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be just .State()

button.titleLabel?.adjustsFontSizeToFitWidth = true
button.titleLabel?.minimumScaleFactor = 0.7
button.setTitleColor(config.textColor, for: UIControlState())
button.setTitleColor(config.textColor, for: UIControl.State())
button.titleLabel?.font = config.font
button.backgroundColor = config.backgroundColor
button.contentHorizontalAlignment = config.textAlignment
Expand Down Expand Up @@ -197,7 +197,7 @@ open class MIAlertController: UIViewController {
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

public init(title: String? = nil, message: String? = nil, buttons: [Button]? = nil, config: Config? = nil) {

super.init(nibName: "MIAlertController", bundle: Bundle(for: MIAlertController.self))
Expand Down Expand Up @@ -367,7 +367,7 @@ open class MIAlertController: UIViewController {

// MARK: - Buttons stuff
fileprivate func createButtons(_ buttons: [Button]?) {

guard let buttons = buttons else { return }

buttonsList = [UIButton]()
Expand All @@ -383,7 +383,7 @@ open class MIAlertController: UIViewController {
buttonsList.append(uiButton)

}

setupButtonsUI()

}
Expand Down Expand Up @@ -439,10 +439,10 @@ open class MIAlertController: UIViewController {

@objc fileprivate func buttonTapped(_ button: UIButton) {

if let buttonIndex = buttonsList.index(where: { $0 == button }) {
if let buttonIndex = buttonsList.firstIndex(where: { $0 == button }) {
self.buttonTappedClosures?[buttonIndex]?()
}

dismiss(animated: true, completion: nil)

}
Expand All @@ -457,7 +457,7 @@ open class MIAlertController: UIViewController {
createButtons(alertButtons)

setupUI()

}

// MARK: - IBActions
Expand All @@ -466,7 +466,7 @@ open class MIAlertController: UIViewController {
dismiss(animated: true, completion: nil)
}
}

}

// MARK: - CustomTransition stuff
Expand Down Expand Up @@ -509,7 +509,7 @@ extension MIAlertController: UIViewControllerAnimatedTransitioning, UIViewContro

let presentedController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) as? MIAlertController,
let presentedControllerView = transitionContext.view(forKey: UITransitionContextViewKey.to)

else { return }

let containerView = transitionContext.containerView
Expand Down Expand Up @@ -538,11 +538,11 @@ extension MIAlertController: UIViewControllerAnimatedTransitioning, UIViewContro
presentedController.view.alpha = 1
presentedController.alertBackgroundView.alpha = 1

}, completion: {(completed: Bool) -> Void in
transitionContext.completeTransition(completed)
}
}, completion: {(completed: Bool) -> Void in

transitionContext.completeTransition(completed)

}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written before, please don't commit insubstantial changes


)

Expand All @@ -554,7 +554,7 @@ extension MIAlertController: UIViewControllerAnimatedTransitioning, UIViewContro
let presentedControllerView = transitionContext.view(forKey: UITransitionContextViewKey.from)

else { return }

UIView.animate(

withDuration: transitionDuration(using: transitionContext),
Expand All @@ -567,11 +567,11 @@ extension MIAlertController: UIViewControllerAnimatedTransitioning, UIViewContro
presentedController.alertBackgroundView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
presentedControllerView.alpha = 0

}, completion: {(completed: Bool) -> Void in
transitionContext.completeTransition(completed)
}
}, completion: {(completed: Bool) -> Void in

transitionContext.completeTransition(completed)

}

)

Expand Down
26 changes: 22 additions & 4 deletions MIAlertControllerDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Mario Iannotta";
TargetAttributes = {
ACAE3BEE1D33C9260034530E = {
Expand All @@ -129,7 +129,7 @@
};
buildConfigurationList = ACAE3BEA1D33C9260034530E /* Build configuration list for PBXProject "MIAlertControllerDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -242,19 +242,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -290,19 +299,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -339,7 +357,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.marioiannotta.MIAlertControllerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -354,7 +372,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.marioiannotta.MIAlertControllerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 1 addition & 3 deletions MIAlertControllerDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}

Expand Down
18 changes: 9 additions & 9 deletions Pods/MIAlertController/MIAlertController/MIAlertController.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading