我创建了一个自定义URL协议处理程序.
http://
mailto://
custom://
我已经注册了一个WinForms应用程序来做出相应的响应.一切都很好.
但我希望能够优雅地处理用户尚未安装自定义URL协议处理程序的情况.
为了能够做到这一点,我需要能够检测浏览器的注册协议处理程序,我想从JavaScript.但我一直无法找到一种方法来查询信息.我希望找到解决这个问题的方法.
感谢您提供的任何想法.
我想知道是否有可能实现这样的目标.
我有一个像这样的游乐场:
protocol Foo {
func testPrint()
}
extension Foo {
func testPrint() {
print("Protocol extension call")
}
}
struct Bar: Foo {
func testPrint() {
// Calling self or super go call default implementation
self.testPrint()
print("Call from struct")
}
}
let sth = Bar()
sth.testPrint()
Run Code Online (Sandbox Code Playgroud)
我可以提供一个默认实现,extension
但如果Bar
需要默认实现中的所有内容以及其他内容,该怎么办?
它在某种程度上类似于调用es中的super.
方法class
来满足实现每个属性等的要求,但我认为没有可能实现相同的structs
.
DTR/DSR和RTS/CTS硬件流控制有什么区别?什么时候使用?为什么我们需要不止一种硬件流控制?:)
我正在编写一个p2p实现,我想分散,但是我在掌握像bittorrent这样的协议中的DHT方面遇到了一些麻烦.如果没有跟踪器,客户如何知道同行在哪里?对等体是否存储在实际的torrent文件中?
我有一个协议P,它返回一个对象的副本:
protocol P {
func copy() -> Self
}
Run Code Online (Sandbox Code Playgroud)
以及实现P的C类:
class C : P {
func copy() -> Self {
return C()
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我是否输入返回值,因为Self
我得到以下错误:
无法将类型为"C"的返回表达式转换为返回类型"Self"
我也试过回来了C
.
class C : P {
func copy() -> C {
return C()
}
}
Run Code Online (Sandbox Code Playgroud)
这导致以下错误:
非终结类'C'中的方法'copy()'必须返回
Self
以符合协议'P'
没有什么可行的,除了我前缀class C
为final
ie 的情况:
final class C : P {
func copy() -> C {
return C()
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我想继承C,那么什么都行不通.有没有办法解决?
每个人的利弊是什么?
我应该在哪里专门使用它们?
我很想知道不同的实时信使应用程序的架构.他们使用任何通用协议/架构吗?
我正在寻找关于如何逐步实现bittorrent协议的教程/博客文章.这个怎么运作?你如何向同行提出要求?和追踪者交谈.
我不介意编程语言(java,ruby,perl,c#)
我正在尝试将泛型与协议混合在一起,我的xD非常困难
我在Android/Java项目中实现了某些架构,我正在尝试重写它以适应swift/iOS项目.但我发现了这个限制.
ProtocolA
protocol ProtocolA {
}
Run Code Online (Sandbox Code Playgroud)
ProtocolB
protocol ProtocolB : ProtocolA {
}
Run Code Online (Sandbox Code Playgroud)
ImplementProtocolA
class ImplementProtocolA <P : ProtocolA> {
let currentProtocol : P
init(currentProtocol : P) {
self.currentProtocol = currentProtocol
}
}
Run Code Online (Sandbox Code Playgroud)
ImplementProtocolB
class ImplementProtocolB : ImplementProtocolA<ProtocolB> {
}
Run Code Online (Sandbox Code Playgroud)
因此,当我尝试将ProtocolB设置为实现ProtocolA的具体类型时,我收到此错误:
不支持使用'ProtocolB'作为符合协议'ProtocolA'的具体类型
1这种"限制"有什么理由吗?
2是否有任何解决方法可以实现此功能?
3它会在某个时候得到支持吗?
- 更新 -
我认为同一问题的另一个变种是:
查看协议
protocol View {
}
protocol GetUserView : View {
func showProgress()
func hideProgress()
func showError(message:String)
func showUser(userDemo:UserDemo)
}
Run Code Online (Sandbox Code Playgroud)
演示者协议
protocol Presenter {
typealias V : …
Run Code Online (Sandbox Code Playgroud) SVN的网络访问有四种常用协议.
svn://repos
svn+ssh://repos
https://repos
http://repos
Run Code Online (Sandbox Code Playgroud)
维基百科页面没有说明四种不同协议的差异.我一直很喜欢svn://
,因为它是最容易设置的,但有什么不同,哪一个是"更好"?
protocols ×10
swift ×3
architecture ×1
bittorrent ×1
browser ×1
delegates ×1
dht ×1
http ×1
iphone ×1
javascript ×1
messenger ×1
moniker ×1
objective-c ×1
oop ×1
p2p ×1
serial-port ×1
smartphone ×1
subclassing ×1
svn ×1
swift2 ×1