-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Issue but Code Further optimization #10
Comments
@imran87 Thx for reporting issue. |
Thanks a lot for reply *Mr* Kishimoto I meant there have been
written same code in case of ActionSheet or Pop over .Let me give me example if I have
universal app So using your code business logic I will check first iPhone
or iPad. like that
if iPhone { Alertift.actionSheet(message: "Which food do you like?")
.action(.default("🍣"))
.action(.default("🍎"))
.action(.default("🍖"))
.action(.default("🍅"))
.action(.cancel("None of them"))
.finally { action, index in
if action.style == .cancel {
return
}
Alertift.alert(message: "\(index). \(action.title!)")
.action(.default("OK"))
.show()
}
.show()
} else { Alertift.actionSheet(message: "Which food do you like?")
.popover(anchorView: button)
.action(.default("🍣"))
.action(.default("🍎"))
.action(.default("🍖"))
.action(.default("🍅"))
.action(.cancel("None of them"))
.finally { action, index in
if action.style == .cancel {
return
}
Alertift.alert(message: "\(index). \(action.title!)")
.action(.default("OK"))
.show()
}
.show()}
So in this way I think repetation of code repeat the same code for iPad
too. So code should manage internally no need to check for iPhone or iPad
If Am I wrong please correct me.
Regards
Imran Khan
(iOS) Software Engineer
+923115106978
…On Sat, May 6, 2017 at 7:55 PM, Suguru Kishimoto ***@***.***> wrote:
@imran87 <https://github.com/imran87> Thx for reporting issue.
But, popover's sourceView is automatically ignored in case of iPhone. So
I think there is no need for the user to judge iPhone or iPad.
Just in case, I will add some implementations so that the application
won't crash if popover's sourceView is not set.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIsFpAGDO52eS5U9nUpXtpEhKRu-NJaLks5r3InXgaJpZM4NQl2f>
.
|
You can write code like below without checking device iPhone or iPad in universal app. // it works both iPhone and iPad without checking.
Alertift.actionSheet(message: "Which food do you like?")
.popover(anchorView: button) // iPhone: ignored internally, iPad: set anchorView to _alertController.popoverPresentationController
.action(.default("🍣"))
.action(.default("🍎"))
.action(.default("🍖"))
.action(.default("🍅"))
.action(.cancel("None of them"))
.finally { action, index in
if action.style == .cancel {
return
}
Alertift.alert(message: "\(index). \(action.title!)")
.action(.default("OK"))
.show()
}
.show() No need // not good!
if iPhone {
Alertift.actionSheet(message: "Which food do you like?")
.action(...)
.show()
} else {
Alertift.actionSheet(message: "Which food do you like?")
.popover(anchorView: button)
.action(...)
.show()
} 👍 👍 |
Hi there, I figured this might be the right place. Is there a way to also customise the color of the 2px line on the alert between the body text and the action text? Thanks, I enjoy using this alert library. Very easy to use. |
Very Good @suguru Kishimoto and once again thanks. I like your statement
*"**.popover(anchorView: button) // iPhone: ignored internally, iPad: set
anchorView to".*
So you mean *.popover(anchorView:button) *will be ignored in case of iPhone.
Got It & God bless You.
Regards
Imran Khan
(iOS) Software Engineer
+923115106978
…On Sun, May 7, 2017 at 2:01 PM, Simon ***@***.***> wrote:
Hi there, I figured this might be the right place. Is there a way to also
customise the color of the 2px line on the alert between the body text and
the action text?
Giving the background black as a color makes the line disappear completely
visually. :)
Thanks, I enjoy using this alert library. Very easy to use.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIsFpEJ1i91uAE9XxRnzMvjhBHZvHnnCks5r3YhngaJpZM4NQl2f>
.
|
First of all well done a very good and complete written wrapper for UIAlert Controller. So my point is that when a user call action sheet on iPhone or iPad so your code should automattically set popover if device is a iPad so there is no need of user decision.
The text was updated successfully, but these errors were encountered: