GithubHelp home page GithubHelp logo

jessesquires / jessesquires.com Goto Github PK

View Code? Open in Web Editor NEW
42.0 5.0 18.0 26.25 MB

Turing complete with a stack of 0xdeadbeef

Home Page: https://www.jessesquires.com

License: Other

Ruby 9.56% HTML 50.64% CSS 0.31% Shell 2.99% Makefile 2.06% Swift 17.40% SCSS 17.04%
jekyll blog blogging ios swift objective-c opensource open-source programming git

jessesquires.com's People

Contributors

amonshiz avatar ashish1405 avatar basthomas avatar below avatar codingexplorer avatar daveverwer avatar dependabot-preview[bot] avatar dependabot[bot] avatar dpopov avatar eneko avatar hisaac avatar jessesquires avatar jonathanrauch avatar lugearma avatar natanrolnik avatar paulbruneau avatar teameh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jessesquires.com's Issues

Site re-design

Really dig the aesthetics of http://swiftweekly.github.io which was adapted from this site.

Bring back some of these stylistic changes:

  • Refinements to css
  • All white background
  • Headers
  • Footers
  • Share buttons

Optionals With Core Data

In this article http://www.jessesquires.com/better-coredata-models-in-swift/, you say non-optional values should be written as such (without question mark) in the generated Swift files.

I must disagree.
The model says it is invalid for a given property to have a nil value saved in the persistent store. However, it is perfectly valid for an unsaved entity to have a nil value! (If it has just been created for instance.) Even though it should most of the time not happen.

These properties should be of type "optional but generally not nil," aka. the type followed by an exclamation point.

Your example would then become:

class Employee: NSManagedObject {

    @NSManaged var address: String?
    @NSManaged var dateOfBirth: NSDate!
    @NSManaged var email: String?

    @NSManaged var firstName: String!
    @NSManaged var lastName: String!
    @NSManaged var middleName: String?

    @NSManaged var salary: NSDecimalNumber
    @NSManaged var status: Int32
}

[Failable Initializers] Init? Possible Case

Hi

You say that is better not to use it because may be more dirty... but there are places where it make sence like make an init of an object with a JSON, so if the json don't have the requirements attributes... it will return a nil object.

You can extend the object class with the init?(json: JSON) constructor in your own class that make the request and just call that constructor with an if let myObject = MyObject(json) {}.

What do you think?

Objective-C switches

It’s even worse in Objective-C — there are no errors or warnings for incomplete switch statements --> there are actually although they used to be hidden in -Weverything and maybe still are :). -Weverything, clang diagnostic, and warning flags are your friend :).

BUG WITH SCROLLVIEW AND CONTENT SIZE

I'm using JSQMessageVC, But this cause a bug in my app. when i push JSQMessageVC, the content size of a scrollview in the parentVC change ...
Before :
myScrollview.contentSize = 1000, 375

And after

myScrollview.contentSize = 2.5, 750.0

Do you know why?
JSQMessageVC cause a bug in all scrollview size in my app....

Thanks!

Great Apple interface article you wrote

http://www.jessesquires.com/adaptive-user-interfaces/

I linked to it for my art director.

You wrote "Finally, I should note that iOS 8 also provides an unspecified size class, which essentially means any size class. In other words, an unspecified size class means that a view should always display and behave the same way, regardless of other UI elements or the current device."

I offered him what I hope is a great example of this that you might want to add to your article. A Phone Number Pad. This is a UI element most people want to be about the same size no matter the display (iPhone 4 -> iPad largest) as it is a simulator for a physical thing for a human hand.

Apples to apples, Part II: benchmark is not fair to Obj-C

Hi Jesse, the first blog was interesting but part II caught my attention because the advantage for Swift was just too stratospheric to be true. :) So I quickly noticed that the Obj-C is using NSMutableArray to hold the data being sorted; this is massively inefficient as this array is a container class that imposes extra allocation, message calls and other overheads, but more important, stores all data as objects, so the integer values are boxed. I'm not familiar with Obj-C development at all so I'm not sure of the fine details (e.g. which optimizations the Obj-C compiler may be able to perform to reducing those costs) but it's a huge smoking gun considering many similar systems.

The fair benchmark would use C-style arrays in Obj-C code; it seems to me that Swift's arrays are lightweight, type-specific by-value arrays (largely equivalent to C's even if having some extra features like dynamic sizing). They are also language-level features so the compiler is more likely to have all sorts of special tricks to make that fast. I guess you may have used the NSMutableArray because that may be the more common idiom in Obj-C apps, but for tasks like sorting thousands of integer values no sane programmer would put up with that overhead just for the sake of good OO practices, I hope. Anyway, with the code that you have today, the objective of comparing equivalent compiler optimizations or language features is not achieved (the NS* classes are not even part of the language, they are just libraries).

Your jazzy post

Jesse,

thanks for the post on Jazzy documentation. I just added that to my ExpandableDatePicker project. You should obviously use it because it's awesome :)

Anyways, you mentioned that github will automatically publish that documentation now, but if I go to that repository I don't see where it's actually published.

Question: versioning of swift documentation

Hi Jesse,
I read your blog post on swift documentation using GitHub pages. I really like it - great ideas and a great tutorial.

I have one question left regarding the documentation: Do you have any ideas/ recommendations how to handle different versions of the documentations for your repos?
Ben

Amen to that

I wish I'd read your article before upgrading to Swift 3. You say "resist doing any other refactoring during the migration". Instead I took the opportunity to move lots of methods into a more logical order, which has made merging or rebasing with other work branches extremely painful :-(

I also was not expecting that all my button relationships in my storyboard would be broken by the code changes and require redoing.

http://www.jessesquires.com/migrating-to-swift-3/

My app keeps crashing

Hello.

I build a chat app using JSQMessagesViewController powered by Firebase. My text bubbles are being are working perfectly fine, however after I add a photo message and it has been displayed, I try to add a new text message and the app crashes on "finishSendingMessage()".

Please help :)

screen shot 2016-07-29 at 13 58 26
screen shot 2016-07-29 at 13 58 14
screen shot 2016-07-29 at 13 56 57

Missing final code in post - Avoiding the overuse of @objc in Swift

Improvement request - Also show the final code for NavigationItemConfigurable extension so that it is clearer by just looking at the code - Add -

extension NavigationItemConfigurable where Self: UIViewController {
  func configureNavigationItem() {
    navigationItem.leftBarButtonItem = UIBarButtonItem(
      barButtonSystemItem: .Cancel,
      target: self,
      action: #selector(didTapCancelButton(_:)))
  }
}

TO be clear it is mentioned - "Our previous extension on ViewControllerType can move to NavigationItemConfigurable instead" - but folks tend to look at the code snippet first and it is not included there

Excerpts / snippets

Find a way to programmatically grab article snippets for front page instead of doing this manually in front matter.

Site improvements

Posts

  • categories
  • tags
  • related posts on post page
  • prev/next on post page
  • search

Other pages

  • Archives page
  • About page

[Refactoring singletons in Swift] Singletons inside of the app

Hi Jesse,

I saw your article http://www.jessesquires.com/refactoring-singletons-in-swift/

Nice, I liked.

But singletons are nice because they're really easy to use. Creating dependency injection for each use of singletons will make them much more hard to use.
So, I suggest different idea. To create a new singleton. AppEnviroment.
He will keep references to all singletons used across the app.

I created a gist with raw implementation.
https://gist.github.com/AndreiVidrasco/7469e573934f7fe16cdbd1e72c8474c1

Can you check out and say what do you think?

Thanks,
Andrei

Failable initializers, revisited: Force unwrap in parser?

Thanks for an awesome article!

Do you use force unwrapping in the parser?

Say I have JSON like this:

{
  "id": 1,
  "name": "Lars"
}

Would you do something like this:

typealias JSON = [String: AnyObject]

struct User {
  let id: Int
  let name: String
}

let userValidator = JSONValidator<User> { (json) -> Bool in
  if let
    _ = json["id"] as? Int,
    _ = json["firstname"] as? String
  {
    return true
  }

  return false
}

struct UserParser: JSONParserType {
  func parseJSON(json: JSON) -> User {
    let user = User(
      id: json["id"] as! Int,
      name: json["firstname"] as! String
    )

    return user
  }
}

if let users = parse(json, userValidator, UserParser()) {
  // Stuff..
}

Do you think it is better to join the parser and validator to avoid force unwrapping?

Consolidate redirects?

Would be nice to have a single "redirect file" for the old style (non/blog/) URLs.

Could maybe do this via .htaccess or something?

Blog ideas

Future posts:

  • Using NSErrorPointer in Swift (ref)
  • Failable initializers revisited (see #8)
  • Apples to Apples, Part IV

Can you authorize us to translate your Open Source Swift series into Chinese?

Hello Jesse,

I'm Jie Liang, you can call me Jie if you like.

Last year I organized a group of people to translate Apple's The Swift Programming Language into Chinese, in order to help many Chinese developers who cannot read english learn Swift. If you want to learn more please read this. Apple has added our translation into swift.org.

You know Chinese developers cannot access many websites(like twitter) and many of them cannot read english. So I found a non-profit translate group to help them.

Our group have 20+ people. All of us are iOS developers and we want to translate articles and publish them for free(http://swift.gg). All of our translations have gain the authorization from author. Our goal is helping Chinese iOS developers learn Swift well.

I found your Open Source Swift series really helpful, but I don't want infringement(while many others do). So I write this email to see whether you can authorize us.

We really want to do some useful things for others. We love Swift and we love coding.

We promise:

  • All of our translations will be permanent free
  • We will write your article's link and your name in the beginning of our translations

Would you like to help us?

Thanks.

Mention SwiftGen and Shark in "Namespaced constants in Swift" article

Like Lee Morgan and its AutoAssets you mentioned in your article, others developed tools to generate constants automatically, which could be worth mentioning as well

  • I personally developed SwiftGen which generates enums as constants for Image Assets, but also for Storyboards, UIColors… and even Localizable.strings. See my related blog article here.
  • @kaandedeoglu developed Shark, which has a similar purpose (only dedicated to UIImages, but which adds some hierarchical structure to the constants)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.