Skip to main content
3 votes

Internet Protocol Version 4 Datagram - Checksum Calculator

This is interesting code and I'm happy it works for you in your specific usage, but on a general level I find it lacking. For starters, you have ZERO checks to validate the input ...
Rick Davin's user avatar
  • 6,752
3 votes

Let's play some Swift Poker

This answer is written in the spirit of New answers on old questions using new language features: The Swift language has developed considerably from Swift 1 (in 2014) to the current version Swift 5. ...
Martin R's user avatar
  • 24.2k
2 votes

Unit testing needs only optional methods of protocol in Swift

There are plenty of approaches that can fix your problem. But the main issue is how you build your classes. So IMHO you should focus on that. Recommendation 1: You should build your classes with ...
qwerty's user avatar
  • 121
2 votes

Efficiently structuring data with protocol oriented approach in Swift

Your intuition is correct: you don't need either the Resultable or the Responsable protocol. The reason is that each protocol ...
proxpero's user avatar
  • 121
2 votes
Accepted

iOS: configuring UI appearance and layout, use protocol to extract common code

U can go forward. To simplify the question, you can handle the top part like this ...
black_pearl's user avatar
2 votes
Accepted

Swift protocol with lazy property requirement

You don't need the additional _footype variable and a computer “wrapper” property. The protocol requirement can be satisfied with a lazy stored property: ...
Martin R's user avatar
  • 24.2k
2 votes

Internet Protocol Version 4 Datagram - Checksum Calculator

In addition of @Rick-Davin, too broad method names : GetInternetChecksum and IsValidChecksum and ...
iSR5's user avatar
  • 6,383
2 votes
Accepted

Adding dragging ability to a UIView using UIKitDynamics

Comparing an optional value with nil as in return getValue == nil ? false : getValue! is better done with the nil-coalescing ...
Martin R's user avatar
  • 24.2k
1 vote
Accepted

Timeout thrower using multithreading

The Timeout class doesn't solve the problem you have If you write: ...
G. Sliepen's user avatar
  • 69.3k
1 vote

OO design for chat protocol

The problem with the Command Pattern is indeed the explosion of classes and the verbose boilerplate around each little function. That is better done today with lambda functions: the closure syntax ...
JDługosz's user avatar
  • 11.7k
1 vote
Accepted

Classes for representing teleconferencing numbers

I think you've used the wrong abstraction here. I think that's the cause of all these switch statements. Use Objects or structs ...
user1118321's user avatar
  • 11.9k
1 vote

Simple protocol client library

for ...
alx - recommends codidact's user avatar
1 vote
Accepted

Library for RCON clients

I managed to get rid of the struct module used in proto.py, after I learned that int has a ...
Richard Neumann's user avatar
1 vote
Accepted

Webservice class with parser using generics

Turns out I can just use the generic ModelType defined in the ParserType, and I don't need the same generic parameter in ...
MrJre's user avatar
  • 131
1 vote

Core-data object with relationships conforming protocol in swift

NSManagedObjects already have a property for their current context. It is weak however, which is usually ok for most cases because you would retain the context in ...
malhal's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible