Small swift events kit

Overview

Build Status codebeat badge codecov

CoreEvents

Small Swift events kit that provides some base types of events:

FutureEvent

Simple event. Provides classic behaviour.

Description

This is classic event (like C# event) that can contain many listeners and multicast each new message for this listeners. This event emits only new messages. It means if you add a new listener to existed event then last will not emit previous messages to the new listener.

Types

  • FutureEvent: Event

Example

var event = FutureEvent<Int>()

event += { value in
  print("Awesome int: \(value)")
}

event.invoke(with: 42)

will print Awesome int: 42

PresentEvent

Description

This event provides all Future logic, but additionally provides emiting last emited value for a new listener. It means if your event already emits value and you add a new listener then your listener handles previous emited value in the same time.

Types

  • PresentEvent: Event

Example

var event = PresentEvent<Int>()

event += { value in
  print("Awesome int: \(value)")
}

event.invoke(with: 42)

event += {
    print("Old awesome int: \(value)")
}

will print:

Awesome int: 42

Old awesome int: 42

PastEvent

Description

This event is like the Present, but emits all previous messages for a new listener

Types

  • PastEvent: Event

Example

var event = PastEvent<Int>()

event.invoke(with: 0)
event.invoke(with: 1)

event += { value in
  print("Awesome int: \(value)")
}

event.invoke(with: 2)

Will print:

Awesome int: 0

Awesome int: 1

Awesome int: 2

How to install

pod 'CoreEvents', '~> 2.0.1'

We also support SPM:

.package(url: "https://github.com/surfstudio/CoreEvents", .exact("2.0.2"))

Warning

In one file you can not use just add, you should specify a key - add(key: String, _ listener: Closure)

Versioning

Version format is x.y.z where

  • x is major version number. Bumped only in major updates (implementaion changes, adding new functionality)
  • y is minor version number. Bumped only in minor updates (interface changes)
  • z is minor version number. Bumped in case of bug fixes and e.t.c.

Author

Kravchenkov Alexander

MIT License

You might also like...
PublisherKit - An open source implementation of Apple's Combine framework for processing asynchronous events over time

Publisher Kit Overview PublisherKit provides a declarative Swift API for processing asynchronous events over time. It is an open source version of App

A basic countdown app that allows the user to create, edit, and delete events. Each event contains a live countdown timer to a specified date and time.

Event Countdown App (iOS) Created by Lucas Ausberger About This Project Created: January 4, 2021 Last Updated: January 8, 2021 Current Verison: 1.1.1

TouristApplication - The idea of the app is to help the user find activities / events / places such as attractions, restaurants etc. in the Helsinki area SampledPublisher - The SampledPublisher samples the output of a publisher based on events from another publisher
SampledPublisher - The SampledPublisher samples the output of a publisher based on events from another publisher

SampledPublisher The SampledPublisher samples the output of a publisher based on

A free open source iOS app for events or conferences
A free open source iOS app for events or conferences

EventBlank iOS App I go to a lot of conferences and events and noticed that few of them have a proper iPhone app. And I can understand that - there ar

Kotlin Multiplatfom app for Droidcon Events
Kotlin Multiplatfom app for Droidcon Events

Sessionize/Droidcon Mobile Clients General Info This project has a pair of native mobile applications backed by the Sessionize data api for use in eve

Send key events to any running macOS application.

KeySender An extremely simple micro package that enables you to send key events to any running application. Install Add the following to your Package.

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events
Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events. It will gather events from your default iOS calendar.

Recording Indicator Utility lets you turn off the orange microphone recording indicator light for live events and screencasts.
Recording Indicator Utility lets you turn off the orange microphone recording indicator light for live events and screencasts.

Recording Indicator Utility Recording Indicator Utility lets you turn off the orange microphone recording indicator light, making it ideal for profess

Publish–subscribe design pattern implementation framework, with an ability to publish events by topic.
Publish–subscribe design pattern implementation framework, with an ability to publish events by topic.

TopicEventBus Publish–subscribe design pattern implementation framework, with ability to publish events by topic. (NotificationCenter extended alterna

iOS Logs, Events, And Plist Parser

iLEAPP iOS Logs, Events, And Plists Parser Details in blog post here: https://abrignoni.blogspot.com/2019/12/ileapp-ios-logs-events-and-properties.htm

Analytics layer abstraction, abstract analytics reporters and collect domain-driven analytic events.

🐙 Tentacles Current State: Work in Progress Documentation & Tests(100% completed, but needs refactoring and structuring) started but not done yet, im

Elegant SVG animation kit for swift
Elegant SVG animation kit for swift

Elephant This is SVG animation presentation kit for iOS. Example You can run example app. Please open Example-iOS/Elephant-iOS.xcworkspace! Usage You

A Swift Formatter Kit
A Swift Formatter Kit

Format A Swift formatter kit. Simple formatting syntax for decimal numbers, currency, mass, addresses, ordinal numbers and hexadecimal colors. Usage I

Applozic UI Kit in Swift
Applozic UI Kit in Swift

Official iOS Swift SDK for Chat 💬 Introduction 🌀 Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversat

A Lightweight But Powerful Color Kit (Swift)
A Lightweight But Powerful Color Kit (Swift)

BCColor A lightweight but powerful color kit (Swift) Features Pick Colors From Image Generate Monochrome Image Support Hex Color Style Lighten / Darke

A Swift Reactive Programming Kit
A Swift Reactive Programming Kit

ReactiveKit is a lightweight Swift framework for reactive and functional reactive programming that enables you to get into the reactive world today. T

Swift UI Kit to present clean modal/alert
Swift UI Kit to present clean modal/alert

CleanyModal is a good way to use UI-Customised alerts with ease Features Present some kind of clean alerts (With same API as UIAlertViewController) Ad

Swift Starter Kit with Firebase & Facebook Login Onboarding
Swift Starter Kit with Firebase & Facebook Login Onboarding

iOS Swift Starter Kit 🚀 🚀 🔥 🔥 Boilerplate Onboarding App in Swift with Firebase Integration, Facebook Login and Push Notifications. Save days of a

Comments
  • The ability to remove a particular listener

    The ability to remove a particular listener

    For example, we have singleton which has an event. As we move through the screens, we add listeners to this event. But when we leave the screen we need to remove this particular listener.

    enhancement 
    opened by JohnReeze 1
  • Add basic Swift Packet Manager support

    Add basic Swift Packet Manager support

    Что сделано?

    • Добавлена базовая поддержка Swift Packet Manager

    На что обратить внимание?

    • Тестировалось только на Xcode 12

    Как протестировать?

    git clone <...>
    pushd CoreEvents
    swift build
    popd
    
    opened by somenkovnikita 0
  • macOS support

    macOS support

    Changes:

    • Added macOS target to the project
    • Added macOS deployment target to the podspec file

    Notes:

    • Changed PRODUCT_NAME from "$(TARGET_NAME:c99extidentifier)" to CoreEvents (if we'll not rename project in future - everything will be ok)
    enhancement 
    opened by ismetanin 0
  • Comments, naming and tests fixes

    Comments, naming and tests fixes

    Changes:

    • Fixed comments and naming
    • Added a new test for PresentEvent
    • Edited README

    Notes:

    • I think we could add solution for notifications with events as an advanced example of usage in the readme
    opened by ismetanin 0
Releases(2.0.1)
  • 2.0.1(Oct 12, 2019)

  • 2.0.0(Aug 4, 2019)

    Что сделано:

    • Удалены лишний классы и события. В том числе:
      • *EmptyEvent
      • *ValueEvent
    • Изменена сигнатура методов (для красоты). Потребуется миграция.
    • Теперь слушатели добавляются по ключам.
    • Ключ по-умолчанию - название файла
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Feb 5, 2019)

Owner
Surf
Surf
React-inspired framework for building component-based user interfaces in Swift.

TemplateKit React-inspired framework for building component-based user interfaces in Swift. Features ?? Completely native - write your app in Swift ??

Matias Cudich 160 Nov 3, 2022
Swift implementation of AWS Lambda Events

Swift AWS Lambda Events Overview Swift AWS Lambda Runtime was designed to make building Lambda functions in Swift simple and safe. The library is an i

Swift on Server 29 Dec 19, 2022
KVO for Swift - Value Observing and Events

Value Observing and Events for Swift Swift lacks the powerful Key Value Observing (KVO) from Objective-C. But thanks to closures, generics and propert

Leszek Ślażyński 1.2k Dec 9, 2022
A micro-library for creating and observing events.

Signals Signals is a library for creating and observing events. It replaces delegates, actions and NSNotificationCenter with something much more power

Tuomas Artman 454 Dec 21, 2022
ResponderChain is a library that passes events using the responder chain.

ResponderChain ResponderChain is a library that passes events using the responder chain.

GodL 21 Aug 11, 2021
Suppress mouse & keyboard events on MacOSX. Baby-proof my Mac!

Suppress mouse & keyboard events on MacOSX Catches all events (mouse, keyboard, everything), and either consumes them (locked state) or passes them th

Albert Zeyer 6 Oct 21, 2022
Hammer is a touch, stylus and keyboard synthesis library for emulating user interaction events

Hammer is a touch, stylus and keyboard synthesis library for emulating user interaction events. It enables better ways of triggering UI actions in unit tests, replicating a real world environment as much as possible.

Lyft 626 Dec 23, 2022
Publish–subscribe design pattern implementation framework, with an ability to publish events by topic.

TopicEventBus Publish–subscribe design pattern implementation framework, with ability to publish events by topic. (NotificationCenter extended alterna

Matan Abravanel 55 Nov 29, 2021
Shows your photo library grouped by events, to easily export them to your computer

Groupir Shows your photo library grouped by events, to easily export them to your computer Features Currently supported features: reading your photo l

Stanislas Chevallier 0 Dec 15, 2021
A set of views and controllers for displaying and scheduling events on iOS

CalendarLib CalendarLib is a set of views and controllers for displaying and scheduling events on iOS. Warning: As some people may have noticed, this

Julien Martin 692 Nov 17, 2022