You were right! I was using Swift 3.2 and not Swift 4.0. Thank you!
Filiz On Wed, Jan 10, 2018 at 10:25 AM, Jordan Rose via swift-users < swift-users@swift.org> wrote: > Nothing specific. A lot of minor issues were corrected in the Xcode 9 > release with a nod towards maintaining source compatibility, and most of > them weren't release-noted. > > Jordan > > > On Jan 10, 2018, at 10:21, Filiz Kurban <filiz.kur...@gmail.com> wrote: > > Thanks for your response. I will check that now! In the meantime, is there > a release note that states this? I have a stackover flow question on this > and would love to resolve it. > > On Wed, Jan 10, 2018 at 10:13 AM, Jordan Rose via swift-users < > swift-users@swift.org> wrote: > >> Hi, Filiz. Are you sure you're using Swift 4 and not the Swift 3 >> compatibility mode? 'defaultCalendarForNewEvents' was marked non-optional >> in Swift 3 by accident and that was fixed in Swift 4. >> >> Jordan >> >> >> On Jan 10, 2018, at 08:59, Filiz Kurban via swift-users < >> swift-users@swift.org> wrote: >> >> Hello, >> >> I'm adding a new functionality in my app, which is the ability to add an >> event in the default calendar set up on the phone. In the implementation, I >> get the permission and am ready to add the event. I check to see if there >> is an actual default calendar through the use of optional binding, but I >> get the error: >> >> Initializer for conditional binding must have Optional type, not >> 'EKCalendar' >> >> Now, defaultCalendarForNewEvents is an Optional (see declaration below) >> and it should be perfectly fine to use optional binding to check if it's >> nil or not. What am I missing? >> >> defaultCalendarForNewEvents definition in EKEventStore.h: >> >> open var defaultCalendarForNewEvents: EKCalendar? { get } >> >> >> I'm using Swift 4 on iOS11.2 >> >> if let defaultCalendar = eventStore.defaultCalendarForNewEvents { <-- error >> line >> newEvent.title = "Some Event Name" >> newEvent.startDate = Date() >> newEvent.endDate = Date()} >> >> >> Thank you for your help in advance. >> >> >> _______________________________________________ >> swift-users mailing list >> swift-users@swift.org >> https://lists.swift.org/mailman/listinfo/swift-users >> >> >> >> _______________________________________________ >> swift-users mailing list >> swift-users@swift.org >> https://lists.swift.org/mailman/listinfo/swift-users >> >> > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users