Project
Add framework: EventKit.framework
Info.plist
<key>NSRemindersUsageDescription</key>
<string>Add app reminders to Reminders</string>
Class
import EventKit
...
var eventStore = EKEventStore()
var calendars:Array<EKCalendar> = []
...
let reminder = EKReminder(eventStore: self.eventStore)
reminder.title = "title"
reminder.calendar = self.eventStore.defaultCalendarForNewReminders()
reminder.dueDateComponents = Calendar(identifier: .gregorian).dateComponents([.day, .month, .year, .hour, .minute, .timeZone], from: reminderDate)
let alarm = EKAlarm(absoluteDate: reminderDate)
reminder.addAlarm(alarm)
jueves, 30 de marzo de 2017
viernes, 17 de marzo de 2017
iOS: Symbolicate crash (dSYM)
https://www.apteligent.com/technical-resource/symbolicating-an-ios-crash-report/
viernes, 10 de marzo de 2017
iOS: Change constraint at runtime
Swift
let filteredConstraints = menuFooterCell?.contentView.constraints.filter { $0.identifier == "rightMargin" }
if let yourConstraint = filteredConstraints?.first {
yourConstraint.constant = tableView.frame.size.width - revealViewController().rearViewRevealWidth + 32
menuFooterCell?.updateConstraints()
}
More cleaver way:
public func set(constantValue constant: CGFloat, toConstraintNamed name: String) {
let filteredConstraints = self.constraints.filter { $0.identifier == name }
if let yourConstraint = filteredConstraints.first {
yourConstraint.constant = constant
self.updateConstraints()
}
}
let filteredConstraints = menuFooterCell?.contentView.constraints.filter { $0.identifier == "rightMargin" }
if let yourConstraint = filteredConstraints?.first {
yourConstraint.constant = tableView.frame.size.width - revealViewController().rearViewRevealWidth + 32
menuFooterCell?.updateConstraints()
}
More cleaver way:
public func set(constantValue constant: CGFloat, toConstraintNamed name: String) {
let filteredConstraints = self.constraints.filter { $0.identifier == name }
if let yourConstraint = filteredConstraints.first {
yourConstraint.constant = constant
self.updateConstraints()
}
}
Suscribirse a:
Entradas (Atom)