Skip to content

Conversation

@marchy
Copy link

@marchy marchy commented Dec 3, 2015

Renamed module to "Observables" to get around unsurmountable issues with making the module work when there is a name clash with any class within the module when importing it as a framework (ie: Cocoapods). For example, if you have an Event class in your own project (ie: your domain models everyday events) Swift gets tripped up on being able to specify that an event is an Observable.Event as opposed to your own Event.

The reason for this is that both the framework module is called Observable as well contains a class called Observable. It's apparently an anti-practice in Swift to have the module use the same name as any of its existing classes. Event type aliasing gets tripped up by this (ie: "typealias ObservableEvent = Observables.Event" --> compiler can't distinguish between Observable the class and Observable the module, despite the "import Observable" declaration)

Thus, the solution was to rename the framework to "Observables" (or something similar). Unfortunately this is the only reliable way out of this (without renaming the Observable class itself). Alternatives would have been to rename the Observable class (not worth it) or giving up framework integration and copying files directly (not using Cocoapods).

…t 2 module/framework (NOTE: structs must have a public initializer defined to be accessed outside of their defining module)
@marchy
Copy link
Author

marchy commented Dec 10, 2015

Have you had a chance to look over and consider this? It would be good to fix this part of the framework so that it eliminates the problem going forward.

Currently I have the fork project going separately (https://github.com/marchy/Observables-Swift) but would be good not to have to maintain both.

Vaseltior and others added 9 commits September 16, 2016 15:35
# Conflicts:
#	Observables-Swift.podspec.json
#	Observables-Swift.xcodeproj/project.pbxproj
# Conflicts:
#	Observable-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata
#	Observable-Swift/Observable.h
#	Observables-Swift.xcodeproj/project.pbxproj
# Conflicts:
#	Observable-Swift/Event.swift
#	Observable-Swift/EventSubscription.swift
#	Observable-Swift/Observable.swift
#	Observable-Swift/ObservableChainingProxy.swift
#	Observable-Swift/ObservableReference.swift
#	Observable-Swift/Protocols.swift
#	Observables-Swift.podspec.json
#	Observables-Swift.xcodeproj/project.pbxproj
#	Observables-Swift.xcodeproj/xcshareddata/xcschemes/Observables-iOS.xcscheme
#	Observables-Swift.xcodeproj/xcshareddata/xcschemes/Observables.xcscheme
#	Observables-Swift/EventReference.swift
#	Observables-Swift/ObservableProxy.swift
#	Observables-Swift/OwningEventReference.swift
#	Observables-Swift/TupleObservable.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants