Giter VIP home page Giter VIP logo

Comments (7)

nerdyc avatar nerdyc commented on June 20, 2024

Hey Christopher!

Swift types are namespaced by their module names. The full name of the class is actually Squeal.Database, but the compiler only requires the namespace when there is a conflict.

But if you really hate the name, you can always create a typealias:

typealias SquealDB = Squeal.Database
var db = SquealDB()

Does this calm your cringes? After years of having to prefix classes with XYZ (due to the lack of namespaces), I'm pretty happy to not have the name of my project in my class names anymore.

from squeal.

endash avatar endash commented on June 20, 2024

The things I was reading about the automatic namespacing behaviour seemed to indicate that it was a minefield, but if I can personally just use Squeal.Database where others might conceivably just use Database I suppose that'll be just fine.

It seems obvious now that the problem isn't that your class isn't namespaced, it's that the namespacing is, depending on your perspective, either all loosey goosey or groovily transparent. From my Ruby background I'm definitely going with the former :-D

Thanks for the quick feedback!

from squeal.

nerdyc avatar nerdyc commented on June 20, 2024

No problem!

Out of curiosity, where have you been reading about issues with automatic namespacing? I know that at the LLVM layer, modules don't deal with collisions. Objective-C modules, for example, don't prevent collisions. But I thought that the Swift compiler does force authors to deal with collisions.

from squeal.

endash avatar endash commented on June 20, 2024

I personally haven't had problems, simply because I'm so very very very new to Swift. My thought process was as follows: (1) I want to use SQLIte (2) Few minutes of googling later, I find Squeal. Awesome. (3) Bang my head against the wall for a few hours trying to write the most basic of classe and most trivial of tests (4) Take a break to look at the Squeal API (5) See that the entry point is just a "Database" class. (6) Google around for swift and namespacing, find only woe and gnashing of teeth (7) Complain about class name (8) Discover that explicit namespacing is optional, and curse the language gods

from squeal.

endash avatar endash commented on June 20, 2024

I must be dumber than a two year old because I'm getting "No such module 'Squeal'" if I import Squeal and "Use of undeclared type 'Squeal'" if I don't. I'm starting to regret giving iPhone dev another try.

from squeal.

nerdyc avatar nerdyc commented on June 20, 2024

I think you're running into the same issue in #14. The long and short: you need to ensure your app is linked against the Squeal framework. I should've updated the docs sooner :/

iOS development definitely has a steeper initial learning curve, especially if you're coming from a completely different toolset. But once you get yourself oriented there's a lot of great things to build and enjoy.

from squeal.

endash avatar endash commented on June 20, 2024

I did iOS dev for a year back in 2011/2012 and as long as I could stay in the code and the APIs I was golden. The moment I had to do anything in xcode... oy.

Hallelujiah adding the framework did the trick. Well, for that problem at least :P

from squeal.

Related Issues (20)

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.