├── README.md ├── SimpleSwiftFRP.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── SimpleSwiftFRP.xccheckout │ └── xcuserdata │ │ └── doofnugget.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── developer.xcuserdatad │ └── xcschemes │ │ ├── SimpleSwiftFRP.xcscheme │ │ └── xcschememanagement.plist │ └── doofnugget.xcuserdatad │ └── xcschemes │ ├── SimpleSwiftFRP.xcscheme │ └── xcschememanagement.plist ├── SimpleSwiftFRP ├── Behavior.swift ├── Denotational Semantics.pdf ├── Event.swift ├── Info.plist ├── Operators │ ├── Accumulate.swift │ ├── Direct.swift │ ├── Input.swift │ ├── Lift.swift │ ├── Merge.swift │ ├── Output.swift │ └── Snapshot.swift ├── Outlet.swift ├── SimpleSwiftFRP.h ├── Source.swift └── Utilities │ ├── Globals.swift │ ├── ObserverSet.swift │ ├── Protocols.swift │ ├── Send.swift │ └── Time.swift └── SimpleSwiftFRPTests ├── Info.plist └── SimpleSwiftFRPTests.swift /README.md: -------------------------------------------------------------------------------- 1 | # SimpleSwiftFRP 2 | A simple Functional Reactive Programming library for Swift 3 | 4 | New! With Denotational Semantics! 5 | 6 | SimpleSwiftFRP just underwent a major overhaul. 7 | 8 | For information about what it is or how it works, you can visit my website at http://letvargo.mooo.com 9 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 57130C9C1B1E87BC0047AF45 /* Globals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130C961B1E87BC0047AF45 /* Globals.swift */; }; 11 | 57130C9D1B1E87BC0047AF45 /* ObserverSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130C971B1E87BC0047AF45 /* ObserverSet.swift */; }; 12 | 57130C9E1B1E87BC0047AF45 /* Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130C981B1E87BC0047AF45 /* Protocols.swift */; }; 13 | 57130C9F1B1E87BC0047AF45 /* Send.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130C991B1E87BC0047AF45 /* Send.swift */; }; 14 | 57130CA01B1E87BC0047AF45 /* Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130C9A1B1E87BC0047AF45 /* Time.swift */; }; 15 | 57130CA71B1E87DA0047AF45 /* Accumulate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA11B1E87DA0047AF45 /* Accumulate.swift */; }; 16 | 57130CA81B1E87DA0047AF45 /* Input.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA21B1E87DA0047AF45 /* Input.swift */; }; 17 | 57130CA91B1E87DA0047AF45 /* Lift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA31B1E87DA0047AF45 /* Lift.swift */; }; 18 | 57130CAA1B1E87DA0047AF45 /* Merge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA41B1E87DA0047AF45 /* Merge.swift */; }; 19 | 57130CAB1B1E87DA0047AF45 /* Output.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA51B1E87DA0047AF45 /* Output.swift */; }; 20 | 57130CAC1B1E87DA0047AF45 /* Snapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CA61B1E87DA0047AF45 /* Snapshot.swift */; }; 21 | 57130CAE1B1E8C920047AF45 /* Direct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57130CAD1B1E8C920047AF45 /* Direct.swift */; }; 22 | 57E9469B1B145D8E00B536BA /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E9469A1B145D8E00B536BA /* Event.swift */; }; 23 | 8BB3E6D01AD6232A00E90CFF /* SimpleSwiftFRP.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BB3E6CF1AD6232A00E90CFF /* SimpleSwiftFRP.h */; settings = {ATTRIBUTES = (Public, ); }; }; 24 | 8BB3E6D61AD6232B00E90CFF /* SimpleSwiftFRP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BB3E6CA1AD6232A00E90CFF /* SimpleSwiftFRP.framework */; }; 25 | 8BB3E6DD1AD6232B00E90CFF /* SimpleSwiftFRPTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BB3E6DC1AD6232B00E90CFF /* SimpleSwiftFRPTests.swift */; }; 26 | 8BB3E6EF1AD6237300E90CFF /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BB3E6E61AD6237300E90CFF /* Behavior.swift */; }; 27 | 8BB3E6F31AD6237300E90CFF /* Outlet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BB3E6EA1AD6237300E90CFF /* Outlet.swift */; }; 28 | 8BB3E6F61AD6237300E90CFF /* Source.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BB3E6ED1AD6237300E90CFF /* Source.swift */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 8BB3E6D71AD6232B00E90CFF /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 8BB3E6C11AD6232A00E90CFF /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 8BB3E6C91AD6232A00E90CFF; 37 | remoteInfo = SimpleSwiftFRP; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 57130C961B1E87BC0047AF45 /* Globals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Globals.swift; path = Utilities/Globals.swift; sourceTree = ""; }; 43 | 57130C971B1E87BC0047AF45 /* ObserverSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ObserverSet.swift; path = Utilities/ObserverSet.swift; sourceTree = ""; }; 44 | 57130C981B1E87BC0047AF45 /* Protocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Protocols.swift; path = Utilities/Protocols.swift; sourceTree = ""; }; 45 | 57130C991B1E87BC0047AF45 /* Send.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Send.swift; path = Utilities/Send.swift; sourceTree = ""; }; 46 | 57130C9A1B1E87BC0047AF45 /* Time.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Time.swift; path = Utilities/Time.swift; sourceTree = ""; }; 47 | 57130CA11B1E87DA0047AF45 /* Accumulate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Accumulate.swift; path = Operators/Accumulate.swift; sourceTree = ""; }; 48 | 57130CA21B1E87DA0047AF45 /* Input.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Input.swift; path = Operators/Input.swift; sourceTree = ""; }; 49 | 57130CA31B1E87DA0047AF45 /* Lift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Lift.swift; path = Operators/Lift.swift; sourceTree = ""; }; 50 | 57130CA41B1E87DA0047AF45 /* Merge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Merge.swift; path = Operators/Merge.swift; sourceTree = ""; }; 51 | 57130CA51B1E87DA0047AF45 /* Output.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Output.swift; path = Operators/Output.swift; sourceTree = ""; }; 52 | 57130CA61B1E87DA0047AF45 /* Snapshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Snapshot.swift; path = Operators/Snapshot.swift; sourceTree = ""; }; 53 | 57130CAD1B1E8C920047AF45 /* Direct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Direct.swift; path = Operators/Direct.swift; sourceTree = ""; }; 54 | 57E9469A1B145D8E00B536BA /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = ""; }; 55 | 8BB3E6CA1AD6232A00E90CFF /* SimpleSwiftFRP.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SimpleSwiftFRP.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 8BB3E6CE1AD6232A00E90CFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 8BB3E6CF1AD6232A00E90CFF /* SimpleSwiftFRP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleSwiftFRP.h; sourceTree = ""; }; 58 | 8BB3E6D51AD6232B00E90CFF /* SimpleSwiftFRPTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleSwiftFRPTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 8BB3E6DB1AD6232B00E90CFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 8BB3E6DC1AD6232B00E90CFF /* SimpleSwiftFRPTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleSwiftFRPTests.swift; sourceTree = ""; }; 61 | 8BB3E6E61AD6237300E90CFF /* Behavior.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Behavior.swift; sourceTree = ""; }; 62 | 8BB3E6EA1AD6237300E90CFF /* Outlet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Outlet.swift; sourceTree = ""; }; 63 | 8BB3E6ED1AD6237300E90CFF /* Source.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Source.swift; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 8BB3E6C61AD6232A00E90CFF /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 8BB3E6D21AD6232B00E90CFF /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 8BB3E6D61AD6232B00E90CFF /* SimpleSwiftFRP.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | 57B6CDB61B1A3BC200639217 /* Utilities */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 57130C961B1E87BC0047AF45 /* Globals.swift */, 89 | 57130C971B1E87BC0047AF45 /* ObserverSet.swift */, 90 | 57130C981B1E87BC0047AF45 /* Protocols.swift */, 91 | 57130C991B1E87BC0047AF45 /* Send.swift */, 92 | 57130C9A1B1E87BC0047AF45 /* Time.swift */, 93 | ); 94 | name = Utilities; 95 | sourceTree = ""; 96 | }; 97 | 57B6CDB71B1A3BE000639217 /* Operators */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 57130CA11B1E87DA0047AF45 /* Accumulate.swift */, 101 | 57130CAD1B1E8C920047AF45 /* Direct.swift */, 102 | 57130CA21B1E87DA0047AF45 /* Input.swift */, 103 | 57130CA31B1E87DA0047AF45 /* Lift.swift */, 104 | 57130CA41B1E87DA0047AF45 /* Merge.swift */, 105 | 57130CA51B1E87DA0047AF45 /* Output.swift */, 106 | 57130CA61B1E87DA0047AF45 /* Snapshot.swift */, 107 | ); 108 | name = Operators; 109 | sourceTree = ""; 110 | }; 111 | 8BB3E6C01AD6232A00E90CFF = { 112 | isa = PBXGroup; 113 | children = ( 114 | 8BB3E6CC1AD6232A00E90CFF /* SimpleSwiftFRP */, 115 | 8BB3E6D91AD6232B00E90CFF /* SimpleSwiftFRPTests */, 116 | 8BB3E6CB1AD6232A00E90CFF /* Products */, 117 | ); 118 | sourceTree = ""; 119 | }; 120 | 8BB3E6CB1AD6232A00E90CFF /* Products */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 8BB3E6CA1AD6232A00E90CFF /* SimpleSwiftFRP.framework */, 124 | 8BB3E6D51AD6232B00E90CFF /* SimpleSwiftFRPTests.xctest */, 125 | ); 126 | name = Products; 127 | sourceTree = ""; 128 | }; 129 | 8BB3E6CC1AD6232A00E90CFF /* SimpleSwiftFRP */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 8BB3E6ED1AD6237300E90CFF /* Source.swift */, 133 | 8BB3E6E61AD6237300E90CFF /* Behavior.swift */, 134 | 8BB3E6EA1AD6237300E90CFF /* Outlet.swift */, 135 | 57E9469A1B145D8E00B536BA /* Event.swift */, 136 | 57B6CDB61B1A3BC200639217 /* Utilities */, 137 | 57B6CDB71B1A3BE000639217 /* Operators */, 138 | 8BB3E6CF1AD6232A00E90CFF /* SimpleSwiftFRP.h */, 139 | 8BB3E6CD1AD6232A00E90CFF /* Supporting Files */, 140 | ); 141 | path = SimpleSwiftFRP; 142 | sourceTree = ""; 143 | }; 144 | 8BB3E6CD1AD6232A00E90CFF /* Supporting Files */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 8BB3E6CE1AD6232A00E90CFF /* Info.plist */, 148 | ); 149 | name = "Supporting Files"; 150 | sourceTree = ""; 151 | }; 152 | 8BB3E6D91AD6232B00E90CFF /* SimpleSwiftFRPTests */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 8BB3E6DC1AD6232B00E90CFF /* SimpleSwiftFRPTests.swift */, 156 | 8BB3E6DA1AD6232B00E90CFF /* Supporting Files */, 157 | ); 158 | path = SimpleSwiftFRPTests; 159 | sourceTree = ""; 160 | }; 161 | 8BB3E6DA1AD6232B00E90CFF /* Supporting Files */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 8BB3E6DB1AD6232B00E90CFF /* Info.plist */, 165 | ); 166 | name = "Supporting Files"; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXGroup section */ 170 | 171 | /* Begin PBXHeadersBuildPhase section */ 172 | 8BB3E6C71AD6232A00E90CFF /* Headers */ = { 173 | isa = PBXHeadersBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | 8BB3E6D01AD6232A00E90CFF /* SimpleSwiftFRP.h in Headers */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXHeadersBuildPhase section */ 181 | 182 | /* Begin PBXNativeTarget section */ 183 | 8BB3E6C91AD6232A00E90CFF /* SimpleSwiftFRP */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 8BB3E6E01AD6232B00E90CFF /* Build configuration list for PBXNativeTarget "SimpleSwiftFRP" */; 186 | buildPhases = ( 187 | 8BB3E6C51AD6232A00E90CFF /* Sources */, 188 | 8BB3E6C61AD6232A00E90CFF /* Frameworks */, 189 | 8BB3E6C71AD6232A00E90CFF /* Headers */, 190 | 8BB3E6C81AD6232A00E90CFF /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = SimpleSwiftFRP; 197 | productName = SimpleSwiftFRP; 198 | productReference = 8BB3E6CA1AD6232A00E90CFF /* SimpleSwiftFRP.framework */; 199 | productType = "com.apple.product-type.framework"; 200 | }; 201 | 8BB3E6D41AD6232B00E90CFF /* SimpleSwiftFRPTests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = 8BB3E6E31AD6232B00E90CFF /* Build configuration list for PBXNativeTarget "SimpleSwiftFRPTests" */; 204 | buildPhases = ( 205 | 8BB3E6D11AD6232B00E90CFF /* Sources */, 206 | 8BB3E6D21AD6232B00E90CFF /* Frameworks */, 207 | 8BB3E6D31AD6232B00E90CFF /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | 8BB3E6D81AD6232B00E90CFF /* PBXTargetDependency */, 213 | ); 214 | name = SimpleSwiftFRPTests; 215 | productName = SimpleSwiftFRPTests; 216 | productReference = 8BB3E6D51AD6232B00E90CFF /* SimpleSwiftFRPTests.xctest */; 217 | productType = "com.apple.product-type.bundle.unit-test"; 218 | }; 219 | /* End PBXNativeTarget section */ 220 | 221 | /* Begin PBXProject section */ 222 | 8BB3E6C11AD6232A00E90CFF /* Project object */ = { 223 | isa = PBXProject; 224 | attributes = { 225 | LastSwiftUpdateCheck = 0700; 226 | LastUpgradeCheck = 0700; 227 | ORGANIZATIONNAME = letvargo; 228 | TargetAttributes = { 229 | 8BB3E6C91AD6232A00E90CFF = { 230 | CreatedOnToolsVersion = 6.3; 231 | }; 232 | 8BB3E6D41AD6232B00E90CFF = { 233 | CreatedOnToolsVersion = 6.3; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 8BB3E6C41AD6232A00E90CFF /* Build configuration list for PBXProject "SimpleSwiftFRP" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = English; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | ); 244 | mainGroup = 8BB3E6C01AD6232A00E90CFF; 245 | productRefGroup = 8BB3E6CB1AD6232A00E90CFF /* Products */; 246 | projectDirPath = ""; 247 | projectRoot = ""; 248 | targets = ( 249 | 8BB3E6C91AD6232A00E90CFF /* SimpleSwiftFRP */, 250 | 8BB3E6D41AD6232B00E90CFF /* SimpleSwiftFRPTests */, 251 | ); 252 | }; 253 | /* End PBXProject section */ 254 | 255 | /* Begin PBXResourcesBuildPhase section */ 256 | 8BB3E6C81AD6232A00E90CFF /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | 8BB3E6D31AD6232B00E90CFF /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | /* End PBXResourcesBuildPhase section */ 271 | 272 | /* Begin PBXSourcesBuildPhase section */ 273 | 8BB3E6C51AD6232A00E90CFF /* Sources */ = { 274 | isa = PBXSourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 57130CA01B1E87BC0047AF45 /* Time.swift in Sources */, 278 | 57130CA81B1E87DA0047AF45 /* Input.swift in Sources */, 279 | 57130CA71B1E87DA0047AF45 /* Accumulate.swift in Sources */, 280 | 8BB3E6F61AD6237300E90CFF /* Source.swift in Sources */, 281 | 57130C9F1B1E87BC0047AF45 /* Send.swift in Sources */, 282 | 57130C9C1B1E87BC0047AF45 /* Globals.swift in Sources */, 283 | 57130CA91B1E87DA0047AF45 /* Lift.swift in Sources */, 284 | 57E9469B1B145D8E00B536BA /* Event.swift in Sources */, 285 | 57130CAC1B1E87DA0047AF45 /* Snapshot.swift in Sources */, 286 | 57130C9D1B1E87BC0047AF45 /* ObserverSet.swift in Sources */, 287 | 57130CAB1B1E87DA0047AF45 /* Output.swift in Sources */, 288 | 57130CAE1B1E8C920047AF45 /* Direct.swift in Sources */, 289 | 57130CAA1B1E87DA0047AF45 /* Merge.swift in Sources */, 290 | 57130C9E1B1E87BC0047AF45 /* Protocols.swift in Sources */, 291 | 8BB3E6F31AD6237300E90CFF /* Outlet.swift in Sources */, 292 | 8BB3E6EF1AD6237300E90CFF /* Behavior.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | 8BB3E6D11AD6232B00E90CFF /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 8BB3E6DD1AD6232B00E90CFF /* SimpleSwiftFRPTests.swift in Sources */, 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | /* End PBXSourcesBuildPhase section */ 305 | 306 | /* Begin PBXTargetDependency section */ 307 | 8BB3E6D81AD6232B00E90CFF /* PBXTargetDependency */ = { 308 | isa = PBXTargetDependency; 309 | target = 8BB3E6C91AD6232A00E90CFF /* SimpleSwiftFRP */; 310 | targetProxy = 8BB3E6D71AD6232B00E90CFF /* PBXContainerItemProxy */; 311 | }; 312 | /* End PBXTargetDependency section */ 313 | 314 | /* Begin XCBuildConfiguration section */ 315 | 8BB3E6DE1AD6232B00E90CFF /* Debug */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 320 | CLANG_CXX_LIBRARY = "libc++"; 321 | CLANG_ENABLE_MODULES = YES; 322 | CLANG_ENABLE_OBJC_ARC = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | COPY_PHASE_STRIP = NO; 333 | CURRENT_PROJECT_VERSION = 1; 334 | DEBUG_INFORMATION_FORMAT = dwarf; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | ENABLE_TESTABILITY = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_OPTIMIZATION_LEVEL = 0; 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | MACOSX_DEPLOYMENT_TARGET = 10.10; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = macosx; 356 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 357 | VERSIONING_SYSTEM = "apple-generic"; 358 | VERSION_INFO_PREFIX = ""; 359 | }; 360 | name = Debug; 361 | }; 362 | 8BB3E6DF1AD6232B00E90CFF /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 373 | CLANG_WARN_EMPTY_BODY = YES; 374 | CLANG_WARN_ENUM_CONVERSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 377 | CLANG_WARN_UNREACHABLE_CODE = YES; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | COPY_PHASE_STRIP = NO; 380 | CURRENT_PROJECT_VERSION = 1; 381 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 382 | ENABLE_NS_ASSERTIONS = NO; 383 | ENABLE_STRICT_OBJC_MSGSEND = YES; 384 | GCC_C_LANGUAGE_STANDARD = gnu99; 385 | GCC_NO_COMMON_BLOCKS = YES; 386 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 387 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 388 | GCC_WARN_UNDECLARED_SELECTOR = YES; 389 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 390 | GCC_WARN_UNUSED_FUNCTION = YES; 391 | GCC_WARN_UNUSED_VARIABLE = YES; 392 | MACOSX_DEPLOYMENT_TARGET = 10.10; 393 | MTL_ENABLE_DEBUG_INFO = NO; 394 | SDKROOT = macosx; 395 | VERSIONING_SYSTEM = "apple-generic"; 396 | VERSION_INFO_PREFIX = ""; 397 | }; 398 | name = Release; 399 | }; 400 | 8BB3E6E11AD6232B00E90CFF /* Debug */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | COMBINE_HIDPI_IMAGES = YES; 404 | DEFINES_MODULE = YES; 405 | DYLIB_COMPATIBILITY_VERSION = 1; 406 | DYLIB_CURRENT_VERSION = 1; 407 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 408 | FRAMEWORK_VERSION = A; 409 | INFOPLIST_FILE = SimpleSwiftFRP/Info.plist; 410 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 412 | PRODUCT_BUNDLE_IDENTIFIER = "com.letvargo.$(PRODUCT_NAME:rfc1034identifier)"; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | SKIP_INSTALL = YES; 415 | }; 416 | name = Debug; 417 | }; 418 | 8BB3E6E21AD6232B00E90CFF /* Release */ = { 419 | isa = XCBuildConfiguration; 420 | buildSettings = { 421 | COMBINE_HIDPI_IMAGES = YES; 422 | DEFINES_MODULE = YES; 423 | DYLIB_COMPATIBILITY_VERSION = 1; 424 | DYLIB_CURRENT_VERSION = 1; 425 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 426 | FRAMEWORK_VERSION = A; 427 | INFOPLIST_FILE = SimpleSwiftFRP/Info.plist; 428 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = "com.letvargo.$(PRODUCT_NAME:rfc1034identifier)"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | SKIP_INSTALL = YES; 433 | }; 434 | name = Release; 435 | }; 436 | 8BB3E6E41AD6232B00E90CFF /* Debug */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | COMBINE_HIDPI_IMAGES = YES; 440 | FRAMEWORK_SEARCH_PATHS = ( 441 | "$(DEVELOPER_FRAMEWORKS_DIR)", 442 | "$(inherited)", 443 | ); 444 | GCC_PREPROCESSOR_DEFINITIONS = ( 445 | "DEBUG=1", 446 | "$(inherited)", 447 | ); 448 | INFOPLIST_FILE = SimpleSwiftFRPTests/Info.plist; 449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 450 | PRODUCT_BUNDLE_IDENTIFIER = "com.letvargo.$(PRODUCT_NAME:rfc1034identifier)"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | }; 453 | name = Debug; 454 | }; 455 | 8BB3E6E51AD6232B00E90CFF /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | COMBINE_HIDPI_IMAGES = YES; 459 | FRAMEWORK_SEARCH_PATHS = ( 460 | "$(DEVELOPER_FRAMEWORKS_DIR)", 461 | "$(inherited)", 462 | ); 463 | INFOPLIST_FILE = SimpleSwiftFRPTests/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 465 | PRODUCT_BUNDLE_IDENTIFIER = "com.letvargo.$(PRODUCT_NAME:rfc1034identifier)"; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | }; 468 | name = Release; 469 | }; 470 | /* End XCBuildConfiguration section */ 471 | 472 | /* Begin XCConfigurationList section */ 473 | 8BB3E6C41AD6232A00E90CFF /* Build configuration list for PBXProject "SimpleSwiftFRP" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 8BB3E6DE1AD6232B00E90CFF /* Debug */, 477 | 8BB3E6DF1AD6232B00E90CFF /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 8BB3E6E01AD6232B00E90CFF /* Build configuration list for PBXNativeTarget "SimpleSwiftFRP" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 8BB3E6E11AD6232B00E90CFF /* Debug */, 486 | 8BB3E6E21AD6232B00E90CFF /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | defaultConfigurationName = Release; 490 | }; 491 | 8BB3E6E31AD6232B00E90CFF /* Build configuration list for PBXNativeTarget "SimpleSwiftFRPTests" */ = { 492 | isa = XCConfigurationList; 493 | buildConfigurations = ( 494 | 8BB3E6E41AD6232B00E90CFF /* Debug */, 495 | 8BB3E6E51AD6232B00E90CFF /* Release */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | /* End XCConfigurationList section */ 501 | }; 502 | rootObject = 8BB3E6C11AD6232A00E90CFF /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/project.xcworkspace/xcshareddata/SimpleSwiftFRP.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 071F5143-FF91-48EF-A391-8D8C56FAC26F 9 | IDESourceControlProjectName 10 | SimpleSwiftFRP 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 9B8497963FE36D7ABE5E9465BF77D52C301C0CC8 14 | https://github.com/letvargo/SimpleSwiftFRP.git 15 | 16 | IDESourceControlProjectPath 17 | SimpleSwiftFRP.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 9B8497963FE36D7ABE5E9465BF77D52C301C0CC8 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/letvargo/SimpleSwiftFRP.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 9B8497963FE36D7ABE5E9465BF77D52C301C0CC8 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 9B8497963FE36D7ABE5E9465BF77D52C301C0CC8 36 | IDESourceControlWCCName 37 | SimpleSwiftFRP 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/project.xcworkspace/xcuserdata/doofnugget.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letvargo/SimpleSwiftFRP/ff4a5e05d2de2189270af8e20873fb35afa1cf67/SimpleSwiftFRP.xcodeproj/project.xcworkspace/xcuserdata/doofnugget.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/SimpleSwiftFRP.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 89 | 90 | 91 | 92 | 98 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/xcuserdata/developer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SimpleSwiftFRP.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8BB3E6C91AD6232A00E90CFF 16 | 17 | primary 18 | 19 | 20 | 8BB3E6D41AD6232B00E90CFF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/xcuserdata/doofnugget.xcuserdatad/xcschemes/SimpleSwiftFRP.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /SimpleSwiftFRP.xcodeproj/xcuserdata/doofnugget.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SimpleSwiftFRP.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8BB3E6C91AD6232A00E90CFF 16 | 17 | primary 18 | 19 | 20 | 8BB3E6D41AD6232B00E90CFF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SimpleSwiftFRP/Behavior.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Behavior.swift 3 | // SimpleSwiftFRP 4 | // 5 | // Created by letvargo on 2/20/15. 6 | // Copyright (c) 2015 letvargo. All rights reserved. 7 | // 8 | 9 | prefix operator ^ { } 10 | 11 | /** A prefix operator for initializing instances of `Behavior` to a discrete value 12 | 13 | ### Usage 14 | 15 | This function is an alternative to `Behavior`'s publicly available `init(_ value: T)` method. Instead of writing, 16 | 17 | ```swift 18 | let myBehavior = Behavior(0) 19 | ``` 20 | 21 | ... you can use this operator to initialize a `Behavior` like this: 22 | ```swift 23 | let myBehavior = ^0 24 | ``` 25 | 26 | The two techniques produce the same result, so which you choose is mostly a matter of personal preference. However, this method cannot be used to initialize a `Behavior` if its value will be a function of continuous time. 27 | 28 | If the compiler has difficulty inferring the `Behavior`'s type, or if the `Behavior` will be used to represent a value as a function of continuous time, use one of the publicly available `init` methods instead. 29 | 30 | - Parameter value: The `Behavior`'s initial value 31 | 32 | - Returns: `Behavior` 33 | */ 34 | 35 | public prefix func ^(value: T) -> Behavior { 36 | return Behavior(value) 37 | } 38 | 39 | /** A representation of a value as a function of time 40 | 41 | #### Overview: 42 | 43 | A `Behavior` represents a value as a function of time. `Behavior`s are guaranteed to have a value for all moments in time, and past values are fixed and immutable. 44 | 45 | 46 | #### Initialization: 47 | 48 | - `init(_ value: T)` 49 | 50 | This method creates a `Behavior` that represents a value that is a function of discrete `Time`. 51 | 52 | - `init(_ f: Time -> T)` 53 | 54 | This method creates a `Behavior` that represents a value as a function of continuous `Time`. 55 | 56 | - `prefix func ^ (value: T) -> Behavior` 57 | 58 | This is a helper method that uses `^` as a prefix operator to lift a single value into a `Behavior`. For example, the following creates a `Behavior` with an inital value of `(0, 0)`: 59 | 60 | ```swift 61 | let bPoint = ^CGPointMake(0, 0) 62 | ``` 63 | 64 | #### Properties: 65 | 66 | - `value` 67 | 68 | A computed property that returns the value of the `Behavior` at the current moment in time. 69 | 70 | #### Methods: 71 | 72 | - `at(time: Time) -> T` 73 | 74 | A method that returns the value of the `Behavior` at the supplied `Time`. 75 | 76 | */ 77 | 78 | final public class Behavior: Listener, Whisperer { 79 | 80 | /// A private helper function for synchronizing access to variable properties 81 | 82 | private func synchronized(f: () -> ()) { 83 | dispatch_sync(Up.notificationQueue, f) 84 | } 85 | 86 | /// The `Behavior`'s value at the current moment in time 87 | 88 | public var value: T { 89 | return at(time: now()) 90 | } 91 | 92 | /// A set of objects that will be notified whenever the `Behavior` is notified of a new `Event` 93 | 94 | private var listeners = ObserverSet